use of de.Keyle.MyPet.api.entity.MyPetBaby in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEntity.
@Override
public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
if (myPet instanceof MyCreeper) {
if (((MyCreeper) myPet).isPowered()) {
((Creeper) normalEntity).setPowered(true);
}
} else if (myPet instanceof MyEnderman) {
if (((MyEnderman) myPet).hasBlock()) {
MaterialData materialData = new MaterialData(((MyEnderman) myPet).getBlock().getType(), ((MyEnderman) myPet).getBlock().getData().getData());
((Enderman) normalEntity).setCarriedMaterial(materialData);
}
} else if (myPet instanceof MyIronGolem) {
((IronGolem) normalEntity).setPlayerCreated(true);
} else if (myPet instanceof MyMagmaCube) {
((MagmaCube) normalEntity).setSize(((MyMagmaCube) myPet).getSize());
} else if (myPet instanceof MyOcelot) {
((Ocelot) normalEntity).setCatType(Ocelot.Type.WILD_OCELOT);
((Ocelot) normalEntity).setTamed(false);
} else if (myPet instanceof MyPig) {
((Pig) normalEntity).setSaddle(((MyPig) myPet).hasSaddle());
} else if (myPet instanceof MySheep) {
((Sheep) normalEntity).setSheared(((MySheep) myPet).isSheared());
((Sheep) normalEntity).setColor(((MySheep) myPet).getColor());
} else if (myPet instanceof MyVillager) {
MyVillager villagerPet = (MyVillager) myPet;
Villager.Profession profession = Villager.Profession.values()[villagerPet.getProfession() + 1];
((Villager) normalEntity).setProfession(profession);
if (villagerPet.hasOriginalData()) {
TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(normalEntity);
for (String key : villagerPet.getOriginalData().getCompoundData().keySet()) {
villagerTag.put(key, villagerPet.getOriginalData().get(key));
}
MyPetApi.getPlatformHelper().applyTagToEntity(villagerTag, normalEntity);
}
} else if (myPet instanceof MyWolf) {
((Wolf) normalEntity).setTamed(false);
} else if (myPet instanceof MySlime) {
((Slime) normalEntity).setSize(((MySlime) myPet).getSize());
} else if (myPet instanceof MyZombie) {
switch(((MyZombie) myPet).getZombieType()) {
case HUSK:
((Zombie) normalEntity).setVillagerProfession(Villager.Profession.HUSK);
break;
case VILLAGER:
Villager.Profession profession = Villager.Profession.values()[((MyZombie) myPet).getProfession() + 1];
((Zombie) normalEntity).setVillagerProfession(profession);
break;
}
} else if (myPet instanceof MySkeleton) {
((Skeleton) normalEntity).setSkeletonType(Skeleton.SkeletonType.values()[((MySkeleton) myPet).getType()]);
if (((MySkeleton) myPet).isWither()) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.STONE_SWORD));
} else {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
} else if (myPet instanceof MyPigZombie) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD));
} else if (myPet instanceof MyHorse) {
Horse.Style style = Horse.Style.values()[(((MyHorse) myPet).getVariant() >>> 8)];
Horse.Color color = Horse.Color.values()[(((MyHorse) myPet).getVariant() & 0xFF)];
((Horse) normalEntity).setColor(color);
((Horse) normalEntity).setStyle(style);
if (((MyHorse) myPet).hasSaddle()) {
((Horse) normalEntity).getInventory().setSaddle(((MyHorse) myPet).getSaddle().clone());
}
if (((MyHorse) myPet).hasArmor()) {
((Horse) normalEntity).getInventory().setArmor(((MyHorse) myPet).getArmor().clone());
}
((Horse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyRabbit) {
((Rabbit) normalEntity).setRabbitType(((MyRabbit) myPet).getVariant().getBukkitType());
}
if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
if (((MyPetBaby) myPet).isBaby()) {
((Ageable) normalEntity).setBaby();
} else {
((Ageable) normalEntity).setAdult();
}
}
}
use of de.Keyle.MyPet.api.entity.MyPetBaby in project MyPet by xXKeyleXx.
the class ProtocolLibHook method registerCompatFix_1_8.
private static void registerCompatFix_1_8() {
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(MyPetApi.getPlugin(), ListenerPriority.HIGHEST, PacketType.Play.Server.SPAWN_ENTITY_LIVING, PacketType.Play.Server.ENTITY_METADATA) {
Class entityClass = ReflectionUtil.getClass("org.bukkit.craftbukkit." + MyPetApi.getCompatUtil().getInternalVersion() + ".entity.CraftEntity");
Method getHandleMethod = ReflectionUtil.getMethod(entityClass, "getHandle");
private final EnumMap<DyeColor, Integer> convertedDyeColors = new EnumMap<DyeColor, Integer>(DyeColor.class) {
{
put(DyeColor.WHITE, 15);
put(DyeColor.ORANGE, 14);
put(DyeColor.MAGENTA, 13);
put(DyeColor.LIGHT_BLUE, 12);
put(DyeColor.YELLOW, 11);
put(DyeColor.LIME, 10);
put(DyeColor.PINK, 9);
put(DyeColor.GRAY, 8);
put(DyeColor.SILVER, 7);
put(DyeColor.CYAN, 6);
put(DyeColor.PURPLE, 5);
put(DyeColor.BLUE, 4);
put(DyeColor.BROWN, 3);
put(DyeColor.GREEN, 2);
put(DyeColor.RED, 1);
put(DyeColor.BLACK, 0);
}
};
@Override
public void onPacketSending(PacketEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
if (!isPlayerRunningv1_8(player)) {
return;
}
PacketContainer newPacketContainer = event.getPacket().deepClone();
event.setPacket(newPacketContainer);
if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY_LIVING) {
Entity entity = newPacketContainer.getEntityModifier(event).readSafely(0);
if (entity != null && entity instanceof MyPetBukkitEntity) {
MyPetBukkitEntity petEntity = (MyPetBukkitEntity) entity;
List<WrappedWatchableObject> wrappedWatchableObjectList = newPacketContainer.getDataWatcherModifier().read(0).getWatchableObjects();
newPacketContainer.getDataWatcherModifier().write(0, new WrappedDataWatcher(fixMetadata(petEntity, wrappedWatchableObjectList)));
}
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
Entity entity = newPacketContainer.getEntityModifier(event).read(0);
if (entity != null && entity instanceof MyPetBukkitEntity) {
MyPetBukkitEntity petEntity = (MyPetBukkitEntity) entity;
List<WrappedWatchableObject> wrappedWatchableObjectList = newPacketContainer.getWatchableCollectionModifier().read(0);
newPacketContainer.getWatchableCollectionModifier().write(0, fixMetadata(petEntity, wrappedWatchableObjectList));
}
}
}
private List<WrappedWatchableObject> fixMetadata(MyPetBukkitEntity petEntity, List<WrappedWatchableObject> wrappedWatchableObjectList) {
if (petEntity == null || wrappedWatchableObjectList == null) {
return wrappedWatchableObjectList;
}
if (petEntity.getMyPet() instanceof MyPetBaby && hasKey(12, wrappedWatchableObjectList)) {
Object object = getKeyValue(12, wrappedWatchableObjectList);
if (object instanceof Integer) {
int value = ((Number) object).intValue();
removeKey(12, wrappedWatchableObjectList);
if (petEntity.getPetType() == MyPetType.Horse) {
if (value == -24000) {
value = -1;
}
}
wrappedWatchableObjectList.add(new WrappedWatchableObject(12, (byte) value));
}
}
if (petEntity.getPetType() == MyPetType.Wolf && hasKey(20, wrappedWatchableObjectList)) {
Object object = getKeyValue(20, wrappedWatchableObjectList);
if (object instanceof Byte) {
DyeColor color = DyeColor.getByWoolData((byte) ((Byte) object & 0xF));
removeKey(20, wrappedWatchableObjectList);
wrappedWatchableObjectList.add(new WrappedWatchableObject(20, (byte) ((this.convertedDyeColors.get(color)) & 0xF)));
}
}
if (petEntity.getPetType() == MyPetType.Enderman && hasKey(16, wrappedWatchableObjectList)) {
Object object = getKeyValue(16, wrappedWatchableObjectList);
if (object instanceof Byte) {
removeKey(16, wrappedWatchableObjectList);
wrappedWatchableObjectList.add(new WrappedWatchableObject(16, Short.valueOf((Byte) object)));
}
}
return wrappedWatchableObjectList;
}
private boolean hasKey(int key, List<WrappedWatchableObject> wrappedWatchableObjectList) {
for (WrappedWatchableObject next : wrappedWatchableObjectList) {
if (next.getIndex() == key) {
return true;
}
}
return false;
}
private Object getKeyValue(int key, List<WrappedWatchableObject> wrappedWatchableObjectList) {
for (WrappedWatchableObject next : wrappedWatchableObjectList) {
if (next.getIndex() == key) {
return next.getValue();
}
}
return null;
}
private void removeKey(int key, List<WrappedWatchableObject> wrappedWatchableObjectList) {
for (Iterator<WrappedWatchableObject> wrappedWatchableObjectIterator = wrappedWatchableObjectList.iterator(); wrappedWatchableObjectIterator.hasNext(); ) {
WrappedWatchableObject next = wrappedWatchableObjectIterator.next();
if (next.getIndex() == key) {
wrappedWatchableObjectIterator.remove();
break;
}
}
}
@SuppressWarnings("unchecked")
private boolean isPlayerRunningv1_8(Player player) {
try {
Object nmsPlayer = getHandleMethod.invoke(player);
Object playerConnection = ReflectionUtil.getFieldValue(nmsPlayer.getClass(), nmsPlayer, "playerConnection");
Object networkManager = ReflectionUtil.getFieldValue(playerConnection.getClass(), playerConnection, "networkManager");
Method getVersionMethod = ReflectionUtil.getMethod(networkManager.getClass(), "getVersion");
return (Integer) getVersionMethod.invoke(networkManager) > 5;
} catch (Exception exception) {
return false;
}
}
});
}
use of de.Keyle.MyPet.api.entity.MyPetBaby in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEntity.
public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
if (myPet instanceof MyCreeper) {
if (((MyCreeper) myPet).isPowered()) {
((Creeper) normalEntity).setPowered(true);
}
} else if (myPet instanceof MyEnderman) {
if (((MyEnderman) myPet).hasBlock()) {
MaterialData materialData = new MaterialData(((MyEnderman) myPet).getBlock().getType(), ((MyEnderman) myPet).getBlock().getData().getData());
((Enderman) normalEntity).setCarriedMaterial(materialData);
}
} else if (myPet instanceof MyIronGolem) {
((IronGolem) normalEntity).setPlayerCreated(true);
} else if (myPet instanceof MyMagmaCube) {
((MagmaCube) normalEntity).setSize(((MyMagmaCube) myPet).getSize());
} else if (myPet instanceof MyOcelot) {
((Ocelot) normalEntity).setCatType(Ocelot.Type.WILD_OCELOT);
((Ocelot) normalEntity).setTamed(false);
} else if (myPet instanceof MyPig) {
((Pig) normalEntity).setSaddle(((MyPig) myPet).hasSaddle());
} else if (myPet instanceof MySheep) {
((Sheep) normalEntity).setSheared(((MySheep) myPet).isSheared());
((Sheep) normalEntity).setColor(((MySheep) myPet).getColor());
} else if (myPet instanceof MyVillager) {
MyVillager villagerPet = (MyVillager) myPet;
Villager.Profession profession;
profession = Villager.Profession.values()[villagerPet.getProfession() + 1];
((Villager) normalEntity).setProfession(profession);
if (villagerPet.hasOriginalData()) {
TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(normalEntity);
for (String key : villagerPet.getOriginalData().getCompoundData().keySet()) {
villagerTag.put(key, villagerPet.getOriginalData().get(key));
}
MyPetApi.getPlatformHelper().applyTagToEntity(villagerTag, normalEntity);
}
} else if (myPet instanceof MyWolf) {
((Wolf) normalEntity).setTamed(false);
} else if (myPet instanceof MySlime) {
((Slime) normalEntity).setSize(((MySlime) myPet).getSize());
} else if (myPet instanceof MyZombieVillager) {
Villager.Profession profession = Villager.Profession.values()[((MyZombieVillager) myPet).getProfession()];
((ZombieVillager) normalEntity).setVillagerProfession(profession);
} else if (myPet instanceof MyWitherSkeleton) {
normalEntity.getEquipment().setItemInMainHand(new ItemStack(Material.STONE_SWORD));
} else if (myPet instanceof MySkeleton) {
normalEntity.getEquipment().setItemInMainHand(new ItemStack(Material.BOW));
} else if (myPet instanceof MyPigZombie) {
normalEntity.getEquipment().setItemInMainHand(new ItemStack(Material.GOLD_SWORD));
} else if (myPet instanceof MyHorse) {
Horse.Style style = Horse.Style.values()[(((MyHorse) myPet).getVariant() >>> 8)];
Horse.Color color = Horse.Color.values()[(((MyHorse) myPet).getVariant() & 0xFF)];
((Horse) normalEntity).setColor(color);
((Horse) normalEntity).setStyle(style);
if (((MyHorse) myPet).hasSaddle()) {
((Horse) normalEntity).getInventory().setSaddle(((MyHorse) myPet).getSaddle().clone());
}
if (((MyHorse) myPet).hasArmor()) {
((Horse) normalEntity).getInventory().setArmor(((MyHorse) myPet).getArmor().clone());
}
((Horse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MySkeletonHorse) {
((SkeletonHorse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyZombieHorse) {
if (((MyZombieHorse) myPet).isBaby()) {
((ZombieHorse) normalEntity).setBaby();
}
((ZombieHorse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyLlama) {
((Llama) normalEntity).setColor(Llama.Color.values()[Math.max(0, Math.min(3, ((MyLlama) myPet).getVariant()))]);
((Llama) normalEntity).setCarryingChest(((MyLlama) myPet).hasChest());
if (((MyLlama) myPet).hasDecor()) {
((Llama) normalEntity).getInventory().setDecor(((MyLlama) myPet).getDecor());
}
((Llama) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyRabbit) {
((Rabbit) normalEntity).setRabbitType(((MyRabbit) myPet).getVariant().getBukkitType());
}
if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
if (((MyPetBaby) myPet).isBaby()) {
((Ageable) normalEntity).setBaby();
} else {
((Ageable) normalEntity).setAdult();
}
}
}
use of de.Keyle.MyPet.api.entity.MyPetBaby in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEntity.
@Override
public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
if (myPet instanceof MyCreeper) {
if (((MyCreeper) myPet).isPowered()) {
((Creeper) normalEntity).setPowered(true);
}
} else if (myPet instanceof MyEnderman) {
if (((MyEnderman) myPet).hasBlock()) {
MaterialData materialData = new MaterialData(((MyEnderman) myPet).getBlock().getType(), ((MyEnderman) myPet).getBlock().getData().getData());
((Enderman) normalEntity).setCarriedMaterial(materialData);
}
} else if (myPet instanceof MyIronGolem) {
((IronGolem) normalEntity).setPlayerCreated(true);
} else if (myPet instanceof MyMagmaCube) {
((MagmaCube) normalEntity).setSize(((MyMagmaCube) myPet).getSize());
} else if (myPet instanceof MyOcelot) {
((Ocelot) normalEntity).setCatType(Ocelot.Type.WILD_OCELOT);
((Ocelot) normalEntity).setTamed(false);
} else if (myPet instanceof MyPig) {
((Pig) normalEntity).setSaddle(((MyPig) myPet).hasSaddle());
} else if (myPet instanceof MySheep) {
((Sheep) normalEntity).setSheared(((MySheep) myPet).isSheared());
((Sheep) normalEntity).setColor(((MySheep) myPet).getColor());
} else if (myPet instanceof MyVillager) {
MyVillager villagerPet = (MyVillager) myPet;
Villager.Profession profession = Villager.Profession.values()[villagerPet.getProfession()];
((Villager) normalEntity).setProfession(profession);
if (villagerPet.hasOriginalData()) {
TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(normalEntity);
for (String key : villagerPet.getOriginalData().getCompoundData().keySet()) {
villagerTag.put(key, villagerPet.getOriginalData().get(key));
}
MyPetApi.getPlatformHelper().applyTagToEntity(villagerTag, normalEntity);
}
} else if (myPet instanceof MyWolf) {
((Wolf) normalEntity).setTamed(false);
} else if (myPet instanceof MySlime) {
((Slime) normalEntity).setSize(((MySlime) myPet).getSize());
} else if (myPet instanceof MyZombie) {
((Zombie) normalEntity).setVillager(((MyZombie) myPet).isVillager());
} else if (myPet instanceof MySkeleton) {
((Skeleton) normalEntity).setSkeletonType(Skeleton.SkeletonType.values()[((MySkeleton) myPet).getType()]);
if (((MySkeleton) myPet).isWither()) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.STONE_SWORD));
} else {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
} else if (myPet instanceof MyPigZombie) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD));
} else if (myPet instanceof MyHorse) {
Horse.Variant type = Horse.Variant.values()[((MyHorse) myPet).getHorseType()];
Horse.Style style = Horse.Style.values()[(((MyHorse) myPet).getVariant() >>> 8)];
Horse.Color color = Horse.Color.values()[(((MyHorse) myPet).getVariant() & 0xFF)];
((Horse) normalEntity).setVariant(type);
((Horse) normalEntity).setColor(color);
((Horse) normalEntity).setStyle(style);
((Horse) normalEntity).setCarryingChest(((MyHorse) myPet).hasChest());
if (((MyHorse) myPet).hasSaddle()) {
((Horse) normalEntity).getInventory().setSaddle(((MyHorse) myPet).getSaddle().clone());
}
if (((MyHorse) myPet).hasArmor()) {
((Horse) normalEntity).getInventory().setArmor(((MyHorse) myPet).getArmor().clone());
}
((Horse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyRabbit) {
((Rabbit) normalEntity).setRabbitType(((MyRabbit) myPet).getVariant().getBukkitType());
} else if (myPet instanceof MyGuardian) {
((Guardian) normalEntity).setElder(((MyGuardian) myPet).isElder());
}
if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
if (((MyPetBaby) myPet).isBaby()) {
((Ageable) normalEntity).setBaby();
} else {
((Ageable) normalEntity).setAdult();
}
}
}
use of de.Keyle.MyPet.api.entity.MyPetBaby in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEntity.
@Override
public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
if (myPet instanceof MyCreeper) {
if (((MyCreeper) myPet).isPowered()) {
((Creeper) normalEntity).setPowered(true);
}
} else if (myPet instanceof MyEnderman) {
if (((MyEnderman) myPet).hasBlock()) {
MaterialData materialData = new MaterialData(((MyEnderman) myPet).getBlock().getType(), ((MyEnderman) myPet).getBlock().getData().getData());
((Enderman) normalEntity).setCarriedMaterial(materialData);
}
} else if (myPet instanceof MyIronGolem) {
((IronGolem) normalEntity).setPlayerCreated(true);
} else if (myPet instanceof MyMagmaCube) {
((MagmaCube) normalEntity).setSize(((MyMagmaCube) myPet).getSize());
} else if (myPet instanceof MyOcelot) {
((Ocelot) normalEntity).setCatType(Ocelot.Type.WILD_OCELOT);
((Ocelot) normalEntity).setTamed(false);
} else if (myPet instanceof MyPig) {
((Pig) normalEntity).setSaddle(((MyPig) myPet).hasSaddle());
} else if (myPet instanceof MySheep) {
((Sheep) normalEntity).setSheared(((MySheep) myPet).isSheared());
((Sheep) normalEntity).setColor(((MySheep) myPet).getColor());
} else if (myPet instanceof MyVillager) {
MyVillager villagerPet = (MyVillager) myPet;
Villager.Profession profession = Villager.Profession.values()[villagerPet.getProfession()];
((Villager) normalEntity).setProfession(profession);
if (villagerPet.hasOriginalData()) {
TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(normalEntity);
for (String key : villagerPet.getOriginalData().getCompoundData().keySet()) {
villagerTag.put(key, villagerPet.getOriginalData().get(key));
}
MyPetApi.getPlatformHelper().applyTagToEntity(villagerTag, normalEntity);
}
} else if (myPet instanceof MyWolf) {
((Wolf) normalEntity).setTamed(false);
} else if (myPet instanceof MySlime) {
((Slime) normalEntity).setSize(((MySlime) myPet).getSize());
} else if (myPet instanceof MyZombie) {
if (((MyZombie) myPet).isVillager()) {
Villager.Profession profession = Villager.Profession.values()[((MyZombie) myPet).getProfession()];
((Zombie) normalEntity).setVillagerProfession(profession);
}
} else if (myPet instanceof MySkeleton) {
((Skeleton) normalEntity).setSkeletonType(Skeleton.SkeletonType.values()[((MySkeleton) myPet).getType()]);
if (((MySkeleton) myPet).isWither()) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.STONE_SWORD));
} else {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
} else if (myPet instanceof MyPigZombie) {
normalEntity.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD));
} else if (myPet instanceof MyHorse) {
Horse.Variant type = Horse.Variant.values()[((MyHorse) myPet).getHorseType()];
Horse.Style style = Horse.Style.values()[(((MyHorse) myPet).getVariant() >>> 8)];
Horse.Color color = Horse.Color.values()[(((MyHorse) myPet).getVariant() & 0xFF)];
((Horse) normalEntity).setVariant(type);
((Horse) normalEntity).setColor(color);
((Horse) normalEntity).setStyle(style);
((Horse) normalEntity).setCarryingChest(((MyHorse) myPet).hasChest());
if (((MyHorse) myPet).hasSaddle()) {
((Horse) normalEntity).getInventory().setSaddle(((MyHorse) myPet).getSaddle().clone());
}
if (((MyHorse) myPet).hasArmor()) {
((Horse) normalEntity).getInventory().setArmor(((MyHorse) myPet).getArmor().clone());
}
((Horse) normalEntity).setOwner(myPet.getOwner().getPlayer());
} else if (myPet instanceof MyRabbit) {
((Rabbit) normalEntity).setRabbitType(((MyRabbit) myPet).getVariant().getBukkitType());
} else if (myPet instanceof MyGuardian) {
((Guardian) normalEntity).setElder(((MyGuardian) myPet).isElder());
}
if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
if (((MyPetBaby) myPet).isBaby()) {
((Ageable) normalEntity).setBaby();
} else {
((Ageable) normalEntity).setAdult();
}
}
}
Aggregations