diff options
author | KHobbits <rob@khobbits.co.uk> | 2014-07-06 18:25:00 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-07-06 18:25:00 +0100 |
commit | 58bc6116de3a3059c45b6cb8026f05e98f499698 (patch) | |
tree | 48e71ee93773154a0ef02091b0f898ff333d521f | |
parent | e05658e27a83021d474ecdd693ea58302a82575f (diff) | |
download | Essentials-58bc6116de3a3059c45b6cb8026f05e98f499698.tar Essentials-58bc6116de3a3059c45b6cb8026f05e98f499698.tar.gz Essentials-58bc6116de3a3059c45b6cb8026f05e98f499698.tar.lz Essentials-58bc6116de3a3059c45b6cb8026f05e98f499698.tar.xz Essentials-58bc6116de3a3059c45b6cb8026f05e98f499698.zip |
Allow forcing adult status on randomly generated /spawnmob mobs.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/MobData.java | 12 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/SpawnMob.java | 19 |
2 files changed, 29 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/MobData.java b/Essentials/src/com/earth2me/essentials/MobData.java index 40e23f579..790cc631b 100644 --- a/Essentials/src/com/earth2me/essentials/MobData.java +++ b/Essentials/src/com/earth2me/essentials/MobData.java @@ -30,6 +30,7 @@ import org.bukkit.material.Colorable; public enum MobData { BABY_AGEABLE("baby", Ageable.class, Data.BABY, true), + ADULT_AGEABLE("adult", Ageable.class, Data.ADULT, true), BABY_PIG("piglet", EntityType.PIG, Data.BABY, false), BABY_WOLF("puppy", EntityType.WOLF, Data.BABY, false), BABY_CHICKEN("chick", EntityType.CHICKEN, Data.BABY, false), @@ -83,6 +84,7 @@ public enum MobData TUXEDO_CAT("tuxedo", EntityType.OCELOT, Ocelot.Type.BLACK_CAT, false), VILLAGER_ZOMBIE("villager", EntityType.ZOMBIE.getEntityClass(), Data.VILLAGER, true), BABY_ZOMBIE("baby", EntityType.ZOMBIE.getEntityClass(), Data.BABYZOMBIE, true), + ADULT_ZOMBIE("adult", EntityType.ZOMBIE.getEntityClass(), Data.ADULTZOMBIE, true), DIAMOND_SWORD_ZOMBIE("diamondsword", EntityType.ZOMBIE.getEntityClass(), Material.DIAMOND_SWORD, true), GOLD_SWORD_ZOMBIE("goldsword", EntityType.ZOMBIE.getEntityClass(), Material.GOLD_SWORD, true), IRON_SWORD_ZOMBIE("ironsword", EntityType.ZOMBIE.getEntityClass(), Material.IRON_SWORD, true), @@ -113,8 +115,10 @@ public enum MobData public enum Data { + ADULT, BABY, CHEST, + ADULTZOMBIE, BABYZOMBIE, VILLAGER, HORSESADDLE, @@ -214,10 +218,18 @@ public enum MobData { ((Wolf)spawned).setAngry(true); } + else if (this.value.equals(Data.ADULT)) + { + ((Ageable)spawned).setAdult(); + } else if (this.value.equals(Data.BABY)) { ((Ageable)spawned).setBaby(); } + else if (this.value.equals(Data.ADULTZOMBIE)) + { + ((Zombie)spawned).setBaby(false); + } else if (this.value.equals(Data.BABYZOMBIE)) { ((Zombie)spawned).setBaby(true); diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index edf9b4fc5..a191528dd 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -216,6 +216,15 @@ public class SpawnMob { sender.sendMessage(tl("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned)))); } + + if (spawned instanceof Zombie) + { + ((Zombie)spawned).setBaby(false); + } + else if(spawned instanceof Ageable) + { + ((Ageable)spawned).setAdult(); + } if (spawned instanceof Zombie || type == EntityType.SKELETON) { @@ -285,7 +294,10 @@ public class SpawnMob if (type == EntityType.PIG_ZOMBIE) { - final EntityEquipment invent = ((LivingEntity)spawned).getEquipment(); + final PigZombie zombie = ((PigZombie)spawned); + zombie.setVillager(false); + + final EntityEquipment invent = zombie.getEquipment(); invent.setItemInHand(new ItemStack(Material.GOLD_SWORD, 1)); invent.setItemInHandDropChance(0.1f); @@ -295,7 +307,10 @@ public class SpawnMob if (type == EntityType.ZOMBIE) { - final EntityEquipment invent = ((LivingEntity)spawned).getEquipment(); + final Zombie zombie = ((Zombie)spawned); + zombie.setVillager(false); + + final EntityEquipment invent = zombie.getEquipment(); invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1)); invent.setBootsDropChance(0.0f); } |