Search in sources :

Example 91 with NBTTagCompound

use of net.minecraft.server.v1_13_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.

the class NBTStackedEntityDataStorage method rebuild.

private NBTTagCompound rebuild(NBTTagCompound compoundTag) {
    NBTTagCompound merged = new NBTTagCompound();
    merged.a(this.base);
    merged.a(compoundTag);
    this.fillAttributeUuids(merged);
    return merged;
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound)

Example 92 with NBTTagCompound

use of net.minecraft.server.v1_13_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.

the class NBTStackedEntityDataStorage method stripUnneeded.

private void stripUnneeded(NBTTagCompound compoundTag) {
    compoundTag.remove("UUID");
    compoundTag.remove("Pos");
    compoundTag.remove("Rotation");
    compoundTag.remove("WorldUUIDMost");
    compoundTag.remove("WorldUUIDLeast");
    compoundTag.remove("Motion");
    compoundTag.remove("OnGround");
    compoundTag.remove("FallDistance");
    compoundTag.remove("Leash");
    compoundTag.remove("Spigot.ticksLived");
    compoundTag.remove("Paper.OriginWorld");
    compoundTag.remove("Paper.Origin");
    NBTTagCompound bukkitValues = compoundTag.getCompound("BukkitValues");
    bukkitValues.remove("rosestacker:stacked_entity_data");
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound)

Example 93 with NBTTagCompound

use of net.minecraft.server.v1_13_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.

the class NBTStackedEntityDataStorage method addAt.

private void addAt(int index, StackedEntityDataEntry<?> stackedEntityDataEntry) {
    NBTTagCompound compoundTag = (NBTTagCompound) stackedEntityDataEntry.get();
    this.stripUnneeded(compoundTag);
    this.stripAttributeUuids(compoundTag);
    this.removeDuplicates(compoundTag);
    this.data.add(index, compoundTag);
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound)

Example 94 with NBTTagCompound

use of net.minecraft.server.v1_13_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.

the class NBTStackedEntityDataStorage method stripAttributeUuids.

private void stripAttributeUuids(NBTTagCompound compoundTag) {
    NBTTagList attributes = compoundTag.getList("Attributes", 10);
    for (int i = 0; i < attributes.size(); i++) {
        NBTTagCompound attribute = attributes.getCompound(i);
        attribute.remove("UUID");
        NBTTagList modifiers = attribute.getList("Modifiers", 10);
        for (int j = 0; j < modifiers.size(); j++) {
            NBTTagCompound modifier = modifiers.getCompound(j);
            if (modifier.getString("Name").equals("Random spawn bonus")) {
                modifiers.remove(j);
                j--;
            } else {
                modifier.remove("UUID");
            }
        }
    }
}
Also used : NBTTagList(net.minecraft.server.v1_16_R3.NBTTagList) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound)

Example 95 with NBTTagCompound

use of net.minecraft.server.v1_13_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.

the class NBTStackedEntityDataStorage method fillAttributeUuids.

private void fillAttributeUuids(NBTTagCompound compoundTag) {
    NBTTagList attributes = compoundTag.getList("Attributes", 10);
    for (int i = 0; i < attributes.size(); i++) {
        NBTTagCompound attribute = attributes.getCompound(i);
        attribute.a("UUID", UUID.randomUUID());
        NBTTagList modifiers = attribute.getList("Modifiers", 10);
        for (int j = 0; j < modifiers.size(); j++) {
            NBTTagCompound modifier = modifiers.getCompound(j);
            modifier.a("UUID", UUID.randomUUID());
        }
        if (modifiers.size() == 0)
            attribute.remove("Modifiers");
    }
}
Also used : NBTTagList(net.minecraft.server.v1_16_R3.NBTTagList) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound)

Aggregations

NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)69 ItemStack (org.bukkit.inventory.ItemStack)60 Map (java.util.Map)41 NBTTagCompound (net.minecraft.server.v1_16_R3.NBTTagCompound)39 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)38 ArrayList (java.util.ArrayList)37 ItemMeta (org.bukkit.inventory.meta.ItemMeta)35 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)33 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)30 ListTag (com.wasteofplastic.org.jnbt.ListTag)30 StringTag (com.wasteofplastic.org.jnbt.StringTag)30 Tag (com.wasteofplastic.org.jnbt.Tag)30 NBTTagCompound (net.minecraft.server.v1_16_R2.NBTTagCompound)24 Nullable (javax.annotation.Nullable)21 NBTTagCompound (net.minecraft.server.v1_9_R2.NBTTagCompound)21 NBTTagCompound (net.minecraft.server.v1_10_R1.NBTTagCompound)20 NBTTagCompound (net.minecraft.server.v1_11_R1.NBTTagCompound)20 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)20 NBTTagList (net.minecraft.server.v1_12_R1.NBTTagList)19 NBTTagCompound (net.minecraft.server.v1_15_R1.NBTTagCompound)18