Search in sources :

Example 41 with TagInt

use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.

the class EntityConverterService method convertEquipable.

public void convertEquipable(LivingEntity entity, TagCompound properties) {
    List<TagCompound> equipmentList = new ArrayList<>();
    if (random.nextFloat() <= entity.getEquipment().getChestplateDropChance()) {
        ItemStack itemStack = entity.getEquipment().getChestplate();
        if (itemStack != null && itemStack.getType() != Material.AIR) {
            TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
            item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Chestplate.getSlotId()));
            equipmentList.add(item);
        }
    }
    if (random.nextFloat() <= entity.getEquipment().getHelmetDropChance()) {
        ItemStack itemStack = entity.getEquipment().getHelmet();
        if (itemStack != null && itemStack.getType() != Material.AIR) {
            TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
            item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Helmet.getSlotId()));
            equipmentList.add(item);
        }
    }
    if (random.nextFloat() <= entity.getEquipment().getLeggingsDropChance()) {
        ItemStack itemStack = entity.getEquipment().getLeggings();
        if (itemStack != null && itemStack.getType() != Material.AIR) {
            TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
            item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Leggins.getSlotId()));
            equipmentList.add(item);
        }
    }
    if (random.nextFloat() <= entity.getEquipment().getBootsDropChance()) {
        ItemStack itemStack = entity.getEquipment().getBoots();
        if (itemStack != null && itemStack.getType() != Material.AIR) {
            TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
            item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Boots.getSlotId()));
            equipmentList.add(item);
        }
    }
    properties.getCompoundData().put("Equipment", new TagList(equipmentList));
}
Also used : ArrayList(java.util.ArrayList) TagInt(de.keyle.knbt.TagInt) TagList(de.keyle.knbt.TagList) ItemStack(org.bukkit.inventory.ItemStack) TagCompound(de.keyle.knbt.TagCompound)

Example 42 with TagInt

use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.

the class EntityConverterService method convertSheep.

public void convertSheep(Sheep sheep, TagCompound properties) {
    properties.getCompoundData().put("Color", new TagInt(sheep.getColor().getDyeData()));
    properties.getCompoundData().put("Sheared", new TagByte(sheep.isSheared()));
}
Also used : TagInt(de.keyle.knbt.TagInt) TagByte(de.keyle.knbt.TagByte)

Example 43 with TagInt

use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.

the class EntityConverterService method convertPanda.

public void convertPanda(Panda panda, TagCompound properties) {
    properties.getCompoundData().put("MainGene", new TagInt(panda.getMainGene().ordinal()));
    properties.getCompoundData().put("HiddenGene", new TagInt(panda.getHiddenGene().ordinal()));
}
Also used : TagInt(de.keyle.knbt.TagInt)

Example 44 with TagInt

use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.

the class EntityConverterService method convertSheep.

public void convertSheep(Sheep sheep, TagCompound properties) {
    properties.getCompoundData().put("Color", new TagInt(sheep.getColor().getDyeData()));
    properties.getCompoundData().put("Sheared", new TagByte(sheep.isSheared()));
}
Also used : TagInt(de.keyle.knbt.TagInt) TagByte(de.keyle.knbt.TagByte)

Example 45 with TagInt

use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.

the class EntityConverterService method convertTropicalFish.

public void convertTropicalFish(TropicalFish tropicalFish, TagCompound properties) {
    CraftTropicalFish fish = (CraftTropicalFish) tropicalFish;
    properties.getCompoundData().put("Variant", new TagInt(fish.getHandle().getVariant()));
}
Also used : TagInt(de.keyle.knbt.TagInt) CraftTropicalFish(org.bukkit.craftbukkit.v1_18_R1.entity.CraftTropicalFish)

Aggregations

TagInt (de.keyle.knbt.TagInt)98 TagCompound (de.keyle.knbt.TagCompound)57 TagByte (de.keyle.knbt.TagByte)43 ItemStack (org.bukkit.inventory.ItemStack)24 TagList (de.keyle.knbt.TagList)16 TagString (de.keyle.knbt.TagString)13 ArrayList (java.util.ArrayList)10 HashSet (java.util.HashSet)7 TagDouble (de.keyle.knbt.TagDouble)6 EquipmentSlot (de.Keyle.MyPet.api.entity.EquipmentSlot)3 TagByteArray (de.keyle.knbt.TagByteArray)2 TagFloat (de.keyle.knbt.TagFloat)2 TagIntArray (de.keyle.knbt.TagIntArray)2 TagLong (de.keyle.knbt.TagLong)2 TagShort (de.keyle.knbt.TagShort)2 List (java.util.List)2 ByteArrayTag (net.minecraft.nbt.ByteArrayTag)2 ByteTag (net.minecraft.nbt.ByteTag)2 CompoundTag (net.minecraft.nbt.CompoundTag)2 DoubleTag (net.minecraft.nbt.DoubleTag)2