9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

修复简单存储容器关不上门的问题

This commit is contained in:
jhqwqmc
2025-12-02 23:19:33 +08:00
parent 6f1e730d03
commit 20e1a42f62

View File

@@ -173,7 +173,9 @@ public class SimpleStorageBlockEntity extends BlockEntity {
public void updateOpenBlockState(boolean open) {
ImmutableBlockState state = super.world.getBlockStateAtIfLoaded(this.pos);
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;
super.world.world().setBlockState(this.pos.x(), this.pos.y(), this.pos.z(), state.with(property, open), UpdateOption.UPDATE_ALL.flags());
}