mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-11 04:45:01 +01:00
Add null-safety check on usage of BlockEntity.loadStatic (#6224)
This commit is contained in:
parent
6802a1316b
commit
efb3cf490d
1 changed files with 6 additions and 4 deletions
|
@ -298,12 +298,14 @@ public class BlockHelper {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (existingBlockEntity instanceof IMergeableBE mergeable) {
|
if (existingBlockEntity instanceof IMergeableBE mergeable) {
|
||||||
BlockEntity loaded = BlockEntity.loadStatic(target, state, data);
|
BlockEntity loaded = BlockEntity.loadStatic(target, state, data);
|
||||||
|
if (loaded != null) {
|
||||||
if (existingBlockEntity.getType()
|
if (existingBlockEntity.getType()
|
||||||
.equals(loaded.getType())) {
|
.equals(loaded.getType())) {
|
||||||
mergeable.accept(loaded);
|
mergeable.accept(loaded);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BlockEntity blockEntity = world.getBlockEntity(target);
|
BlockEntity blockEntity = world.getBlockEntity(target);
|
||||||
if (blockEntity != null) {
|
if (blockEntity != null) {
|
||||||
data.putInt("x", target.getX());
|
data.putInt("x", target.getX());
|
||||||
|
|
Loading…
Reference in a new issue