Fixes to Charge Zombie spawning. Verify blocks are natural blocks and
the logic for checking was corrected.
This commit is contained in:
parent
97417c7280
commit
350f818c77
@ -1357,6 +1357,28 @@ public void onDisable()
|
||||
sign.update();
|
||||
}
|
||||
|
||||
public boolean naturalBlock(Material mat) {
|
||||
List<Material> natural_mats = new ArrayList<Material>();
|
||||
natural_mats.add(Material.DIRT);
|
||||
natural_mats.add(Material.STONE);
|
||||
natural_mats.add(Material.WOOD);
|
||||
natural_mats.add(Material.FENCE);
|
||||
natural_mats.add(Material.GRAVEL);
|
||||
natural_mats.add(Material.SAND);
|
||||
natural_mats.add(Material.CLAY);
|
||||
natural_mats.add(Material.WEB);
|
||||
natural_mats.add(Material.IRON_ORE);
|
||||
natural_mats.add(Material.GOLD_ORE);
|
||||
natural_mats.add(Material.DIAMOND_ORE);
|
||||
natural_mats.add(Material.EMERALD_ORE);
|
||||
natural_mats.add(Material.LAPIS_ORE);
|
||||
natural_mats.add(Material.REDSTONE_ORE);
|
||||
if (natural_mats.contains(mat)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void runTick() {
|
||||
final Main plugin = this;
|
||||
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
|
||||
@ -2939,7 +2961,7 @@ public void checkJukeboxes() {
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=lb2;l>-ub2;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k,spread+l));
|
||||
if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) {
|
||||
if (Math.random()<=0.75 && 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);
|
||||
}
|
||||
}
|
||||
@ -2965,7 +2987,7 @@ public void checkJukeboxes() {
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=lb2;l>-ub2;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k,spread+l));
|
||||
if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) {
|
||||
if (Math.random()<=0.75 && 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);
|
||||
}
|
||||
}
|
||||
@ -2990,7 +3012,7 @@ public void checkJukeboxes() {
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=lb2;l>-ub2;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,20+l));
|
||||
if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) {
|
||||
if (Math.random()<=0.75 && 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);
|
||||
}
|
||||
}
|
||||
@ -3015,7 +3037,7 @@ public void checkJukeboxes() {
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=lb2;l>-ub2;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,-20+l));
|
||||
if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) {
|
||||
if (Math.random()<=0.75 && 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);
|
||||
}
|
||||
}
|
||||
@ -5339,7 +5361,6 @@ public void payDay(int time)
|
||||
* @param item The item to add the bonus enchant to.
|
||||
* @param enchant The bonus enchantment to apply. (See Main.ENCHANT_)
|
||||
* @param amt The value of the enchantment to apply.
|
||||
* @param override Whether or not the enchantment should be overwritten.
|
||||
* @return The item with the new enchantment added in.
|
||||
*/
|
||||
public ItemStack addBonusEnchantment(ItemStack item, BonusEnchantment enchant, int amt) {
|
||||
|
@ -2864,7 +2864,7 @@ implements Listener
|
||||
if (Math.random()<=1.00-((m+4)*0.05d)) {
|
||||
Location checkloc = e.getEntity().getLocation().add(k,m,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.getType()!=Material.MOSSY_COBBLESTONE && naturalBlock(bl.getType())) {
|
||||
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.getType()!=Material.MOSSY_COBBLESTONE && naturalBlock(bl.getType())) {
|
||||
bl.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
@ -4447,7 +4447,7 @@ implements Listener
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=5;l>-6;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(20+j,k,spread+l));
|
||||
if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE && naturalBlock(b.getType())) {
|
||||
if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) {
|
||||
torch1=true;
|
||||
}
|
||||
}
|
||||
@ -4473,7 +4473,7 @@ implements Listener
|
||||
for (int k=2;k>-1;k--) {
|
||||
for (int l=5;l>-6;l--) {
|
||||
Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l));
|
||||
if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE && naturalBlock(b.getType())) {
|
||||
if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) {
|
||||
torch2=true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user