Fix NPE with legacy plugin

This commit is contained in:
IzzelAliz 2020-11-22 10:29:14 +08:00
parent 3d40d345fc
commit 3af14dee6e

View File

@ -21,7 +21,7 @@ public class CraftLegacyLegacyMixin {
} else { } else {
try { try {
Material material = Material.valueOf(name); Material material = Material.valueOf(name);
if (((MaterialBridge) (Object) material).bridge$getType() == MaterialPropertySpec.MaterialType.FORGE) { if (material != null && ((MaterialBridge) (Object) material).bridge$getType() == MaterialPropertySpec.MaterialType.FORGE) {
return material; return material;
} else { } else {
return Material.valueOf("LEGACY_" + name); return Material.valueOf("LEGACY_" + name);
@ -43,7 +43,7 @@ public class CraftLegacyLegacyMixin {
} else { } else {
try { try {
Material material = Material.getMaterial(name); Material material = Material.getMaterial(name);
if (((MaterialBridge) (Object) material).bridge$getType() == MaterialPropertySpec.MaterialType.FORGE) { if (material != null && ((MaterialBridge) (Object) material).bridge$getType() == MaterialPropertySpec.MaterialType.FORGE) {
return material; return material;
} else { } else {
return Material.getMaterial("LEGACY_" + name); return Material.getMaterial("LEGACY_" + name);