diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index 280a01b..c470c55 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -1536,6 +1536,10 @@ public MaterialType getMaterialType() { return this.materialType; } + public boolean isModded() { + return this.getMaterialType() != MaterialType.VANILLA; + } + public enum MaterialType { VANILLA, MOD_ITEM, diff --git a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemFactory.java index f68ed88..e80d64a 100644 --- a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemFactory.java @@ -139,7 +139,7 @@ private ItemMeta getItemMeta(Material material, CraftMetaItem meta) { case ENDER_CHEST: return new CraftMetaBlockState(meta, material); default: - if (meta instanceof CraftMetaBlockState) { + if (meta instanceof CraftMetaBlockState && material.isModded()) { return new CraftMetaBlockState(meta, material); } return new CraftMetaItem(meta); diff --git a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemStack.java index e5383d9..46974d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftItemStack.java @@ -397,7 +397,7 @@ public static ItemMeta getItemMeta(net.minecraft.item.ItemStack item) { case ENDER_CHEST: return new CraftMetaBlockState(item.getTagCompound(), CraftMagicNumbers.getMaterial(item.getItem())); default: - if (item.item instanceof ItemBlock) { + if (item.item instanceof ItemBlock && CraftMagicNumbers.getMaterial(item.getItem()).isModded()) { return new CraftMetaBlockState(item.getTagCompound(), CraftMagicNumbers.getMaterial(item.getItem())); } return new CraftMetaItem(item.getTagCompound()); diff --git a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftMetaBlockState.java index 03ba971..eb1b1be 100644 --- a/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftMetaBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/v1_12_R1/inventory/CraftMetaBlockState.java @@ -211,7 +211,7 @@ public boolean applicableTo(Material type) { case ENDER_CHEST: return true; } - if (material.getMaterialType() == Material.MaterialType.MOD_ITEM) { + if (material.isModded()) { return true; } return false;