Skip to content

Commit

Permalink
use the arena provided by the guardian
Browse files Browse the repository at this point in the history
  • Loading branch information
justliliandev committed Feb 28, 2023
1 parent d8c3b42 commit 3009b07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
11 changes: 2 additions & 9 deletions Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraft.world.level.block.Block;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -218,15 +217,9 @@ default boolean hasSolegnoliaAround(Entity e) {

default void sparkleFX(Level world, double x, double y, double z, float r, float g, float b, float size, int m) {}

default void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {
default void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {}

}

default boolean isInGaiaArena(Entity entity) {
return isInGaiaArena(entity.getLevel(), entity.getX(), entity.getY(), entity.getZ());
}

default boolean isInGaiaArena(@Nullable Level level, double x, double y, double z) {
default boolean isInGaiaArena(Level level, double x, double y, double z) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ private static int countGaiaGuardiansAround(Level world, BlockPos source) {
}

@NotNull
private static AABB getArenaBB(@NotNull BlockPos source) {
public static AABB getArenaBB(@NotNull BlockPos source) {
double range = 15.0;
return new AABB(source.getX() + 0.5 - range, source.getY() + 0.5 - range, source.getZ() + 0.5 - range, source.getX() + 0.5 + range, source.getY() + 0.5 + range, source.getZ() + 0.5 + range);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import net.minecraft.world.phys.Vec3;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
Expand Down Expand Up @@ -272,12 +271,10 @@ public void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {
}

@Override
public boolean isInGaiaArena(@Nullable Level level, double x, double y, double z) {
if (level == null)
return false;
public boolean isInGaiaArena(Level level, double x, double y, double z) {
List<GaiaGuardianEntity> guardianEntities = level.getEntitiesOfClass(GaiaGuardianEntity.class, AABB.ofSize(new Vec3(x, y, z), GaiaGuardianEntity.ARENA_RANGE * 4, GaiaGuardianEntity.ARENA_RANGE * 4, GaiaGuardianEntity.ARENA_RANGE * 4));
for (GaiaGuardianEntity guardianEntity : guardianEntities) {
if (guardianEntity.getSource().distToCenterSqr(x, y, z) < GaiaGuardianEntity.ARENA_RANGE * GaiaGuardianEntity.ARENA_RANGE) {
if (GaiaGuardianEntity.getArenaBB(guardianEntity.getSource()).contains(x, y, z)) {
return true;
}
}
Expand Down

0 comments on commit 3009b07

Please sign in to comment.