summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-03-25 10:20:27 +1100
committermd_5 <git@md-5.net>2016-03-25 11:03:39 +1100
commit18658965d316a4b23d2b1e2a25b9dd84a6ac7db0 (patch)
tree207e2d68f967585afbcd1828ffe381070ef1f29e /nms-patches
parent0ff499cf03a013e8999042d6e758ecab6ddf41b6 (diff)
downloadcraftbukkit-18658965d316a4b23d2b1e2a25b9dd84a6ac7db0.tar
craftbukkit-18658965d316a4b23d2b1e2a25b9dd84a6ac7db0.tar.gz
craftbukkit-18658965d316a4b23d2b1e2a25b9dd84a6ac7db0.tar.lz
craftbukkit-18658965d316a4b23d2b1e2a25b9dd84a6ac7db0.tar.xz
craftbukkit-18658965d316a4b23d2b1e2a25b9dd84a6ac7db0.zip
Apply DataConverters to ItemStack instances
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/ItemStack.patch25
-rw-r--r--nms-patches/MinecraftServer.patch2
2 files changed, 17 insertions, 10 deletions
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index 422f1c2a..f061c9ab 100644
--- a/nms-patches/ItemStack.patch
+++ b/nms-patches/ItemStack.patch
@@ -20,14 +20,13 @@
public final class ItemStack {
public static final DecimalFormat a = new DecimalFormat("#.##");
-@@ -46,10 +59,14 @@
+@@ -46,10 +59,20 @@
this.k = false;
this.item = item;
this.count = i;
- this.damage = j;
- if (this.damage < 0) {
- this.damage = 0;
-- }
+
+ // CraftBukkit start - Pass to setData to do filtering
+ this.setData(j);
@@ -35,11 +34,17 @@
+ //if (this.damage < 0) {
+ // this.damage = 0;
+ //}
++ if (MinecraftServer.getServer() != null) {
++ NBTTagCompound savedStack = new NBTTagCompound();
++ this.save(savedStack);
++ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
++ this.c(savedStack); // PAIL: load
+ }
+ // CraftBukkit end
}
-@@ -84,11 +101,131 @@
+@@ -84,11 +107,131 @@
}
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
@@ -172,7 +177,7 @@
return enuminteractionresult;
}
-@@ -112,7 +249,7 @@
+@@ -112,7 +255,7 @@
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@@ -181,7 +186,7 @@
}
return nbttagcompound;
-@@ -121,13 +258,18 @@
+@@ -121,13 +264,18 @@
public void c(NBTTagCompound nbttagcompound) {
this.item = Item.d(nbttagcompound.getString("id"));
this.count = nbttagcompound.getByte("Count");
@@ -201,7 +206,7 @@
if (this.item != null) {
this.item.a(this.tag);
}
-@@ -164,9 +306,29 @@
+@@ -164,11 +312,30 @@
}
public void setData(int i) {
@@ -230,9 +235,11 @@
- this.damage = 0;
+ // this.damage = 0; // CraftBukkit - remove this.
}
-
+-
}
-@@ -216,6 +378,12 @@
+
+ public int j() {
+@@ -216,6 +383,12 @@
this.count = 0;
}
@@ -245,7 +252,7 @@
this.damage = 0;
}
-@@ -513,6 +681,7 @@
+@@ -513,6 +686,7 @@
public void setItem(Item item) {
this.item = item;
diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch
index fe8c79c5..391f2ece 100644
--- a/nms-patches/MinecraftServer.patch
+++ b/nms-patches/MinecraftServer.patch
@@ -694,7 +694,7 @@
+ // CraftBukkit start
+ @Deprecated
+ public static MinecraftServer getServer() {
-+ return ((CraftServer) Bukkit.getServer()).getServer();
++ return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
+ }
+ // CraftBukkit end
}