use of net.minecraft.server.v1_16_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;
}
use of net.minecraft.server.v1_16_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");
}
use of net.minecraft.server.v1_16_R2.NBTTagCompound in project RoseStacker by Rosewood-Development.
the class NBTStackedEntityDataStorage method removeDuplicates.
private void removeDuplicates(NBTTagCompound compoundTag) {
for (String key : new ArrayList<>(compoundTag.getKeys())) {
NBTBase baseValue = this.base.get(key);
NBTBase thisValue = compoundTag.get(key);
if (baseValue != null && baseValue.equals(thisValue))
compoundTag.remove(key);
}
}
use of net.minecraft.server.v1_16_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);
}
use of net.minecraft.server.v1_16_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");
}
}
}
}
Aggregations