Skip to content

Commit 3009b07

Browse files
committed
use the arena provided by the guardian
1 parent d8c3b42 commit 3009b07

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import net.minecraft.world.level.block.Block;
3030

3131
import org.jetbrains.annotations.NotNull;
32-
import org.jetbrains.annotations.Nullable;
3332
import org.slf4j.Logger;
3433
import org.slf4j.LoggerFactory;
3534

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

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

221-
default void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {
220+
default void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {}
222221

223-
}
224-
225-
default boolean isInGaiaArena(Entity entity) {
226-
return isInGaiaArena(entity.getLevel(), entity.getX(), entity.getY(), entity.getZ());
227-
}
228-
229-
default boolean isInGaiaArena(@Nullable Level level, double x, double y, double z) {
222+
default boolean isInGaiaArena(Level level, double x, double y, double z) {
230223
return false;
231224
}
232225
}

Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private static int countGaiaGuardiansAround(Level world, BlockPos source) {
566566
}
567567

568568
@NotNull
569-
private static AABB getArenaBB(@NotNull BlockPos source) {
569+
public static AABB getArenaBB(@NotNull BlockPos source) {
570570
double range = 15.0;
571571
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);
572572
}

Xplat/src/main/java/vazkii/botania/common/impl/BotaniaAPIImpl.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import net.minecraft.world.phys.Vec3;
3232

3333
import org.jetbrains.annotations.NotNull;
34-
import org.jetbrains.annotations.Nullable;
3534

3635
import vazkii.botania.api.BotaniaAPI;
3736
import vazkii.botania.api.brew.Brew;
@@ -272,12 +271,10 @@ public void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {
272271
}
273272

274273
@Override
275-
public boolean isInGaiaArena(@Nullable Level level, double x, double y, double z) {
276-
if (level == null)
277-
return false;
274+
public boolean isInGaiaArena(Level level, double x, double y, double z) {
278275
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));
279276
for (GaiaGuardianEntity guardianEntity : guardianEntities) {
280-
if (guardianEntity.getSource().distToCenterSqr(x, y, z) < GaiaGuardianEntity.ARENA_RANGE * GaiaGuardianEntity.ARENA_RANGE) {
277+
if (GaiaGuardianEntity.getArenaBB(guardianEntity.getSource()).contains(x, y, z)) {
281278
return true;
282279
}
283280
}

0 commit comments

Comments
 (0)