diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 4c4f04557e..b044e38206 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -553,7 +553,7 @@ public final class CraftItemStack extends ItemStack { @Override public boolean hasItemMeta() { - return hasItemMeta(handle); + return hasItemMeta(handle) && !CraftItemFactory.instance().equals(getItemMeta(), null); } static boolean hasItemMeta(net.minecraft.server.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 74e37cd985..f66cc81d9e 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -11,6 +11,7 @@ import net.minecraft.server.ITileEntity; import net.minecraft.server.Item; import net.minecraft.server.ItemBlock; import net.minecraft.server.ItemBlockWallable; +import net.minecraft.server.NBTTagInt; import org.bukkit.Bukkit; import org.bukkit.Color; @@ -140,6 +141,20 @@ public class ItemMetaTest extends AbstractTestingBase { assertThat(bukkit, is((ItemStack) craft)); } + @Test + public void testTaggedButNotMeta() { + CraftItemStack craft = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); + craft.handle.setDamage(0); + + assertThat("Should have NBT tag", CraftItemStack.hasItemMeta(craft.handle), is(true)); + assertThat("NBT Tag should contain Damage", craft.handle.getTag().get("Damage"), instanceOf(NBTTagInt.class)); + assertThat("But we should not have meta", craft.hasItemMeta(), is(false)); + + ItemStack pureBukkit = new ItemStack(Material.SHEARS); + assertThat("Bukkit and craft stacks should be similar", craft.isSimilar(pureBukkit), is(true)); + assertThat("Bukkit and craft stacks should be equal", craft.equals(pureBukkit), is(true)); + } + @Test public void testBlockStateMeta() { List queue = new ArrayList<>();