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,7 +42,27 @@ 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) {
Animals animal = (Animals)clone;
Animals parentAnimal = (Animals)parent;
animal.setMaxHealth(parentAnimal.getMaxHealth());
animal.setHealth(parentAnimal.getMaxHealth());
animal.setRemainingAir(parentAnimal.getRemainingAir());
animal.setMaximumAir(parentAnimal.getMaximumAir());
animal.setMaximumNoDamageTicks(parentAnimal.getMaximumNoDamageTicks());
animal.setLastDamage(parentAnimal.getLastDamage());
animal.setNoDamageTicks(parentAnimal.getNoDamageTicks());
animal.addPotionEffects(parentAnimal.getActivePotionEffects());
animal.setRemoveWhenFarAway(parentAnimal.getRemoveWhenFarAway());
animal.setCanPickupItems(parentAnimal.getCanPickupItems());
animal.setCustomName(parentAnimal.getCustomName());
animal.setCustomNameVisible(parentAnimal.isCustomNameVisible());
animal.setTarget(parentAnimal.getTarget());
animal.setAge(parentAnimal.getAge());
animal.setAgeLock(parentAnimal.getAgeLock());
if (clone instanceof Horse) {
Horse horse = (Horse)clone; Horse horse = (Horse)clone;
Horse parentHorse = (Horse)parent; Horse parentHorse = (Horse)parent;
@ -58,21 +78,6 @@ public class VehicleCloner
horse.setStyle(parentHorse.getStyle()); horse.setStyle(parentHorse.getStyle());
horse.setColor(parentHorse.getColor()); horse.setColor(parentHorse.getColor());
horse.setVariant(parentHorse.getVariant()); horse.setVariant(parentHorse.getVariant());
horse.setMaxHealth(parentHorse.getMaxHealth());
horse.setHealth(parentHorse.getMaxHealth());
horse.setRemainingAir(parentHorse.getRemainingAir());
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 (parentHorse.isAdult()) {
horse.setAdult(); horse.setAdult();
@ -83,6 +88,13 @@ public class VehicleCloner
horse.setBreed(parentHorse.canBreed()); horse.setBreed(parentHorse.canBreed());
} }
else if (clone instanceof Pig) {
Pig pig = (Pig)clone;
Pig parentPig = (Pig)parent;
pig.setSaddle(parentPig.hasSaddle());
}
}
else if (clone instanceof Minecart) { else if (clone instanceof Minecart) {
Minecart minecart = (Minecart)clone; Minecart minecart = (Minecart)clone;
Minecart parentMinecart = (Minecart)parent; Minecart parentMinecart = (Minecart)parent;
@ -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;
} }