Allow forcing adult status on randomly generated /spawnmob mobs.

This commit is contained in:
KHobbits 2014-07-06 18:25:00 +01:00
parent 2ba2ebaa43
commit 02fe58161c
2 changed files with 29 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}