#326: Convert BlockMeta to handle older serialized items.
Dieser Commit ist enthalten in:
Ursprung
9beb0c9968
Commit
b64d852496
12
nms-patches/DataInspectorBlockEntity.patch
Normale Datei
12
nms-patches/DataInspectorBlockEntity.patch
Normale Datei
@ -0,0 +1,12 @@
|
|||||||
|
--- a/net/minecraft/server/DataInspectorBlockEntity.java
|
||||||
|
+++ b/net/minecraft/server/DataInspectorBlockEntity.java
|
||||||
|
@@ -32,7 +32,8 @@
|
||||||
|
boolean flag;
|
||||||
|
|
||||||
|
if (s1 == null) {
|
||||||
|
- DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s});
|
||||||
|
+ // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item)
|
||||||
|
+ // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s});
|
||||||
|
flag = false;
|
||||||
|
} else {
|
||||||
|
flag = !nbttagcompound2.hasKey("id");
|
@ -20,18 +20,15 @@
|
|||||||
public final class ItemStack {
|
public final class ItemStack {
|
||||||
|
|
||||||
public static final ItemStack a = new ItemStack((Item) null);
|
public static final ItemStack a = new ItemStack((Item) null);
|
||||||
@@ -46,28 +59,49 @@
|
@@ -46,28 +59,56 @@
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.damage = j;
|
this.damage = j;
|
||||||
this.count = i;
|
this.count = i;
|
||||||
+ // CraftBukkit start - Pass to setData to do filtering
|
+ // CraftBukkit start - Pass to setData to do filtering
|
||||||
+ if (MinecraftServer.getServer() != null) {
|
+ if (MinecraftServer.getServer() != null) {
|
||||||
+ this.setData(j);
|
+ this.setData(j);
|
||||||
+ NBTTagCompound savedStack = new NBTTagCompound();
|
|
||||||
+ this.save(savedStack);
|
|
||||||
+ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
|
|
||||||
+ this.load(savedStack);
|
|
||||||
+ }
|
+ }
|
||||||
|
+ this.convertStack();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
if (this.damage < 0) {
|
if (this.damage < 0) {
|
||||||
- this.damage = 0;
|
- this.damage = 0;
|
||||||
@ -41,6 +38,16 @@
|
|||||||
this.F();
|
this.F();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ // Called to run this stack through the data converter to handle older storage methods and serialized items
|
||||||
|
+ public void convertStack() {
|
||||||
|
+ if (MinecraftServer.getServer() != null) {
|
||||||
|
+ NBTTagCompound savedStack = new NBTTagCompound();
|
||||||
|
+ this.save(savedStack);
|
||||||
|
+ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
|
||||||
|
+ this.load(savedStack);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
private void F() {
|
private void F() {
|
||||||
+ if (this.g && this == ItemStack.a) throw new AssertionError("TRAP"); // CraftBukkit
|
+ if (this.g && this == ItemStack.a) throw new AssertionError("TRAP"); // CraftBukkit
|
||||||
this.g = this.isEmpty();
|
this.g = this.isEmpty();
|
||||||
@ -75,7 +82,7 @@
|
|||||||
this.F();
|
this.F();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +128,138 @@
|
@@ -94,11 +135,138 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
|
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||||
@ -215,7 +222,7 @@
|
|||||||
|
|
||||||
return enuminteractionresult;
|
return enuminteractionresult;
|
||||||
}
|
}
|
||||||
@@ -122,7 +283,7 @@
|
@@ -122,7 +290,7 @@
|
||||||
nbttagcompound.setByte("Count", (byte) this.count);
|
nbttagcompound.setByte("Count", (byte) this.count);
|
||||||
nbttagcompound.setShort("Damage", (short) this.damage);
|
nbttagcompound.setShort("Damage", (short) this.damage);
|
||||||
if (this.tag != null) {
|
if (this.tag != null) {
|
||||||
@ -224,7 +231,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
@@ -157,11 +318,30 @@
|
@@ -157,11 +325,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(int i) {
|
public void setData(int i) {
|
||||||
@ -257,7 +264,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int k() {
|
public int k() {
|
||||||
@@ -205,6 +385,11 @@
|
@@ -205,6 +392,11 @@
|
||||||
entityhuman.b(StatisticList.c(this.item));
|
entityhuman.b(StatisticList.c(this.item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +276,7 @@
|
|||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,6 +694,12 @@
|
@@ -509,6 +701,12 @@
|
||||||
nbttaglist.add(nbttagcompound);
|
nbttaglist.add(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +423,7 @@ public final class CraftItemStack extends ItemStack {
|
|||||||
item.setTag(tag);
|
item.setTag(tag);
|
||||||
|
|
||||||
((CraftMetaItem) itemMeta).applyToItem(tag);
|
((CraftMetaItem) itemMeta).applyToItem(tag);
|
||||||
|
item.convertStack();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren