Skip to content

Commit

Permalink
Enhanced shell synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
Kir-Antipov committed Aug 6, 2022
1 parent d8d32bb commit 1a27137
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public AbstractShellContainerBlockEntity(BlockEntityType<?> type, BlockPos pos,
@Override
public void setShellState(ShellState shell) {
this.shell = shell;
if (this.world != null && !this.world.isClient && this.pos != null && this.getCachedState() != null) {
this.checkShellState(this.world, this.pos, this.getCachedState());
}
}

@Override
Expand Down Expand Up @@ -97,6 +100,10 @@ protected Optional<AbstractShellContainerBlockEntity> getBottomPart() {

@Override
public void onServerTick(World world, BlockPos pos, BlockState state) {
this.checkShellState(world, pos, state);
}

private void checkShellState(World world, BlockPos pos, BlockState state) {
if (this.shell != null && this.shell.getColor() != this.color) {
this.shell.setColor(this.color);
}
Expand Down

0 comments on commit 1a27137

Please sign in to comment.