geforkt von Mirrors/Paper
Fix BlockEntityTag being stripped from items
Dieser Commit ist enthalten in:
Ursprung
7bb3034c78
Commit
6268eb5a3e
@ -196,16 +196,20 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
static final ItemMetaKey ATTRIBUTES_UUID_HIGH = new ItemMetaKey("UUIDMost");
|
static final ItemMetaKey ATTRIBUTES_UUID_HIGH = new ItemMetaKey("UUIDMost");
|
||||||
@Specific(Specific.To.NBT)
|
@Specific(Specific.To.NBT)
|
||||||
static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast");
|
static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast");
|
||||||
|
@Specific(Specific.To.NBT)
|
||||||
|
static final ItemMetaKey BLOCK_ENTITY_TAG = new ItemMetaKey("BlockEntityTag");
|
||||||
|
|
||||||
private String displayName;
|
private String displayName;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private Map<Enchantment, Integer> enchantments;
|
private Map<Enchantment, Integer> enchantments;
|
||||||
private int repairCost;
|
private int repairCost;
|
||||||
private final NBTTagList attributes;
|
private final NBTTagList attributes;
|
||||||
|
private final NBTTagCompound blockEntityTag;
|
||||||
|
|
||||||
CraftMetaItem(CraftMetaItem meta) {
|
CraftMetaItem(CraftMetaItem meta) {
|
||||||
if (meta == null) {
|
if (meta == null) {
|
||||||
attributes = null;
|
attributes = null;
|
||||||
|
blockEntityTag = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +225,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
|
|
||||||
this.repairCost = meta.repairCost;
|
this.repairCost = meta.repairCost;
|
||||||
this.attributes = meta.attributes;
|
this.attributes = meta.attributes;
|
||||||
|
blockEntityTag = meta.blockEntityTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftMetaItem(NBTTagCompound tag) {
|
CraftMetaItem(NBTTagCompound tag) {
|
||||||
@ -296,6 +301,12 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
} else {
|
} else {
|
||||||
attributes = null;
|
attributes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tag.hasKeyOfType(BLOCK_ENTITY_TAG.NBT, 10)) {
|
||||||
|
blockEntityTag = tag.getCompound(BLOCK_ENTITY_TAG.NBT);
|
||||||
|
} else {
|
||||||
|
blockEntityTag = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
|
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
|
||||||
@ -332,6 +343,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
attributes = null;
|
attributes = null;
|
||||||
|
blockEntityTag = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
|
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
|
||||||
@ -371,6 +383,10 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
itemTag.set(ATTRIBUTES.NBT, attributes);
|
itemTag.set(ATTRIBUTES.NBT, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blockEntityTag != null) {
|
||||||
|
itemTag.set(BLOCK_ENTITY_TAG.NBT, blockEntityTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NBTTagList createStringList(List<String> list) {
|
static NBTTagList createStringList(List<String> list) {
|
||||||
@ -539,7 +555,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|||||||
&& (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
|
&& (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
|
||||||
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
|
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
|
||||||
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
|
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
|
||||||
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost());
|
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
|
||||||
|
&& (this.blockEntityTag != null ? that.blockEntityTag != null && this.blockEntityTag.equals(this.blockEntityTag) : that.blockEntityTag == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren