From 1a2713737e0f6345e330d4f24a8950e555aa58ec Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Sat, 6 Aug 2022 22:35:53 +0300 Subject: [PATCH] Enhanced shell synchronization --- .../block/entity/AbstractShellContainerBlockEntity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java b/src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java index 14ab1d0..1f04c7f 100644 --- a/src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java +++ b/src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java @@ -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 @@ -97,6 +100,10 @@ protected Optional 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); }