Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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 @@ -220,4 +221,12 @@ default void sparkleFX(Level world, double x, double y, double z, float r, float
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) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
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 All @@ -37,6 +40,7 @@
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.flower.functional.SolegnoliaBlockEntity;
import vazkii.botania.common.brew.BotaniaBrews;
import vazkii.botania.common.entity.GaiaGuardianEntity;
import vazkii.botania.common.handler.BotaniaSounds;
import vazkii.botania.common.handler.EquipmentHandler;
import vazkii.botania.common.handler.ManaNetworkHandler;
Expand Down Expand Up @@ -176,7 +180,7 @@ public Ingredient getRepairIngredient() {

@Override
public int apiVersion() {
return 2;
return 3;
}

@Override
Expand Down Expand Up @@ -266,4 +270,17 @@ public void registerPaintableBlock(ResourceLocation block, Function<DyeColor, Bl
public void registerCorporeaNodeDetector(CorporeaNodeDetector detector) {
CorporeaNodeDetectors.register(detector);
}

@Override
public boolean isInGaiaArena(@Nullable Level level, double x, double y, double z) {
if (level == null)
return false;
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) {
return true;
}
}
return false;
}
}