Search in sources :

Example 1 with MyPetBaby

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) {
        ((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());
    } else if (myPet instanceof MyParrot) {
        ((Parrot) normalEntity).setVariant(Parrot.Variant.values()[((MyParrot) myPet).getVariant()]);
    }
    if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
        if (((MyPetBaby) myPet).isBaby()) {
            ((Ageable) normalEntity).setBaby();
        } else {
            ((Ageable) normalEntity).setAdult();
        }
    }
}
Also used : TagCompound(de.keyle.knbt.TagCompound) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack)

Example 2 with MyPetBaby

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());
    }
    if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
        if (((MyPetBaby) myPet).isBaby()) {
            ((Ageable) normalEntity).setBaby();
        } else {
            ((Ageable) normalEntity).setAdult();
        }
    }
}
Also used : TagCompound(de.keyle.knbt.TagCompound) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack)

Example 3 with MyPetBaby

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();
        }
    }
}
Also used : TagCompound(de.keyle.knbt.TagCompound) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack)

Example 4 with MyPetBaby

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();
        }
    }
}
Also used : TagCompound(de.keyle.knbt.TagCompound) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack)

Example 5 with MyPetBaby

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();
        }
    }
}
Also used : TagCompound(de.keyle.knbt.TagCompound) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

MyPetBaby (de.Keyle.MyPet.api.entity.MyPetBaby)10 TagCompound (de.keyle.knbt.TagCompound)9 ItemStack (org.bukkit.inventory.ItemStack)9 MaterialData (org.bukkit.material.MaterialData)9 PacketAdapter (com.comphenix.protocol.events.PacketAdapter)1 PacketContainer (com.comphenix.protocol.events.PacketContainer)1 PacketEvent (com.comphenix.protocol.events.PacketEvent)1 WrappedDataWatcher (com.comphenix.protocol.wrappers.WrappedDataWatcher)1 WrappedWatchableObject (com.comphenix.protocol.wrappers.WrappedWatchableObject)1 MyPetBukkitEntity (de.Keyle.MyPet.api.entity.MyPetBukkitEntity)1 Method (java.lang.reflect.Method)1 EnumMap (java.util.EnumMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 DyeColor (org.bukkit.DyeColor)1 Entity (org.bukkit.entity.Entity)1 Player (org.bukkit.entity.Player)1