diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-05-31 18:28:25 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-06-01 00:23:06 -0500 |
commit | 1c13d076afb1fa02e3bc850d9f9de5128865d875 (patch) | |
tree | 0764066557d61cfd3a2b2f3cfb500a233e3b67e4 /src/main/java/net | |
parent | 47b57e6bcf90fc988466619d1dd3b4ba641f69fd (diff) | |
download | craftbukkit-1c13d076afb1fa02e3bc850d9f9de5128865d875.tar craftbukkit-1c13d076afb1fa02e3bc850d9f9de5128865d875.tar.gz craftbukkit-1c13d076afb1fa02e3bc850d9f9de5128865d875.tar.lz craftbukkit-1c13d076afb1fa02e3bc850d9f9de5128865d875.tar.xz craftbukkit-1c13d076afb1fa02e3bc850d9f9de5128865d875.zip |
Improve ItemStack filtering.
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemStack.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 73428488..f9aaf4ab 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -204,10 +204,14 @@ public final class ItemStack { public void c(NBTTagCompound nbttagcompound) { this.item = Item.d(nbttagcompound.getShort("id")); this.count = nbttagcompound.getByte("Count"); + /* CraftBukkit start - Route through setData for filtering this.damage = nbttagcompound.getShort("Damage"); if (this.damage < 0) { this.damage = 0; } + */ + this.setData(nbttagcompound.getShort("Damage")); + // CraftBukkit end if (nbttagcompound.hasKeyOfType("tag", 10)) { // CraftBukkit - make defensive copy as this data may be coming from the save thread @@ -258,6 +262,11 @@ public final class ItemStack { i = 0; } } + + // Filter invalid plant data + if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) == Blocks.DOUBLE_PLANT && (i > 5 || i < 0)) { + i = 0; + } // CraftBukkit end this.damage = i; @@ -565,6 +574,7 @@ public final class ItemStack { public void setItem(Item item) { this.item = item; + this.setData(this.getData()); // CraftBukkit - Set data again to ensure it is filtered properly } public IChatBaseComponent E() { |