From a949809eccf5bc50be15797ba5681dd53a58181d Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 25 Dec 2015 19:11:38 +0000 Subject: [PATCH] Tweaked some things with the Gaia Guardian. --- .../common/entity/EntityDoppleganger.java | 89 +++++++++++++++---- 1 file changed, 71 insertions(+), 18 deletions(-) diff --git a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java index c8ee07597..fcf87b340 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java +++ b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java @@ -12,6 +12,7 @@ package vazkii.botania.common.entity; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.regex.Pattern; @@ -79,7 +80,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWithShader { - public static final int SPAWN_TICKS = 100; + public static final int SPAWN_TICKS = 160; private static final float RANGE = 12F; private static final float MAX_HP = 800F; @@ -106,6 +107,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi { -4, 1, -4 } }; + private static final List CHEATY_BLOCKS = Arrays.asList(new String[] { + "OpenBlocks:beartrap", + "ThaumicTinkerer:magnet" + }); + boolean spawnLandmines = false; boolean spawnPixies = false; boolean anyWithArmor = false; @@ -521,19 +527,27 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi setDead(); if(!worldObj.isRemote) { + int radius = 1; int posXInt = MathHelper.floor_double(posX); int posYInt = MathHelper.floor_double(posY); int posZInt = MathHelper.floor_double(posZ); - Block block = worldObj.getBlock(posXInt, posYInt, posZInt); - if(block.getBlockHardness(worldObj, posXInt, posYInt, posZInt) >= 0) { - List items = block.getDrops(worldObj, posXInt, posYInt, posZInt, 0, 0); - for(ItemStack stack : items) { - if(ConfigHandler.blockBreakParticles) - worldObj.playAuxSFX(2001, posXInt, posYInt, posZInt, Block.getIdFromBlock(block) + (worldObj.getBlockMetadata(posXInt, posYInt, posZInt) << 12)); - worldObj.spawnEntityInWorld(new EntityItem(worldObj, posXInt + 0.5, posYInt + 0.5, posZInt + 0.5, stack)); - } - worldObj.setBlockToAir(posXInt, posYInt, posZInt); - } + for(int i = -radius; i < radius + 1; i++) + for(int j = -radius; j < radius + 1; j++) + for(int k = -radius; k < radius + 1; k++) { + int xp = posXInt + i; + int yp = posYInt + j; + int zp = posZInt + k; + if(isCheatyBlock(worldObj, xp, yp, zp)) { + Block block = worldObj.getBlock(xp, yp, zp); + List items = block.getDrops(worldObj, xp, yp, zp, 0, 0); + for(ItemStack stack : items) { + if(ConfigHandler.blockBreakParticles) + worldObj.playAuxSFX(2001, xp, yp, zp, Block.getIdFromBlock(block) + (worldObj.getBlockMetadata(xp, yp, zp) << 12)); + worldObj.spawnEntityInWorld(new EntityItem(worldObj, xp + 0.5, yp + 0.5, zp + 0.5, stack)); + } + worldObj.setBlockToAir(xp, yp, zp); + } + } } ChunkCoordinates source = getSource(); @@ -599,10 +613,40 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi int mobTicks = getMobSpawnTicks(); boolean spawnMissiles = hard && ticksExisted % 15 < 4; + if(invul > 10) { + Vector3 pos = Vector3.fromEntityCenter(this).subtract(new Vector3(0, 0.2, 0)); + for(int i = 0; i < PYLON_LOCATIONS.length; i++) { + int[] arr = PYLON_LOCATIONS[i]; + int x = arr[0]; + int y = arr[1]; + int z = arr[2]; + + Vector3 pylonPos = new Vector3(source.posX + x, source.posY + y, source.posZ + z); + double worldTime = ticksExisted; + worldTime /= 5; + + float rad = 0.75F + (float) Math.random() * 0.05F; + double xp = pylonPos.x + 0.5 + Math.cos(worldTime) * rad; + double zp = pylonPos.z + 0.5 + Math.sin(worldTime) * rad; + + Vector3 partPos = new Vector3(xp, pylonPos.y, zp); + Vector3 mot = pos.copy().sub(partPos).multiply(0.04); + + float r = 0.7F + (float) Math.random() * 0.3F; + float g = (float) Math.random() * 0.3F; + float b = 0.7F + (float) Math.random() * 0.3F; + + Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F); + Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.4F, (float) mot.x, (float) mot.y, (float) mot.z); + } + } + if(invul > 0 && mobTicks == MOB_SPAWN_TICKS) { - if(invul < SPAWN_TICKS && invul > SPAWN_TICKS / 2 && worldObj.rand.nextInt(SPAWN_TICKS - invul + 1) == 0) - for(int i = 0; i < 2; i++) - spawnExplosionParticle(); + if(invul < SPAWN_TICKS) { + if(invul > SPAWN_TICKS / 2 && worldObj.rand.nextInt(SPAWN_TICKS - invul + 1) == 0) + for(int i = 0; i < 2; i++) + spawnExplosionParticle(); + } if(!worldObj.isRemote) { setHealth(getHealth() + (getMaxHealth() - 1F) / SPAWN_TICKS); @@ -630,7 +674,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi switch(worldObj.rand.nextInt(2)) { case 0 : { entity = new EntityZombie(worldObj); - if(worldObj.rand.nextInt(hard ? 9 : 12) == 0) + if(worldObj.rand.nextInt(hard ? 3 : 12) == 0) entity = new EntityWitch(worldObj); break; @@ -683,8 +727,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi if(tries >= 50) teleportTo(source.posX + 0.5, source.posY + 1.6, source.posZ + 0.5); - if(spawnLandmines) - for(int i = 0; i < 6; i++) { + if(spawnLandmines) { + int count = dying && hard ? 7 : 6; + for(int i = 0; i < count; i++) { int x = source.posX - 10 + rand.nextInt(20); int z = source.posZ - 10 + rand.nextInt(20); int y = worldObj.getTopSolidOrLiquidBlock(x, z); @@ -695,6 +740,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi worldObj.spawnEntityInWorld(landmine); } + } + if(!players.isEmpty()) for(int pl = 0; pl < playerCount; pl++) for(int i = 0; i < (spawnPixies ? worldObj.rand.nextInt(hard ? 6 : 3) : 1); i++) { @@ -704,7 +751,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi worldObj.spawnEntityInWorld(pixie); } - setTPDelay(hard ? dying ? 20 : 45 : dying ? 40 : 60); + setTPDelay(hard ? (dying ? 35 : 45) : (dying ? 40 : 60)); spawnLandmines = true; spawnPixies = false; } @@ -732,6 +779,12 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi } } + public static boolean isCheatyBlock(World world, int x, int y, int z) { + Block block = world.getBlock(x, y, z); + String name = Block.blockRegistry.getNameForObject(block); + return CHEATY_BLOCKS.contains(name); + } + // EntityEnderman code below ============================================================================ protected boolean teleportRandomly() {