use of net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1 in project Denizen-For-Bukkit by DenizenScript.
the class ImprovedOfflinePlayer_v1_11_R1 method setInventory.
@Override
public void setInventory(org.bukkit.inventory.PlayerInventory inventory) {
CraftInventoryPlayer inv = (CraftInventoryPlayer) inventory;
NBTTagCompound nbtTagCompound = ((CompoundTag_v1_11_R1) compound).toNMSTag();
nbtTagCompound.set("Inventory", inv.getInventory().a(new NBTTagList()));
this.compound = CompoundTag_v1_11_R1.fromNMSTag(nbtTagCompound);
if (this.autosave) {
savePlayerData();
}
}
use of net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1 in project Denizen-For-Bukkit by DenizenScript.
the class ImprovedOfflinePlayer_v1_11_R1 method getEnderChest.
@Override
public Inventory getEnderChest() {
if (offlineEnderChests.containsKey(getUniqueId())) {
return offlineEnderChests.get(getUniqueId());
}
InventoryEnderChest endchest = new InventoryEnderChest(null);
endchest.a(((CompoundTag_v1_11_R1) this.compound).toNMSTag().getList("EnderItems", 10));
org.bukkit.inventory.Inventory inv = new CraftInventory(endchest);
offlineEnderChests.put(getUniqueId(), inv);
return inv;
}
use of net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1 in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_11_R1 method addNbtData.
@Override
public ItemStack addNbtData(ItemStack itemStack, String key, Tag value) {
net.minecraft.server.v1_11_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
CompoundTag compound = CompoundTag_v1_11_R1.fromNMSTag(tag).createBuilder().put(key, value).build();
nmsItemStack.setTag(((CompoundTag_v1_11_R1) compound).toNMSTag());
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1 in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_11_R1 method setAttributeModifiers.
@Override
public ItemStack setAttributeModifiers(ItemStack itemStack, Map<EntityAttribute, List<EntityAttributeModifier>> modifiers) {
List<Tag> modifierList = new ArrayList<Tag>(getNbtData(itemStack).getList("AttributeModifiers"));
for (Map.Entry<EntityAttribute, List<EntityAttributeModifier>> entry : modifiers.entrySet()) {
EntityAttribute attribute = entry.getKey();
for (EntityAttributeModifier modifier : entry.getValue()) {
Map<String, Tag> compound = new HashMap<String, Tag>();
compound.put("AttributeName", new StringTag(attribute.getName()));
UUID uuid = modifier.getUniqueId();
compound.put("UUIDMost", new LongTag(uuid.getMostSignificantBits()));
compound.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits()));
compound.put("Name", new StringTag(modifier.getName()));
compound.put("Operation", new IntTag(modifier.getOperation().ordinal()));
compound.put("Amount", new DoubleTag(modifier.getAmount()));
modifierList.add(new CompoundTag_v1_11_R1(compound));
}
}
return addNbtData(itemStack, "AttributeModifiers", new ListTag(CompoundTag.class, modifierList));
}
Aggregations