From 682bd491f113c729b1efdde8a940efbb486b5817 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sat, 22 Oct 2016 16:38:11 +0100 Subject: [PATCH] You can no longer summon a Guardian of Gaia if there's already one nearby. --- .../botania/common/entity/EntityDoppleganger.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java index 52d0e0f6b..41ecc6dfb 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java +++ b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java @@ -202,6 +202,10 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss { return false; } + int guardians = getGaiaGuardiansAround(world, pos); + if(guardians > 0) + return false; + if(world.isRemote) return true; @@ -503,6 +507,12 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss { return worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(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)); } + private static int getGaiaGuardiansAround(World worldObj, BlockPos source) { + float range = 15F; + List l = worldObj.getEntitiesWithinAABB(EntityDoppleganger.class, new AxisAlignedBB(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)); + return l.size(); + } + @Override public void onLivingUpdate() { super.onLivingUpdate();