Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #457 from UeberallGebannt/master
Browse files Browse the repository at this point in the history
Fix NBT erasing error (Fixes #453)
  • Loading branch information
Hexeption authored Jul 31, 2021
2 parents 348d714 + cda8df2 commit dd991e7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/bukkit/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,10 @@ public MaterialType getMaterialType() {
return this.materialType;
}

public boolean isModded() {
return this.getMaterialType() != MaterialType.VANILLA;
}

public enum MaterialType {
VANILLA,
MOD_ITEM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd991e7

Please sign in to comment.