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);