diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-06-01 23:59:21 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-06-02 00:02:40 +0100 |
commit | 51f554827c08e2013c6754bc9d232bec02a777fc (patch) | |
tree | d2374b1357ffc29df1d46a3a4878062708f46390 | |
parent | d6756a26058a38c3755934536b3e923956804ada (diff) | |
download | Essentials-51f554827c08e2013c6754bc9d232bec02a777fc.tar Essentials-51f554827c08e2013c6754bc9d232bec02a777fc.tar.gz Essentials-51f554827c08e2013c6754bc9d232bec02a777fc.tar.lz Essentials-51f554827c08e2013c6754bc9d232bec02a777fc.tar.xz Essentials-51f554827c08e2013c6754bc9d232bec02a777fc.zip |
[Feature]Extend spawning mob meta to allow more customized spawning:
/spawnmob (skeleton|zombie|pigzombie):(diamond|iron|gold)armor
-rw-r--r-- | Essentials/src/com/earth2me/essentials/SpawnMob.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index 36a195212..f5b6ca5b0 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -231,6 +231,48 @@ public class SpawnMob data = data.replace("baby", ""); } + if (spawned instanceof LivingEntity) + { + //This should match all Living Entities but most mobs will just ignore the equipment. + if (data.contains("armor") || data.contains("armour")) + { + final EntityEquipment invent = ((LivingEntity)spawned).getEquipment(); + if (data.contains("diamond")) + { + invent.setBoots(new ItemStack(Material.DIAMOND_BOOTS, 1)); + invent.setLeggings(new ItemStack(Material.DIAMOND_BOOTS, 1)); + invent.setChestplate(new ItemStack(Material.DIAMOND_BOOTS, 1)); + invent.setHelmet(new ItemStack(Material.DIAMOND_BOOTS, 1)); + } + else if (data.contains("gold")) + { + invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1)); + invent.setLeggings(new ItemStack(Material.GOLD_BOOTS, 1)); + invent.setChestplate(new ItemStack(Material.GOLD_BOOTS, 1)); + invent.setHelmet(new ItemStack(Material.GOLD_BOOTS, 1)); + } + else if (data.contains("leather")) + { + invent.setBoots(new ItemStack(Material.LEATHER_BOOTS, 1)); + invent.setLeggings(new ItemStack(Material.LEATHER_BOOTS, 1)); + invent.setChestplate(new ItemStack(Material.LEATHER_BOOTS, 1)); + invent.setHelmet(new ItemStack(Material.LEATHER_BOOTS, 1)); + } + else + { + invent.setBoots(new ItemStack(Material.IRON_BOOTS, 1)); + invent.setLeggings(new ItemStack(Material.IRON_BOOTS, 1)); + invent.setChestplate(new ItemStack(Material.IRON_BOOTS, 1)); + invent.setHelmet(new ItemStack(Material.IRON_BOOTS, 1)); + } + invent.setBootsDropChance(0f); + invent.setLeggingsDropChance(0f); + invent.setChestplateDropChance(0f); + invent.setHelmetDropChance(0f); + } + + } + if (spawned instanceof Colorable) { final String color = data.toUpperCase(Locale.ENGLISH); @@ -318,6 +360,27 @@ public class SpawnMob { ((Skeleton)spawned).setSkeletonType(SkeletonType.WITHER); } + if (data.contains("sword")) + { + final EntityEquipment invent = ((LivingEntity)spawned).getEquipment(); + if (data.contains("diamond")) + { + invent.setItemInHand(new ItemStack(Material.DIAMOND_SWORD, 1)); + } + else if (data.contains("gold")) + { + invent.setItemInHand(new ItemStack(Material.GOLD_SWORD, 1)); + } + else if (data.contains("iron")) + { + invent.setItemInHand(new ItemStack(Material.IRON_SWORD, 1)); + } + else + { + invent.setItemInHand(new ItemStack(Material.STONE_SWORD, 1)); + } + invent.setItemInHandDropChance(0.1f); + } } if (type == EntityType.EXPERIENCE_ORB) |