diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 0b5df99..1f9fad9 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -1780,6 +1780,7 @@ public void runTick() { } } } else { + if (l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 && !l.isDead() && l.getKiller()!=null) { /* for (int k=-1;k<2;k++) { for (int j=-1;j<2;j++) { @@ -1800,26 +1801,48 @@ public void runTick() { } } }*/ //Charge Zombie II's now only break blocks when YOU get hit by them. - /*//OLD CHARGE ZOMBIE II BEHAVIOR. - for (int k=-2;k<3;k++) { - for (int j=-2;j<3;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); + //OLD CHARGE ZOMBIE II BEHAVIOR. + for (int k=-2;k<3;k++) { + for (int j=-2;j<3;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL) { - bl.breakNaturally(); + } + } else + if (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 && !l.isDead() && l.getKiller()!=null) { + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } } } - }*/ + } } } } @@ -2610,7 +2633,21 @@ public void checkJukeboxes() { //Bukkit.getLogger().info("Disparity is "+(unmatched/6727.0d*100)+"%"); } } - if (!spawneddungeon) { + int airmeasure=0; + //Get the underground chunk density of this chunk. + //Max chunk density is 12800. + Chunk c = list[i].getWorld().getChunkAt(list[i].getLocation()); + for (int x=0;x<16;x++) { + for (int y=0;y<50;y++) { + for (int z=0;z<16;z++) { + if (c.getBlock(x, y, z).getType()==Material.AIR) { + airmeasure++; + } + } + } + } + //Bukkit.getLogger().info("For player "+list[i].getName()+", Chunk air density is "+((double)airmeasure/12800)*100.0d+"%"); + if (!spawneddungeon && ((double)airmeasure/12800)*100.0d<=10) { //Make sure the air density is small enough that we are allowed to carve things. //See if the player is very far underground and there is nothing around him/her. This would be odd behavior (Hint at strip mining) and we will force Charge Zombie II's to spawn and create areas. List nearby = list[i].getNearbyEntities(20, 5, 20); for (int j=0;j-11;j--) { - for (int k=4;k>-2;k--) { - for (int l=10;l>-11;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(30+j,k+randomheight,spread+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { - torch1=true; - } - } - } - } - if (!torch1) { - int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; - for (int j=lb1;j>ub1;j--) { - for (int k=(int)(Math.random()*4)+1;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); - if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - } - torch2=false; - spread = (int)(Math.random()*20)+20; - randomheight=(int)(Math.random()*5)-(int)(Math.random()*5); - for (int j=10;j>-11;j--) { - for (int k=4;k>-2;k--) { - for (int l=10;l>-11;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k+randomheight,spread+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { - torch2=true; - } - } - } - } - if (!torch2) { - int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; - for (int j=lb1;j>ub1;j--) { - for (int k=(int)(Math.random()*4)+1;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); - if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - } - spread = (int)(Math.random()*20)+20; - for (int j=10;j>-11;j--) { - for (int k=4;k>-2;k--) { - for (int l=10;l>-11;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k+randomheight,20+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { - torch3=true; - } - } - } - } - if (!torch3) { - int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; - for (int j=lb1;j>ub1;j--) { - for (int k=(int)(Math.random()*4)+1;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); - if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - } - spread = (int)(Math.random()*20)+20; - for (int j=10;j>-11;j--) { - for (int k=4;k>-2;k--) { - for (int l=10;l>-11;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k+randomheight,-20+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { - torch4=true; - } - } - } - } - if (!torch4) { - int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; - for (int j=lb1;j>ub1;j--) { - for (int k=(int)(Math.random()*4)+1;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); - if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - } - if (!torch1) { - Zombie z1 = (Zombie)e1; - z1.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z1.setCustomNameVisible(false); - z1.setTarget(list[i]); - } - if (!torch2) { - Zombie z2 = (Zombie)e2; - z2.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z2.setCustomNameVisible(false); - z2.setTarget(list[i]); - } - if (!torch3) { - Zombie z3 = (Zombie)e3; - z3.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z3.setCustomNameVisible(false); - z3.setTarget(list[i]); - } - if (!torch4) { - Zombie z4 = (Zombie)e4; - z4.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z4.setCustomNameVisible(false); - z4.setTarget(list[i]); - }*/ } - /* Kind of an out-of-date way to spawn things. Don't need anymore. - //Find out how much a player is worth. - if (list[i].getWorld().getName().compareTo("world")==0 && list[i].getLocation().getY()<=50) { - double value=0; - ItemStack[] items = list[i].getInventory().getContents(); - for (int j=0;j loredata = items[j].getItemMeta().getLore(); - for (int m=0;m loredata = items[j].getItemMeta().getLore(); - for (int m=0;m loredata = items[j].getItemMeta().getLore(); - for (int m=0;m-1;k--) { for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { b.setType(Material.AIR); } } @@ -3306,7 +3304,7 @@ implements Listener for (int k=2;k>-1;k--) { for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { b.setType(Material.AIR); } }