diff --git a/common/src/main/java/whocraft/tardis_refined/common/block/device/TerraformerBlock.java b/common/src/main/java/whocraft/tardis_refined/common/block/device/TerraformerBlock.java index 33fd17812..0d18e1ca7 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/block/device/TerraformerBlock.java +++ b/common/src/main/java/whocraft/tardis_refined/common/block/device/TerraformerBlock.java @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import whocraft.tardis_refined.common.capability.TardisLevelOperator; import whocraft.tardis_refined.common.tardis.TardisDesktops; +import whocraft.tardis_refined.common.tardis.manager.TardisInteriorManager; import whocraft.tardis_refined.registry.DimensionTypes; import java.util.stream.Stream; @@ -85,13 +86,14 @@ public void onPlace(BlockState blockState, Level level, BlockPos blockPos, Block if (level instanceof ServerLevel serverLevel) { if (checkIfStructure(serverLevel, blockPos)) { TardisLevelOperator.get(serverLevel).ifPresent(cap -> { - if (cap.getInteriorManager().isWaitingToGenerate()) { + TardisInteriorManager interiorManager = cap.getInteriorManager(); + if (interiorManager.isWaitingToGenerate()) { level.destroyBlock(blockPos, true); } else { - if (cap.getInteriorManager().isCave()) { - cap.getInteriorManager().prepareDesktop(TardisDesktops.FACTORY_THEME); + if (interiorManager.isCave()) { + interiorManager.prepareDesktop(TardisDesktops.FACTORY_THEME); destroyStructure(serverLevel, blockPos); - serverLevel.setBlock(blockPos, blockState.setValue(ACTIVE, true), 3); + serverLevel.setBlock(blockPos, blockState.setValue(ACTIVE, true), Block.UPDATE_ALL); } } }); @@ -121,8 +123,9 @@ public void onRemove(BlockState blockState, Level level, BlockPos blockPos, Bloc if (level instanceof ServerLevel serverLevel) { if (blockState.getValue(ACTIVE)) { TardisLevelOperator.get(serverLevel).ifPresent(cap -> { - if (cap.getInteriorManager().isWaitingToGenerate()) { - cap.getInteriorManager().cancelDesktopChange(); + TardisInteriorManager interiorManager = cap.getInteriorManager(); + if (interiorManager.isWaitingToGenerate()) { + interiorManager.cancelDesktopChange(); } }); } diff --git a/common/src/main/java/whocraft/tardis_refined/common/blockentity/shell/ShellBaseBlockEntity.java b/common/src/main/java/whocraft/tardis_refined/common/blockentity/shell/ShellBaseBlockEntity.java index 9ddf37b81..1b0faf53f 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/blockentity/shell/ShellBaseBlockEntity.java +++ b/common/src/main/java/whocraft/tardis_refined/common/blockentity/shell/ShellBaseBlockEntity.java @@ -67,6 +67,7 @@ public CompoundTag getUpdateTag() { protected void saveAdditional(CompoundTag pTag) { if (this.TARDIS_ID == null) { TardisRefined.LOGGER.error("Error in saveAdditional: null Tardis ID (could this be an invalid block?) [" + this.getBlockPos().toShortString() + "]"); + return; } super.saveAdditional(pTag); @@ -81,10 +82,7 @@ public ClientboundBlockEntityDataPacket getUpdatePacket() { public boolean shouldSetup() { if (!this.level.isClientSide()) { - if (this.TARDIS_ID != null) { - return false; - } - return true; + return this.TARDIS_ID == null; } return false; } diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisInteriorManager.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisInteriorManager.java index a01e3f1b5..f9fcacbb7 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisInteriorManager.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisInteriorManager.java @@ -284,7 +284,6 @@ public boolean isInAirlock(LivingEntity livingEntity) { } public void generateDesktop(DesktopTheme theme) { - setCurrentTheme(theme); if (operator.getLevel() instanceof ServerLevel serverLevel) { @@ -302,6 +301,7 @@ public void generateDesktop(DesktopTheme theme) { // Generate Desktop Interior TardisArchitectureHandler.generateDesktop(serverLevel, theme); + setCurrentTheme(theme); } }