mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
Merge pull request #487 from jhqwqmc/fix/simple-storage-block
修复简单存储容器关不上门的问题
This commit is contained in:
@@ -173,7 +173,9 @@ public class SimpleStorageBlockEntity extends BlockEntity {
|
|||||||
public void updateOpenBlockState(boolean open) {
|
public void updateOpenBlockState(boolean open) {
|
||||||
ImmutableBlockState state = super.world.getBlockStateAtIfLoaded(this.pos);
|
ImmutableBlockState state = super.world.getBlockStateAtIfLoaded(this.pos);
|
||||||
if (state == null || state.behavior() != this.behavior) return;
|
if (state == null || state.behavior() != this.behavior) return;
|
||||||
Property<Boolean> property = this.behavior.openProperty();
|
SimpleStorageBlockBehavior behavior = state.behavior().getAs(SimpleStorageBlockBehavior.class).orElse(null);
|
||||||
|
if (behavior == null) return;
|
||||||
|
Property<Boolean> property = behavior.openProperty();
|
||||||
if (property == null) return;
|
if (property == null) return;
|
||||||
super.world.world().setBlockState(this.pos.x(), this.pos.y(), this.pos.z(), state.with(property, open), UpdateOption.UPDATE_ALL.flags());
|
super.world.world().setBlockState(this.pos.x(), this.pos.y(), this.pos.z(), state.with(property, open), UpdateOption.UPDATE_ALL.flags());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user