diff --git a/Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java b/Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java index dcc2d80b60..df97de6edc 100644 --- a/Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java +++ b/Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java @@ -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; @@ -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; } } diff --git a/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java b/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java index bd07264986..aac252bc83 100644 --- a/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java @@ -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); } diff --git a/Xplat/src/main/java/vazkii/botania/common/impl/BotaniaAPIImpl.java b/Xplat/src/main/java/vazkii/botania/common/impl/BotaniaAPIImpl.java index 2a76561097..8d0692aa89 100644 --- a/Xplat/src/main/java/vazkii/botania/common/impl/BotaniaAPIImpl.java +++ b/Xplat/src/main/java/vazkii/botania/common/impl/BotaniaAPIImpl.java @@ -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; @@ -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 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; } }