Fix for missing clone of pig attributes.

This commit is contained in:
Tobias Ottenweller 2013-12-29 09:50:45 +01:00
parent 29592823b6
commit 0c13d0d3e3

View File

@ -42,46 +42,58 @@ public class VehicleCloner
boat.setWorkOnLand(parentBoat.getWorkOnLand()); boat.setWorkOnLand(parentBoat.getWorkOnLand());
boat.setVelocity(parentBoat.getVelocity()); boat.setVelocity(parentBoat.getVelocity());
} }
else if (clone instanceof Horse) { else if (clone instanceof Animals) {
Horse horse = (Horse)clone; Animals animal = (Animals)clone;
Horse parentHorse = (Horse)parent; Animals parentAnimal = (Animals)parent;
horse.getInventory().setArmor(parentHorse.getInventory().getArmor()); animal.setMaxHealth(parentAnimal.getMaxHealth());
horse.getInventory().setSaddle(parentHorse.getInventory().getSaddle()); animal.setHealth(parentAnimal.getMaxHealth());
horse.setCarryingChest(parentHorse.isCarryingChest()); animal.setRemainingAir(parentAnimal.getRemainingAir());
horse.getInventory().setContents(parentHorse.getInventory().getContents()); animal.setMaximumAir(parentAnimal.getMaximumAir());
horse.setTamed(parentHorse.isTamed()); animal.setMaximumNoDamageTicks(parentAnimal.getMaximumNoDamageTicks());
horse.setOwner(parentHorse.getOwner()); animal.setLastDamage(parentAnimal.getLastDamage());
horse.setJumpStrength(parentHorse.getJumpStrength()); animal.setNoDamageTicks(parentAnimal.getNoDamageTicks());
horse.setMaxDomestication(parentHorse.getMaxDomestication()); animal.addPotionEffects(parentAnimal.getActivePotionEffects());
horse.setDomestication(parentHorse.getDomestication()); animal.setRemoveWhenFarAway(parentAnimal.getRemoveWhenFarAway());
horse.setStyle(parentHorse.getStyle()); animal.setCanPickupItems(parentAnimal.getCanPickupItems());
horse.setColor(parentHorse.getColor()); animal.setCustomName(parentAnimal.getCustomName());
horse.setVariant(parentHorse.getVariant()); animal.setCustomNameVisible(parentAnimal.isCustomNameVisible());
horse.setMaxHealth(parentHorse.getMaxHealth()); animal.setTarget(parentAnimal.getTarget());
horse.setHealth(parentHorse.getMaxHealth()); animal.setAge(parentAnimal.getAge());
horse.setRemainingAir(parentHorse.getRemainingAir()); animal.setAgeLock(parentAnimal.getAgeLock());
horse.setMaximumAir(parentHorse.getMaximumAir());
horse.setMaximumNoDamageTicks(parentHorse.getMaximumNoDamageTicks());
horse.setLastDamage(parentHorse.getLastDamage());
horse.setNoDamageTicks(parentHorse.getNoDamageTicks());
horse.addPotionEffects(parentHorse.getActivePotionEffects());
horse.setRemoveWhenFarAway(parentHorse.getRemoveWhenFarAway());
horse.setCanPickupItems(parentHorse.getCanPickupItems());
horse.setCustomName(parentHorse.getCustomName());
horse.setCustomNameVisible(parentHorse.isCustomNameVisible());
horse.setTarget(parentHorse.getTarget());
horse.setAge(parentHorse.getAge());
horse.setAgeLock(parentHorse.getAgeLock());
if (parentHorse.isAdult()) { if (clone instanceof Horse) {
horse.setAdult(); Horse horse = (Horse)clone;
} Horse parentHorse = (Horse)parent;
else {
horse.setBaby(); horse.getInventory().setArmor(parentHorse.getInventory().getArmor());
horse.getInventory().setSaddle(parentHorse.getInventory().getSaddle());
horse.setCarryingChest(parentHorse.isCarryingChest());
horse.getInventory().setContents(parentHorse.getInventory().getContents());
horse.setTamed(parentHorse.isTamed());
horse.setOwner(parentHorse.getOwner());
horse.setJumpStrength(parentHorse.getJumpStrength());
horse.setMaxDomestication(parentHorse.getMaxDomestication());
horse.setDomestication(parentHorse.getDomestication());
horse.setStyle(parentHorse.getStyle());
horse.setColor(parentHorse.getColor());
horse.setVariant(parentHorse.getVariant());
if (parentHorse.isAdult()) {
horse.setAdult();
}
else {
horse.setBaby();
}
horse.setBreed(parentHorse.canBreed());
} }
else if (clone instanceof Pig) {
Pig pig = (Pig)clone;
Pig parentPig = (Pig)parent;
horse.setBreed(parentHorse.canBreed()); pig.setSaddle(parentPig.hasSaddle());
}
} }
else if (clone instanceof Minecart) { else if (clone instanceof Minecart) {
Minecart minecart = (Minecart)clone; Minecart minecart = (Minecart)clone;
@ -94,12 +106,6 @@ public class VehicleCloner
minecart.setDamage(parentMinecart.getDamage()); minecart.setDamage(parentMinecart.getDamage());
minecart.setVelocity(parentMinecart.getVelocity()); minecart.setVelocity(parentMinecart.getVelocity());
} }
else if (clone instanceof Pig) {
Pig pig = (Pig)clone;
Pig parentPig = (Pig)parent;
pig.setSaddle(parentPig.hasSaddle());
}
return clone; return clone;
} }