From 2de07bae33c01f8f5f28b1a7758871865b5f0898 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Mon, 21 Sep 2015 16:12:43 +0100 Subject: [PATCH] Added arena checking code to the Gaia Guardian to prevent it from being killable with little to no effort underground. --- .../common/entity/EntityDoppleganger.java | 26 ++++++++++++++++--- .../resources/assets/botania/lang/en_US.lang | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java index bd0f83e4d..f523abd99 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java +++ b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java @@ -79,6 +79,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWithShader { public static final int SPAWN_TICKS = 100; + private static final float RANGE = 12F; + private static final float MAX_HP = 300F; public static final int MOB_SPAWN_START_TICKS = 20; public static final int MOB_SPAWN_END_TICKS = 80; @@ -87,8 +89,6 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi public static final int MOB_SPAWN_WAVES = 10; public static final int MOB_SPAWN_WAVE_TIME = MOB_SPAWN_BASE_TICKS / MOB_SPAWN_WAVES; - private static final float MAX_HP = 300F; - private static final String TAG_INVUL_TIME = "invulTime"; private static final String TAG_AGGRO = "aggro"; private static final String TAG_SOURCE_X = "sourceX"; @@ -159,6 +159,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi return false; } } + + if(!hasProperArena(par3World, par4, par5, par6)) { + player.addChatMessage(new ChatComponentTranslation("botaniamisc.badArena").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + return false; + } par1ItemStack.stackSize--; EntityDoppleganger e = new EntityDoppleganger(par3World); @@ -185,6 +190,19 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi return false; } + + private static boolean hasProperArena(World world, int sx, int sy, int sz) { + int range = (int) Math.ceil(RANGE); + for(int i = -range; i < range + 1; i++) + for(int j = -range; j < range + 1; j++) { + int x = sx + i; + int z = sz + j; + int y = world.getTopSolidOrLiquidBlock(x, z); + if(Math.abs(y - sy) > 10) + return false; + } + return true; + } @Override protected boolean isAIEnabled() { @@ -465,7 +483,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi ChunkCoordinates source = getSource(); boolean hard = isHardMode(); - float range = 15F; + float range = RANGE + 3F; List players = getPlayersAround(); int playerCount = getPlayerCount(); @@ -474,7 +492,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi isPlayingMusic = true; } - range = 12F; + range = RANGE; for(int i = 0; i < 360; i += 8) { float r = 0.6F; float g = 0F; diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index e02ce221f..e2ea163a3 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -142,6 +142,7 @@ botaniamisc.changes2=Things change, don't panic. If something seems off, read th botaniamisc.changes3=&oEveryone is afraid of change, yet change is the force that moves us forward. botaniamisc.changes4=&fShift-Left Click&7 to read the changes since then botaniamisc.changes5=&fLeft Click&7 to dismiss this +botaniamisc.badArena=As hard as you try, the Beacon will not accept your sacrifice. You believe the ritual grounds might be improper. It might be a good idea to check for obstructions on the nearby area or large gaps on the floor. # NEI INTEGRATION botania.nei.brewery=Botanical Brewery