diff --git a/src/main/java/com/hbm/entity/mob/EntityUndeadSoldier.java b/src/main/java/com/hbm/entity/mob/EntityUndeadSoldier.java index 1a18c36c7..f2b042085 100644 --- a/src/main/java/com/hbm/entity/mob/EntityUndeadSoldier.java +++ b/src/main/java/com/hbm/entity/mob/EntityUndeadSoldier.java @@ -16,10 +16,11 @@ import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; public class EntityUndeadSoldier extends EntityMob { - + public static final int DW_TYPE = 12; public static final byte TYPE_ZOMBIE = 0; public static final byte TYPE_SKELETON = 1; @@ -66,7 +67,7 @@ public class EntityUndeadSoldier extends EntityMob { this.setCurrentItemOrArmor(3, new ItemStack(ModItems.taurun_plate)); this.setCurrentItemOrArmor(2, new ItemStack(ModItems.taurun_legs)); this.setCurrentItemOrArmor(1, new ItemStack(ModItems.taurun_boots)); - + int gun = rand.nextInt(5); if(gun == 0) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_heavy_revolver)); if(gun == 1) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_light_revolver)); @@ -74,7 +75,7 @@ public class EntityUndeadSoldier extends EntityMob { if(gun == 3) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_maresleg)); if(gun == 4) this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_greasegun)); } - + @Override protected String getLivingSound() { byte type = this.dataWatcher.getWatchableObjectByte(DW_TYPE); @@ -110,7 +111,12 @@ public class EntityUndeadSoldier extends EntityMob { public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEAD; } - + + @Override + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } + @Override protected void dropFewItems(boolean player, int loot) { } @Override protected void dropEquipment(boolean player, int loot) { } } diff --git a/src/main/java/com/hbm/world/gen/util/DungeonSpawnerActions.java b/src/main/java/com/hbm/world/gen/util/DungeonSpawnerActions.java index fee835c2e..252bc543b 100644 --- a/src/main/java/com/hbm/world/gen/util/DungeonSpawnerActions.java +++ b/src/main/java/com/hbm/world/gen/util/DungeonSpawnerActions.java @@ -40,19 +40,25 @@ public class DungeonSpawnerActions { int y = tile.yCoord; int z = tile.zCoord; if (tile.phase == 1 || tile.phase == 2) { + tile.player = world.getClosestPlayer(x,y,z, 25); if (tile.timer == 0) { - Vec3NT vec = new Vec3NT(10, 0, 0); + Vec3NT vec = new Vec3NT(20, 0, 0); for (int i = 0; i < 10; i++) { + + if(vec.xCoord > 8) vec.xCoord += world.rand.nextInt(10) - 5; + EntityUndeadSoldier mob = new EntityUndeadSoldier(world); for (int j = 0; j < 7; j++) { - mob.setPositionAndRotation(x + 0.5 + vec.xCoord, y - 5, z + 0.5 + vec.zCoord, i * 36F, 0); + mob.setPositionAndRotation(x + 0.5 + vec.xCoord, world.getHeightValue((int) (x + 0.5 + vec.xCoord),(int) (z + 0.5 + vec.zCoord)), z + 0.5 + vec.zCoord, i * 36F, 0); if (mob.getCanSpawnHere()) { mob.onSpawnWithEgg(null); + if(tile.player != null){ + mob.setTarget(tile.player); + } world.spawnEntityInWorld(mob); break; } } - vec.rotateAroundYDeg(36D); } } diff --git a/src/main/java/com/hbm/world/gen/util/DungeonSpawnerConditions.java b/src/main/java/com/hbm/world/gen/util/DungeonSpawnerConditions.java index 83dd773e8..1e0cc9d5a 100644 --- a/src/main/java/com/hbm/world/gen/util/DungeonSpawnerConditions.java +++ b/src/main/java/com/hbm/world/gen/util/DungeonSpawnerConditions.java @@ -32,13 +32,15 @@ public class DungeonSpawnerConditions { int x = tile.xCoord; int y = tile.yCoord; int z = tile.zCoord; + + boolean aoeCheck = !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y - 2, z + 1).expand(10, 10, 10)).isEmpty(); if(tile.phase == 0) { if(world.getTotalWorldTime() % 20 != 0) return false; - return !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y - 2, z + 1).expand(20, 10, 20)).isEmpty(); + return aoeCheck; } if(tile.phase < 3) { if(world.getTotalWorldTime() % 20 != 0 || tile.timer < 60) return false; - return world.getEntitiesWithinAABB(EntityUndeadSoldier.class, AxisAlignedBB.getBoundingBox(x, y, z, x - 2, y + 1, z + 1).expand(50, 20, 50)).isEmpty(); + return world.getEntitiesWithinAABB(EntityUndeadSoldier.class, AxisAlignedBB.getBoundingBox(x, y, z, x - 2, y + 1, z + 1).expand(50, 20, 50)).isEmpty() && aoeCheck; } return false; };