SPIGOT-5551: BlockState.setData fails when used by legacy plugin

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-01-29 09:22:43 +11:00
parent 959b2adc98
commit e2093ed2c6
2 changed files with 16 additions and 8 deletions

View File

@@ -56,7 +56,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
public static IBlockData getBlock(Material material, byte data) {
return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), getBlock(material), data);
return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), data);
}
public static MaterialData getMaterial(IBlockData data) {
@@ -65,7 +65,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
public static Item getItem(Material material, short data) {
if (material.isLegacy()) {
return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), getItem(material), data);
return CraftLegacy.fromLegacyData(CraftLegacy.toLegacy(material), data);
}
return getItem(material);
@@ -114,10 +114,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
public static Item getItem(Material material) {
if (material != null && material.isLegacy()) {
material = CraftLegacy.fromLegacy(material);
}
return MATERIAL_ITEM.get(material);
}
public static Block getBlock(Material material) {
if (material != null && material.isLegacy()) {
material = CraftLegacy.fromLegacy(material);
}
return MATERIAL_BLOCK.get(material);
}