Fix NPE copying forge caps

This commit is contained in:
IzzelAliz 2021-03-01 16:03:43 +08:00
parent 1d797fdfb8
commit 242055daed

View File

@ -144,10 +144,12 @@ public class CraftMetaItemMixin implements ItemMetaBridge {
} }
@Inject(method = "<init>*", at = @At("RETURN")) @Inject(method = "<init>*", at = @At("RETURN"))
private void arclight$copyForgeCaps( CraftMetaItem meta, CallbackInfo ci) { private void arclight$copyForgeCaps(CraftMetaItem meta, CallbackInfo ci) {
CompoundNBT forgeCaps = ((ItemMetaBridge) meta).bridge$getForgeCaps(); if (meta != null) {
if (forgeCaps != null) { CompoundNBT forgeCaps = ((ItemMetaBridge) meta).bridge$getForgeCaps();
this.forgeCaps = forgeCaps.copy(); if (forgeCaps != null) {
this.forgeCaps = forgeCaps.copy();
}
} }
} }
} }