Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gaia arena check to api #4299

Open
wants to merge 3 commits into
base: 1.19.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,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(Level level, double x, double y, double z) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,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 @@ -22,6 +22,8 @@
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;

Expand All @@ -31,6 +33,8 @@
import vazkii.botania.api.internal.ManaNetwork;
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 @@ -173,7 +177,7 @@ public Ingredient getRepairIngredient() {

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

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

@Override
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 (GaiaGuardianEntity.getArenaBB(guardianEntity.getSource()).contains(x, y, z)) {
return true;
}
}
return false;
}
}