Skip to content

Commit 1a27137

Browse files
committed
Enhanced shell synchronization
1 parent d8d32bb commit 1a27137

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public AbstractShellContainerBlockEntity(BlockEntityType<?> type, BlockPos pos,
6363
@Override
6464
public void setShellState(ShellState shell) {
6565
this.shell = shell;
66+
if (this.world != null && !this.world.isClient && this.pos != null && this.getCachedState() != null) {
67+
this.checkShellState(this.world, this.pos, this.getCachedState());
68+
}
6669
}
6770

6871
@Override
@@ -97,6 +100,10 @@ protected Optional<AbstractShellContainerBlockEntity> getBottomPart() {
97100

98101
@Override
99102
public void onServerTick(World world, BlockPos pos, BlockState state) {
103+
this.checkShellState(world, pos, state);
104+
}
105+
106+
private void checkShellState(World world, BlockPos pos, BlockState state) {
100107
if (this.shell != null && this.shell.getColor() != this.color) {
101108
this.shell.setColor(this.color);
102109
}

0 commit comments

Comments
 (0)