diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 7aafbe0..407ed6d 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/ChargeZombie.java b/src/sig/plugin/TwosideKeeper/ChargeZombie.java index 74c3e5c..89c90f1 100644 --- a/src/sig/plugin/TwosideKeeper/ChargeZombie.java +++ b/src/sig/plugin/TwosideKeeper/ChargeZombie.java @@ -1,9 +1,13 @@ package sig.plugin.TwosideKeeper; +import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.Monster; import aPlugin.BlockUtils; +import aPlugin.Utils; +import net.minecraft.server.v1_9_R1.BlockPosition; import sig.plugin.TwosideKeeper.HelperStructures.BlockToughness; public class ChargeZombie { @@ -25,12 +29,33 @@ public class ChargeZombie { public void BreakBlocksAroundArea(int radius) { for (int x=-radius;xm.getLocation().getY())) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. + if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player. + boolean brokeliquid = false; + //Break it. + if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) { + if (m.getLocation().add(x,y,z).getBlock().getType()==Material.WATER || + m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_WATER || + m.getLocation().add(x,y,z).getBlock().getType()==Material.LAVA || + m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) { + brokeliquid=true; + } + if (brokeliquid) { + m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_WATER_AMBIENT, 0.03f, 0.5f); + //m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 0.03f, 0.5f); + } else { + m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f); + } + m.getLocation().add(x,y,z).getBlock().breakNaturally(); + Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), -1, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock())); + } else { + Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), 4, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock())); + } + } } } } @@ -42,10 +67,10 @@ public class ChargeZombie { int blocktoughness = 0; switch (b.getType()) { case OBSIDIAN:{ - blocktoughness=20; + blocktoughness=100; }break; case ENDER_CHEST:{ - blocktoughness=20; + blocktoughness=44; }break; case ANVIL:{ blocktoughness=10; @@ -140,45 +165,40 @@ public class ChargeZombie { case WOODEN_DOOR:{ blocktoughness=6; }break; + case CHEST: + case TRAPPED_CHEST: + case WORKBENCH:{ + blocktoughness=5; + }break; + case BRICK_STAIRS: + case BRICK: + case CAULDRON: + case COBBLESTONE: + case COBBLESTONE_STAIRS: + case COBBLE_WALL: + case FENCE: + case FENCE_GATE: + case JUKEBOX: + case MOSSY_COBBLESTONE: + case NETHER_BRICK: + case NETHER_FENCE: + case NETHER_BRICK_STAIRS: + case STONE_SLAB2: + case LOG: + case WOOD: + case WOOD_STEP:{ + blocktoughness=4; + }break; + case STONE: + case BOOKSHELF: + case PRISMARINE: + case STAINED_CLAY: + case HARD_CLAY:{ + blocktoughness=3; + } } - /* - * OBSIDIAN(50), - ENDER_CHEST(23), - ANVIL(10), - COAL_BLOCK(10), - DIAMOND_BLOCK(10), - EMERALD_BLOCK(10), - IRON_BLOCK(10), - REDSTONE_BLOCK(10), - ENCHANTMENT_TABLE(10), - IRON_FENCE(10), - IRON_DOOR(10), - IRON_TRAPDOOR(10), - MONSTER_SPAWNER(10), - WEB(10), - DISPENSER(10), - DROPPER(10), - FURNACE(10), - BEACON(6), - BLOCK_OF_GOLD(6), - COAL_ORE(6), - DIAMOND_ORE(6), - EMERALD_ORE(6), - END_STONE(6), - GOLD_ORE(6), - HOPPER(6), - IRON_ORE(6), - LAPIS_BLOCK(6), - LAPIS_ORE(6), - NETHER_QUARTZ_ORE(6), - REDSTONE_ORE(6), - GLOWING_REDSTONE_ORE(6), - TRAP_DOOR(6), - WOODEN_DOOR(6); - */ - - if (Math.random()*((double)blocktoughness/5)<1) { + if (Math.random()*((double)blocktoughness)<0.25) { return true; } else { return false; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java index 7a00c90..4acff4a 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java @@ -73,7 +73,7 @@ public class Loot { enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1)); } else { - enchantment_level = (int)(((Math.random()*9))*((hardened)?HARDENED_ENCHANT_MULT:1)); + enchantment_level = (int)(((Math.random()*9)+1)*((hardened)?HARDENED_ENCHANT_MULT:1)); } if (enchantment_level>MAX_ENCHANT_LEVEL) { @@ -88,11 +88,11 @@ public class Loot { item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.DIG_SPEED, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2); if (item.getType().toString().contains("HOE")) {item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10);} if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.SILK_TOUCH, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, GetEnchantmentLevels(item.getType(),hardened));} } else if (item.getType()==Material.BOW) { item.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, GetEnchantmentLevels(item.getType(),hardened)); @@ -100,7 +100,7 @@ public class Loot { item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} } else if (GenericFunctions.isWeapon(item)) { item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); @@ -108,9 +108,9 @@ public class Loot { item.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, GetEnchantmentLevels(item.getType(),hardened)); - item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, GetEnchantmentLevels(item.getType(),hardened)); item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); - if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, GetEnchantmentLevels(item.getType(),hardened));} } else if (GenericFunctions.isArmor(item)) { item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, GetEnchantmentLevels(item.getType(),hardened)); @@ -118,13 +118,13 @@ public class Loot { if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.OXYGEN, GetEnchantmentLevels(item.getType(),hardened));} - if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("BOOTS")) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("HELMET")) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, 1);} + if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("HELMET")) {item.addUnsafeEnchantment(Enchantment.OXYGEN, 3);} + if (Math.random()<0.2*HARDENED_ENCHANT_MULT && item.getType().toString().contains("BOOTS")) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, GetEnchantmentLevels(item.getType(),hardened));} if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));} item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); - if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} + if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));} } else if (item.getType()==Material.FISHING_ROD) { item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened)); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index ba1d014..bde27f0 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; +import java.util.Random; import java.util.logging.Level; import java.util.logging.LogRecord; @@ -296,6 +297,50 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } },100); } + + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + //Control charge zombies.. + for (int i=0;i32) { + //This has to be removed... + chargezombies.remove(i); + i--; + } else { + //This is fine! Clear away blocks. + Monster m = cz.GetZombie(); + if (m.getTarget().getLocation().getY()>=m.getLocation().getY()+2 && + Math.abs(m.getTarget().getLocation().getX()-m.getLocation().getX())<1 && + Math.abs(m.getTarget().getLocation().getZ()-m.getLocation().getZ())<1) { + //This target is higher than we can reach... Let's pillar. + Random r = new Random(); + r.setSeed(m.getUniqueId().getMostSignificantBits()); + //Block type is chosen based on the seed. Will be cobblestone, dirt, or gravel. + if (m.getLocation().getBlock().getType()==Material.AIR && + m.getLocation().add(0,-1,0).getBlock().getType()!=Material.AIR && + !m.getLocation().add(0,-1,0).getBlock().isLiquid()) { + m.setVelocity(new Vector(0,0.5,0)); + switch (r.nextInt(3)) { + case 0:{ + m.getLocation().getBlock().setType(Material.DIRT); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); + }break; + case 1:{ + m.getLocation().getBlock().setType(Material.COBBLESTONE); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f); + }break; + case 2:{ + m.getLocation().getBlock().setType(Material.GRAVEL); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); + }break; + } + } + } + cz.BreakBlocksAroundArea(1); + } + } + }}, 5l, 5l); //This is the constant timing method. getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ @@ -379,19 +424,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } - //Control charge zombies.. - for (int i=0;i32) { - //This has to be removed... - chargezombies.remove(i); - i--; - } else { - //This is fine! Clear away blocks. - cz.BreakBlocksAroundArea(1); - } - } - //See if each player needs to regenerate their health. for (int i=0;i