use of net.minecraft.server.v1_16_R2.NBTTagList in project PaperDev by Kamillaova.
the class CraftMetaBanner method applyToItem.
@Override
void applyToItem(NBTTagCompound tag) {
super.applyToItem(tag);
NBTTagCompound entityTag = new NBTTagCompound();
if (base != null) {
entityTag.setInt(BASE.NBT, base.getDyeData());
}
NBTTagList newPatterns = new NBTTagList();
for (Pattern p : patterns) {
NBTTagCompound compound = new NBTTagCompound();
compound.setInt(COLOR.NBT, p.getColor().getDyeData());
compound.setString(PATTERN.NBT, p.getPattern().getIdentifier());
newPatterns.add(compound);
}
entityTag.set(PATTERNS.NBT, newPatterns);
tag.set("BlockEntityTag", entityTag);
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project PaperDev by Kamillaova.
the class CraftMetaBook method applyToItem.
void applyToItem(NBTTagCompound itemData, boolean handlePages) {
super.applyToItem(itemData);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
}
if (handlePages) {
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(CraftChatMessage.fromComponent(page)));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.remove(RESOLVED.NBT);
}
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
}
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project PaperDev by Kamillaova.
the class CraftMetaBookSigned method applyToItem.
@Override
void applyToItem(NBTTagCompound itemData) {
super.applyToItem(itemData, false);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
} else {
itemData.setString(BOOK_TITLE.NBT, " ");
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
} else {
itemData.setString(BOOK_AUTHOR.NBT, " ");
}
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(ChatSerializer.a(page)));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.setBoolean(RESOLVED.NBT, true);
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
} else {
itemData.setInt(GENERATION.NBT, 0);
}
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project PaperDev by Kamillaova.
the class CraftMetaFirework method applyToItem.
@Override
void applyToItem(NBTTagCompound itemTag) {
super.applyToItem(itemTag);
if (isFireworkEmpty()) {
return;
}
NBTTagCompound fireworks = itemTag.getCompound(FIREWORKS.NBT);
itemTag.set(FIREWORKS.NBT, fireworks);
if (hasEffects()) {
NBTTagList effects = new NBTTagList();
for (FireworkEffect effect : this.effects) {
effects.add(getExplosion(effect));
}
if (effects.size() > 0) {
fireworks.set(EXPLOSIONS.NBT, effects);
}
}
if (hasPower()) {
fireworks.setByte(FLIGHT.NBT, (byte) power);
}
}
use of net.minecraft.server.v1_16_R2.NBTTagList in project PaperDev by Kamillaova.
the class CraftMetaItem method applyEnchantments.
static void applyEnchantments(Map<Enchantment, Integer> enchantments, NBTTagCompound tag, ItemMetaKey key) {
if (enchantments == null) /*|| enchantments.size() == 0*/
{
// Spigot - remove size check
return;
}
NBTTagList list = new NBTTagList();
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
NBTTagCompound subtag = new NBTTagCompound();
subtag.setShort(ENCHANTMENTS_ID.NBT, (short) entry.getKey().getId());
subtag.setShort(ENCHANTMENTS_LVL.NBT, entry.getValue().shortValue());
list.add(subtag);
}
tag.set(key.NBT, list);
}
Aggregations