Add null-safety check on usage of BlockEntity.loadStatic (#6224)

This commit is contained in:
Jay Turner 2024-03-22 13:38:56 +00:00 committed by GitHub
parent 6802a1316b
commit efb3cf490d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -298,10 +298,12 @@ public class BlockHelper {
if (data != null) {
if (existingBlockEntity instanceof IMergeableBE mergeable) {
BlockEntity loaded = BlockEntity.loadStatic(target, state, data);
if (existingBlockEntity.getType()
.equals(loaded.getType())) {
mergeable.accept(loaded);
return;
if (loaded != null) {
if (existingBlockEntity.getType()
.equals(loaded.getType())) {
mergeable.accept(loaded);
return;
}
}
}
BlockEntity blockEntity = world.getBlockEntity(target);