use of net.minecraft.server.v1_16_R2.NBTTagList 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");
}
}
}
}
use of net.minecraft.server.v1_16_R2.NBTTagList 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");
}
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 method getPlayerSkull.
@Override
public org.bukkit.inventory.ItemStack getPlayerSkull(org.bukkit.inventory.ItemStack itemStack, String texture) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound nbtTagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
NBTTagCompound skullOwner = nbtTagCompound.hasKey("SkullOwner") ? nbtTagCompound.getCompound("SkullOwner") : new NBTTagCompound();
NBTTagCompound properties = new NBTTagCompound();
NBTTagList textures = new NBTTagList();
NBTTagCompound signature = new NBTTagCompound();
signature.setString("Value", texture);
textures.add(signature);
properties.set("textures", textures);
skullOwner.set("Properties", properties);
skullOwner.setString("Id", UUID.randomUUID().toString());
nbtTagCompound.set("SkullOwner", skullOwner);
nmsItem.setTag(nbtTagCompound);
return CraftItemStack.asBukkitCopy(nmsItem);
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_7_R4 method getPlayerSkull.
@Override
public org.bukkit.inventory.ItemStack getPlayerSkull(org.bukkit.inventory.ItemStack itemStack, String texture) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound nbtTagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
NBTTagCompound skullOwner = nbtTagCompound.hasKey("SkullOwner") ? nbtTagCompound.getCompound("SkullOwner") : new NBTTagCompound();
NBTTagCompound properties = new NBTTagCompound();
NBTTagList textures = new NBTTagList();
NBTTagCompound signature = new NBTTagCompound();
signature.setString("Value", texture);
textures.add(signature);
properties.set("textures", textures);
skullOwner.set("Properties", properties);
skullOwner.setString("Id", UUID.randomUUID().toString());
nbtTagCompound.set("SkullOwner", skullOwner);
nmsItem.setTag(nbtTagCompound);
return CraftItemStack.asBukkitCopy(nmsItem);
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method deserialize.
private InventoryHolder deserialize(NBTTagCompound tagCompound) {
InventoryHolder inventory = new InventoryHolder(tagCompound.getInt("Size"), "Chest");
NBTTagList itemsList = tagCompound.getList("Items", 10);
for (int i = 0; i < itemsList.size(); i++) {
NBTTagCompound nbtTagCompound = itemsList.get(i);
inventory.setItem(nbtTagCompound.getByte("Slot"), CraftItemStack.asBukkitCopy(new ItemStack(nbtTagCompound)));
}
return inventory;
}
Aggregations