From 9ec48a956c5251350be5180909aef4e80d91a885 Mon Sep 17 00:00:00 2001 From: aphom Date: Tue, 21 Apr 2026 23:32:27 +0100 Subject: [PATCH 1/7] Rudimentary fix for ryanhcode/sable#48 Creators-of-Aeronautics/Simulated-Project#315 Creators-of-Aeronautics/Simulated-Project#329 Only for assembling. Fix for disassembling will be requested on Aeronautics' side. --- .../sable/api/SubLevelAssemblyHelper.java | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index 4ec57bd..71fe2a4 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -20,23 +20,24 @@ import dev.ryanhcode.sable.util.BoundedBitVolume3i; import dev.ryanhcode.sable.util.LevelAccelerator; import it.unimi.dsi.fastutil.Pair; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.FullChunkStatus; import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.TagKey; import net.minecraft.world.Clearable; import net.minecraft.world.RandomizableContainer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.BellBlock; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BellAttachType; @@ -65,7 +66,7 @@ public class SubLevelAssemblyHelper { * @param blocks all blocks that will be assembled into the sub-level * @param bounds the bounds in which {@link TrackingPoint tracking points} and retained entities will be moved */ - public static ServerSubLevel assembleBlocks(final ServerLevel level, final BlockPos anchor, final Iterable blocks, final BoundingBox3ic bounds) { + public static ServerSubLevel assembleBlocks(final ServerLevel level, final BlockPos anchor, Iterable blocks, final BoundingBox3ic bounds) { final ServerSubLevelContainer container = SubLevelContainer.getContainer(level); assert container != null; @@ -79,6 +80,37 @@ public static ServerSubLevel assembleBlocks(final ServerLevel level, final Block pose.orientation().set(containingPose.orientation()); } + // Get Create's brittle and wrench_pickup tags if they exist. + final TagKey< Block > createBrittleTag = (ResourceLocation.isValidNamespace( "create" ) + ? TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")) : null); + final TagKey< Block > createWrenchPickupTag = (ResourceLocation.isValidNamespace( "create" ) + ? TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")) : null); + + if (createBrittleTag != null && createWrenchPickupTag != null) { + final LevelAccelerator accelerator = new LevelAccelerator(level); + final ObjectArrayList< BlockPos > newBlocks = new ObjectArrayList<>(); + final ObjectArrayList< BlockPos > brittleBlocks = new ObjectArrayList<>(); + + // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. + for (final BlockPos pos : blocks) { + final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), + SectionPos.blockToSectionCoord(pos.getZ())); + + final BlockState posState = chunk.getBlockState(pos); + final Block block = posState.getBlock(); + + // A bit of a dirty way of checking for affected blocks. + if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) + || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } + newBlocks.add(pos); + } + + // Add all brittle blocks in the front of the blocks list so they are processed first. + newBlocks.addAll(0, brittleBlocks); + + blocks = newBlocks; + } + final ServerSubLevel subLevel = (ServerSubLevel) container.allocateNewSubLevel(pose); final LevelPlot plot = subLevel.getPlot(); @@ -539,4 +571,4 @@ public enum State { } } } -} +} \ No newline at end of file From 5e6528cb6732b5fd095c2cc50d3c1d1adb5f3cdb Mon Sep 17 00:00:00 2001 From: aphom Date: Tue, 21 Apr 2026 23:37:25 +0100 Subject: [PATCH 2/7] Added back imports --- .../dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index 71fe2a4..8358e2d 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -37,7 +37,13 @@ import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.DiodeBlock; +import net.minecraft.world.level.block.TorchBlock; +import net.minecraft.world.level.block.BellBlock; +import net.minecraft.world.level.block.SignBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BellAttachType; From 65af88d5112f2d7c1ede5ffafde04a2e201ecd8b Mon Sep 17 00:00:00 2001 From: aphom Date: Wed, 22 Apr 2026 00:53:47 +0100 Subject: [PATCH 3/7] Code cleanup --- .../sable/api/SubLevelAssemblyHelper.java | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index 8358e2d..1050ef9 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -86,37 +86,33 @@ public static ServerSubLevel assembleBlocks(final ServerLevel level, final Block pose.orientation().set(containingPose.orientation()); } - // Get Create's brittle and wrench_pickup tags if they exist. - final TagKey< Block > createBrittleTag = (ResourceLocation.isValidNamespace( "create" ) - ? TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")) : null); - final TagKey< Block > createWrenchPickupTag = (ResourceLocation.isValidNamespace( "create" ) - ? TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")) : null); - - if (createBrittleTag != null && createWrenchPickupTag != null) { - final LevelAccelerator accelerator = new LevelAccelerator(level); - final ObjectArrayList< BlockPos > newBlocks = new ObjectArrayList<>(); - final ObjectArrayList< BlockPos > brittleBlocks = new ObjectArrayList<>(); - - // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. - for (final BlockPos pos : blocks) { - final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), - SectionPos.blockToSectionCoord(pos.getZ())); - - final BlockState posState = chunk.getBlockState(pos); - final Block block = posState.getBlock(); - - // A bit of a dirty way of checking for affected blocks. - if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) - || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } - newBlocks.add(pos); - } + // Get Create's brittle and wrench_pickup tags. + final TagKey< Block > createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); + final TagKey< Block > createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); + + final LevelAccelerator accelerator = new LevelAccelerator(level); + final ObjectArrayList< BlockPos > newBlocks = new ObjectArrayList<>(); + final ObjectArrayList< BlockPos > brittleBlocks = new ObjectArrayList<>(); - // Add all brittle blocks in the front of the blocks list so they are processed first. - newBlocks.addAll(0, brittleBlocks); + // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. + for (final BlockPos pos : blocks) { + final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), + SectionPos.blockToSectionCoord(pos.getZ())); - blocks = newBlocks; + final BlockState posState = chunk.getBlockState(pos); + final Block block = posState.getBlock(); + + // A bit of a dirty way of checking for affected blocks. + if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) + || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } + newBlocks.add(pos); } + // Add all brittle blocks in the front of the blocks list so they are processed first. + newBlocks.addAll(0, brittleBlocks); + + blocks = newBlocks; + final ServerSubLevel subLevel = (ServerSubLevel) container.allocateNewSubLevel(pose); final LevelPlot plot = subLevel.getPlot(); From 2a215088b7804a38eb6798d06c59dbacf2037ba9 Mon Sep 17 00:00:00 2001 From: aphom Date: Wed, 22 Apr 2026 01:46:39 +0100 Subject: [PATCH 4/7] Removed unnecessary spaces between diamond operators --- .../java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index 1050ef9..b6abc27 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -91,8 +91,8 @@ public static ServerSubLevel assembleBlocks(final ServerLevel level, final Block final TagKey< Block > createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); final LevelAccelerator accelerator = new LevelAccelerator(level); - final ObjectArrayList< BlockPos > newBlocks = new ObjectArrayList<>(); - final ObjectArrayList< BlockPos > brittleBlocks = new ObjectArrayList<>(); + final ObjectArrayList newBlocks = new ObjectArrayList<>(); + final ObjectArrayList brittleBlocks = new ObjectArrayList<>(); // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. for (final BlockPos pos : blocks) { From b98e58d24e20e1f5a811aa6417c18ddf84a63d57 Mon Sep 17 00:00:00 2001 From: aphom Date: Wed, 22 Apr 2026 14:17:11 +0100 Subject: [PATCH 5/7] Moved fix into the moveBlocks method so the fix does not have to be implemented on Aero's side as well. This fix on Sable's side fixes both for assembly and disassembly. --- .../sable/api/SubLevelAssemblyHelper.java | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index b6abc27..6159434 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -72,7 +72,7 @@ public class SubLevelAssemblyHelper { * @param blocks all blocks that will be assembled into the sub-level * @param bounds the bounds in which {@link TrackingPoint tracking points} and retained entities will be moved */ - public static ServerSubLevel assembleBlocks(final ServerLevel level, final BlockPos anchor, Iterable blocks, final BoundingBox3ic bounds) { + public static ServerSubLevel assembleBlocks(final ServerLevel level, final BlockPos anchor, final Iterable blocks, final BoundingBox3ic bounds) { final ServerSubLevelContainer container = SubLevelContainer.getContainer(level); assert container != null; @@ -86,33 +86,6 @@ public static ServerSubLevel assembleBlocks(final ServerLevel level, final Block pose.orientation().set(containingPose.orientation()); } - // Get Create's brittle and wrench_pickup tags. - final TagKey< Block > createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); - final TagKey< Block > createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); - - final LevelAccelerator accelerator = new LevelAccelerator(level); - final ObjectArrayList newBlocks = new ObjectArrayList<>(); - final ObjectArrayList brittleBlocks = new ObjectArrayList<>(); - - // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. - for (final BlockPos pos : blocks) { - final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), - SectionPos.blockToSectionCoord(pos.getZ())); - - final BlockState posState = chunk.getBlockState(pos); - final Block block = posState.getBlock(); - - // A bit of a dirty way of checking for affected blocks. - if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) - || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } - newBlocks.add(pos); - } - - // Add all brittle blocks in the front of the blocks list so they are processed first. - newBlocks.addAll(0, brittleBlocks); - - blocks = newBlocks; - final ServerSubLevel subLevel = (ServerSubLevel) container.allocateNewSubLevel(pose); final LevelPlot plot = subLevel.getPlot(); @@ -318,12 +291,38 @@ private static boolean needsBitSet(final ServerLevel level, final BoundingBox3ic /** * For what good is the movement of a king if his people do not follow? */ - public static void moveBlocks(final ServerLevel level, final AssemblyTransform transform, final Iterable blocks) { + public static void moveBlocks(final ServerLevel level, final AssemblyTransform transform, Iterable blocks) { final ServerLevel resultingLevel = transform.resultingLevel; final LevelAccelerator accelerator = new LevelAccelerator(level); final LevelAccelerator resultingAccelerator = new LevelAccelerator(resultingLevel); + // Get Create's brittle and wrench_pickup tags. + final TagKey< Block > createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); + final TagKey< Block > createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); + + final ObjectArrayList newBlocks = new ObjectArrayList<>(); + final ObjectArrayList brittleBlocks = new ObjectArrayList<>(); + + // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. + for (final BlockPos pos : blocks) { + final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), + SectionPos.blockToSectionCoord(pos.getZ())); + + final BlockState posState = chunk.getBlockState(pos); + final Block block = posState.getBlock(); + + // A bit of a dirty way of checking for affected blocks. + if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) + || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } + newBlocks.add(pos); + } + + // Add all brittle blocks in the front of the blocks list so they are processed first. + newBlocks.addAll(0, brittleBlocks); + + blocks = newBlocks; + final List states = new ArrayList<>(); BlockPos firstBlock = null; From 3b62c48e6eb51c6366d409fca61bc94718435d1a Mon Sep 17 00:00:00 2001 From: aphom Date: Wed, 22 Apr 2026 14:27:00 +0100 Subject: [PATCH 6/7] Removed unnecessary spaces between diamond operators. --- .../java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index 6159434..1cd5d15 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -298,8 +298,8 @@ public static void moveBlocks(final ServerLevel level, final AssemblyTransform t final LevelAccelerator resultingAccelerator = new LevelAccelerator(resultingLevel); // Get Create's brittle and wrench_pickup tags. - final TagKey< Block > createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); - final TagKey< Block > createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); + final TagKey createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); + final TagKey createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); final ObjectArrayList newBlocks = new ObjectArrayList<>(); final ObjectArrayList brittleBlocks = new ObjectArrayList<>(); From 9d01d01172bd6942f38cf6ffe53c9d1f0984cd4f Mon Sep 17 00:00:00 2001 From: aphom Date: Thu, 23 Apr 2026 17:02:52 +0100 Subject: [PATCH 7/7] Implemented a new way of fixing the issue. All blocks are temporarily replaced with barriers first, which fully prevents any brittle blocks from breaking. --- .../sable/api/SubLevelAssemblyHelper.java | 55 ++++++------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java index e32c156..beecf39 100644 --- a/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java +++ b/common/src/main/java/dev/ryanhcode/sable/api/SubLevelAssemblyHelper.java @@ -20,27 +20,20 @@ import dev.ryanhcode.sable.util.BoundedBitVolume3i; import dev.ryanhcode.sable.util.LevelAccelerator; import it.unimi.dsi.fastutil.Pair; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.SectionPos; -import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.FullChunkStatus; import net.minecraft.server.level.ServerLevel; -import net.minecraft.tags.TagKey; import net.minecraft.world.Clearable; import net.minecraft.world.RandomizableContainer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.DiodeBlock; -import net.minecraft.world.level.block.TorchBlock; import net.minecraft.world.level.block.BellBlock; -import net.minecraft.world.level.block.SignBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Rotation; @@ -291,38 +284,12 @@ private static boolean needsBitSet(final ServerLevel level, final BoundingBox3ic /** * For what good is the movement of a king if his people do not follow? */ - public static void moveBlocks(final ServerLevel level, final AssemblyTransform transform, Iterable blocks) { + public static void moveBlocks(final ServerLevel level, final AssemblyTransform transform, final Iterable blocks) { final ServerLevel resultingLevel = transform.resultingLevel; final LevelAccelerator accelerator = new LevelAccelerator(level); final LevelAccelerator resultingAccelerator = new LevelAccelerator(resultingLevel); - // Get Create's brittle and wrench_pickup tags. - final TagKey createBrittleTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "brittle")); - final TagKey createWrenchPickupTag = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("create", "wrench_pickup")); - - final ObjectArrayList newBlocks = new ObjectArrayList<>(); - final ObjectArrayList brittleBlocks = new ObjectArrayList<>(); - - // Check if blocks have Create's brittle tag or the wrench_pickup tag for redstone blocks. - for (final BlockPos pos : blocks) { - final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(pos.getX()), - SectionPos.blockToSectionCoord(pos.getZ())); - - final BlockState posState = chunk.getBlockState(pos); - final Block block = posState.getBlock(); - - // A bit of a dirty way of checking for affected blocks. - if (posState.is(createBrittleTag) || posState.is(createWrenchPickupTag) - || block instanceof DiodeBlock || block instanceof TorchBlock || block instanceof SignBlock) { brittleBlocks.add(pos); continue; } - newBlocks.add(pos); - } - - // Add all brittle blocks in the front of the blocks list so they are processed first. - newBlocks.addAll(0, brittleBlocks); - - blocks = newBlocks; - final List states = new ArrayList<>(); BlockPos firstBlock = null; @@ -423,24 +390,36 @@ public static void moveBlocks(final ServerLevel level, final AssemblyTransform t i++; } + final BlockState subLevelState = Blocks.AIR.defaultBlockState(); + SableAssemblyPlatform.INSTANCE.setIgnoreOnPlace(resultingLevel, true); - // destroy all the old blocks + // Replace all old blocks as barriers temporarily to prevent any brittle blocks from breaking. for (final BlockPos block : blocks) { - final BlockState subLevelState = Blocks.AIR.defaultBlockState(); + try { + final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(block.getX()), + SectionPos.blockToSectionCoord(block.getZ())); + + chunk.setBlockState(block, Blocks.BARRIER.defaultBlockState(), true); + } catch (final Exception e) { + Sable.LOGGER.error("Failed to replace old block into a temporary barrier during assembly {}", block, e); + } + } + + // Destroy all temporary barriers. + for (final BlockPos block : blocks) { try { final LevelChunk chunk = accelerator.getChunk(SectionPos.blockToSectionCoord(block.getX()), SectionPos.blockToSectionCoord(block.getZ())); chunk.setBlockState(block, subLevelState, true); } catch (final Exception e) { - Sable.LOGGER.error("Failed to destroy old block during assembly {}", block, e); + Sable.LOGGER.error("Failed to destroy temporary barrier during assembly {}", block, e); } } SableAssemblyPlatform.INSTANCE.setIgnoreOnPlace(resultingLevel, false); for (final BlockPos block : blocks) { - final BlockState subLevelState = Blocks.AIR.defaultBlockState(); resultingLevel.sendBlockUpdated(block, Blocks.STONE.defaultBlockState(), subLevelState, 3); } }