Search in sources :

Example 31 with TagInt

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

the class MyTraderLlama method writeExtendedInfo.

@Override
public TagCompound writeExtendedInfo() {
    TagCompound info = super.writeExtendedInfo();
    info.getCompoundData().put("Variant", new TagInt(getVariant()));
    info.getCompoundData().put("Baby", new TagByte(isBaby()));
    if (hasChest()) {
        info.getCompoundData().put("Chest", MyPetApi.getPlatformHelper().itemStackToCompund(getChest()));
    }
    if (hasDecor()) {
        info.getCompoundData().put("Decor", MyPetApi.getPlatformHelper().itemStackToCompund(getDecor()));
    }
    return info;
}
Also used : TagInt(de.keyle.knbt.TagInt) TagCompound(de.keyle.knbt.TagCompound) TagByte(de.keyle.knbt.TagByte)

Example 32 with TagInt

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

the class MyVillager method writeExtendedInfo.

@Override
public TagCompound writeExtendedInfo() {
    TagCompound info = super.writeExtendedInfo();
    info.getCompoundData().put("Profession", new TagInt(getProfession()));
    info.getCompoundData().put("VillagerType", new TagInt(getType().ordinal()));
    info.getCompoundData().put("VillagerLevel", new TagInt(getVillagerLevel()));
    info.getCompoundData().put("Baby", new TagByte(isBaby()));
    if (originalData != null) {
        info.getCompoundData().put("OriginalData", originalData);
    }
    return info;
}
Also used : TagInt(de.keyle.knbt.TagInt) TagCompound(de.keyle.knbt.TagCompound) TagByte(de.keyle.knbt.TagByte)

Example 33 with TagInt

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

the class MyTropicalFish method writeExtendedInfo.

@Override
public TagCompound writeExtendedInfo() {
    TagCompound info = super.writeExtendedInfo();
    info.getCompoundData().put("Variant", new TagInt(getVariant()));
    return info;
}
Also used : TagInt(de.keyle.knbt.TagInt) TagCompound(de.keyle.knbt.TagCompound)

Example 34 with TagInt

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

the class MyHorse method writeExtendedInfo.

@Override
public TagCompound writeExtendedInfo() {
    TagCompound info = super.writeExtendedInfo();
    info.getCompoundData().put("Type", new TagByte(getHorseType()));
    info.getCompoundData().put("Variant", new TagInt(getVariant()));
    if (hasArmor()) {
        info.getCompoundData().put("Armor", MyPetApi.getPlatformHelper().itemStackToCompund(getArmor()));
    }
    info.getCompoundData().put("Age", new TagInt(getAge()));
    if (hasChest()) {
        info.getCompoundData().put("Chest", MyPetApi.getPlatformHelper().itemStackToCompund(getChest()));
    }
    if (hasSaddle()) {
        info.getCompoundData().put("Saddle", MyPetApi.getPlatformHelper().itemStackToCompund(getSaddle()));
    }
    return info;
}
Also used : TagInt(de.keyle.knbt.TagInt) TagCompound(de.keyle.knbt.TagCompound) TagByte(de.keyle.knbt.TagByte)

Example 35 with TagInt

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

the class RepositoryMyPetConverterService method v1_11_R1.

public void v1_11_R1(StoredMyPet pet) {
    TagCompound info = pet.getInfo();
    switch(pet.getPetType()) {
        case Horse:
            if (info.containsKey("Type")) {
                byte type = info.getAs("Type", TagByte.class).getByteData();
                switch(type) {
                    case 1:
                        pet.setPetType(MyPetType.Donkey);
                        break;
                    case 2:
                        pet.setPetType(MyPetType.Mule);
                        break;
                    case 3:
                        pet.setPetType(MyPetType.ZombieHorse);
                        break;
                    case 4:
                        pet.setPetType(MyPetType.SkeletonHorse);
                        break;
                }
                info.remove("Type");
            }
            break;
        case Skeleton:
            if (info.containsKey("Type")) {
                int type = info.getAs("Type", TagInt.class).getIntData();
                switch(type) {
                    case 1:
                        pet.setPetType(MyPetType.WitherSkeleton);
                        break;
                    case 2:
                        pet.setPetType(MyPetType.Stray);
                        break;
                }
                info.remove("Type");
            }
            if (info.containsKey("Wither")) {
                if (info.getAs("Wither", TagByte.class).getBooleanData()) {
                    pet.setPetType(MyPetType.WitherSkeleton);
                    info.remove("Wither");
                }
            }
            break;
        case Zombie:
            if (info.containsKey("Type")) {
                int type = info.getAs("Type", TagInt.class).getIntData();
                switch(type) {
                    case 6:
                        pet.setPetType(MyPetType.Husk);
                        break;
                    case 0:
                        break;
                    default:
                        if (type == 2) {
                            if (info.containsKey("Profession")) {
                                pet.setPetType(MyPetType.ZombieVillager);
                                info.put("Profession", new TagInt(info.getAs("Profession", TagInt.class).getIntData() - 1));
                            } else {
                                pet.setPetType(MyPetType.Husk);
                            }
                        } else {
                            pet.setPetType(MyPetType.ZombieVillager);
                            if (info.containsKey("Profession")) {
                                info.put("Profession", new TagInt(info.getAs("Profession", TagInt.class).getIntData() - 1));
                            }
                        }
                }
                info.remove("Type");
            }
            if (info.containsKey("Villager")) {
                if (info.getAs("Villager", TagByte.class).getBooleanData()) {
                    pet.setPetType(MyPetType.ZombieVillager);
                    info.remove("Villager");
                }
            }
            if (info.containsKey("Husk")) {
                if (info.getAs("Husk", TagByte.class).getBooleanData()) {
                    pet.setPetType(MyPetType.Husk);
                    info.remove("Husk");
                }
            }
            break;
        case Guardian:
            if (info.containsKey("Elder")) {
                if (info.getAs("Elder", TagByte.class).getBooleanData()) {
                    pet.setPetType(MyPetType.ElderGuardian);
                    info.remove("Elder");
                }
            }
            break;
    }
}
Also used : TagInt(de.keyle.knbt.TagInt) TagCompound(de.keyle.knbt.TagCompound) TagByte(de.keyle.knbt.TagByte)

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