From 6d9d6b4b81233a4aba6fd3f4843da3161dd386c8 Mon Sep 17 00:00:00 2001 From: NotEvil Date: Thu, 16 Apr 2026 01:52:31 +0200 Subject: [PATCH] =?UTF-8?q?fix(UC-02):=20arch=20review=20=E2=80=94=20furni?= =?UTF-8?q?ture=20x/z=20offsets=20+=20ceiling=20chain=20fidelity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add x_offset/z_offset to PositionedBlock for multi-block furniture clusters - Furniture items now spread across 2-3 positions (matching original Java code) - Offsets multiplied by inward direction for correct corner orientation - Fix has_ceiling_chain: only oubliette has ceiling chains (was true for all 6) - Fix firstCornerSpecial: oubliette cauldron uses x/z offset +1 (inward diagonal) - Update parser to read x_offset/z_offset (defaults to 0) --- .../remake/worldgen/DecorationConfig.java | 11 ++++++-- .../remake/worldgen/HangingCagePiece.java | 27 +++++++++++++------ .../remake/worldgen/RoomThemeParser.java | 6 +++-- .../data/tiedup/tiedup_room_themes/crypt.json | 4 +-- .../data/tiedup/tiedup_room_themes/ice.json | 6 ++--- .../tiedup/tiedup_room_themes/inferno.json | 6 ++--- .../tiedup/tiedup_room_themes/oubliette.json | 4 +-- .../tiedup/tiedup_room_themes/sandstone.json | 6 ++--- .../data/tiedup/tiedup_room_themes/sculk.json | 6 ++--- 9 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/tiedup/remake/worldgen/DecorationConfig.java b/src/main/java/com/tiedup/remake/worldgen/DecorationConfig.java index 3fc0928..a9d7692 100644 --- a/src/main/java/com/tiedup/remake/worldgen/DecorationConfig.java +++ b/src/main/java/com/tiedup/remake/worldgen/DecorationConfig.java @@ -27,10 +27,17 @@ public record DecorationConfig( ) { /** - * A block state with an associated Y offset for positioned placement. + * A block state with positional offsets for placement. * * @param state the block state to place + * @param xOffset horizontal X offset from base position (0 = no offset) * @param yOffset vertical offset from the base position + * @param zOffset horizontal Z offset from base position (0 = no offset) */ - public record PositionedBlock(BlockState state, int yOffset) {} + public record PositionedBlock(BlockState state, int xOffset, int yOffset, int zOffset) { + /** Convenience constructor for Y-offset-only blocks (most common case). */ + public PositionedBlock(BlockState state, int yOffset) { + this(state, 0, yOffset, 0); + } + } } diff --git a/src/main/java/com/tiedup/remake/worldgen/HangingCagePiece.java b/src/main/java/com/tiedup/remake/worldgen/HangingCagePiece.java index e545b10..80635db 100644 --- a/src/main/java/com/tiedup/remake/worldgen/HangingCagePiece.java +++ b/src/main/java/com/tiedup/remake/worldgen/HangingCagePiece.java @@ -660,24 +660,35 @@ public class HangingCagePiece extends StructurePiece { } // First corner special (e.g. water cauldron, skull, TNT, sculk catalyst) + // x/z offsets are multiplied by inward direction (toward room center) if (deco.firstCornerSpecial() != null && corners.length > 0) { int[] sc = corners[0]; - if (layout.isInShape(sc[0], sc[1]) && !layout.isWall(sc[0], sc[1])) { + int dirX = sc[0] < 6 ? 1 : -1; + int dirZ = sc[1] < 6 ? 1 : -1; + int scx = sc[0] + deco.firstCornerSpecial().xOffset() * dirX; + int scz = sc[1] + deco.firstCornerSpecial().zOffset() * dirZ; + if (layout.isInShape(scx, scz) && !layout.isWall(scx, scz)) { safeSetBlock(level, - new BlockPos(baseX + sc[0], floorY + deco.firstCornerSpecial().yOffset(), baseZ + sc[1]), + new BlockPos(baseX + scx, floorY + deco.firstCornerSpecial().yOffset(), baseZ + scz), deco.firstCornerSpecial().state(), chunkBB); } } - // Furniture cluster at corners[1] (e.g. barrel+brewing_stand, soul_campfire+cauldron) + // Furniture cluster at corners[1] — each item has x/z offsets relative to the + // base furniture position. x_offset/z_offset values are multiplied by the + // inward direction (toward room center) to handle all 4 corner orientations. if (corners.length > 1) { int[] fc = corners[1]; - int fcx = fc[0] + (fc[0] < 6 ? 1 : -1); - int fcz = fc[1] + (fc[1] < 6 ? 1 : -1); - if (layout.isInShape(fcx, fcz) && !layout.isWall(fcx, fcz)) { - for (DecorationConfig.PositionedBlock pb : deco.furnitureCluster()) { + int dirX = fc[0] < 6 ? 1 : -1; + int dirZ = fc[1] < 6 ? 1 : -1; + int fcx = fc[0] + dirX; + int fcz = fc[1] + dirZ; + for (DecorationConfig.PositionedBlock pb : deco.furnitureCluster()) { + int px = fcx + pb.xOffset() * dirX; + int pz = fcz + pb.zOffset() * dirZ; + if (layout.isInShape(px, pz) && !layout.isWall(px, pz)) { safeSetBlock(level, - new BlockPos(baseX + fcx, floorY + pb.yOffset(), baseZ + fcz), + new BlockPos(baseX + px, floorY + pb.yOffset(), baseZ + pz), pb.state(), chunkBB); } } diff --git a/src/main/java/com/tiedup/remake/worldgen/RoomThemeParser.java b/src/main/java/com/tiedup/remake/worldgen/RoomThemeParser.java index de30203..4766658 100644 --- a/src/main/java/com/tiedup/remake/worldgen/RoomThemeParser.java +++ b/src/main/java/com/tiedup/remake/worldgen/RoomThemeParser.java @@ -433,7 +433,7 @@ public final class RoomThemeParser { } /** - * Parse a single positioned block: { "block": "...", "y_offset": 0 } + * Parse a single positioned block: { "block": "...", "x_offset": 0, "y_offset": 0, "z_offset": 0 } */ @Nullable private static DecorationConfig.PositionedBlock parsePositionedBlock( @@ -445,8 +445,10 @@ public final class RoomThemeParser { BlockState state = parseBlockState(blockStr, fileId); if (state == null) return null; + int xOffset = getIntOrDefault(obj, "x_offset", 0); int yOffset = getIntOrDefault(obj, "y_offset", 0); - return new DecorationConfig.PositionedBlock(state, yOffset); + int zOffset = getIntOrDefault(obj, "z_offset", 0); + return new DecorationConfig.PositionedBlock(state, xOffset, yOffset, zOffset); } // ===== Primitive Helpers ===== diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/crypt.json b/src/main/resources/data/tiedup/tiedup_room_themes/crypt.json index a0a4a1e..019352d 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/crypt.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/crypt.json @@ -52,9 +52,9 @@ "first_corner_special": { "block": "minecraft:skeleton_skull", "y_offset": 1 }, "furniture_cluster": [ { "block": "minecraft:lectern", "y_offset": 1 }, - { "block": "minecraft:candle[lit=true,candles=4]", "y_offset": 1 } + { "block": "minecraft:candle[lit=true,candles=4]", "x_offset": 1, "y_offset": 1 } ], "use_torch_lighting": true, - "has_ceiling_chain": true + "has_ceiling_chain": false } } diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/ice.json b/src/main/resources/data/tiedup/tiedup_room_themes/ice.json index 9e60b88..e4b75eb 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/ice.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/ice.json @@ -50,10 +50,10 @@ ], "furniture_cluster": [ { "block": "minecraft:powder_snow_cauldron[level=3]", "y_offset": 1 }, - { "block": "minecraft:blue_ice", "y_offset": 1 }, - { "block": "minecraft:lantern", "y_offset": 2 } + { "block": "minecraft:blue_ice", "x_offset": 1, "y_offset": 1 }, + { "block": "minecraft:lantern", "y_offset": 2, "z_offset": 1 } ], "use_torch_lighting": false, - "has_ceiling_chain": true + "has_ceiling_chain": false } } diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/inferno.json b/src/main/resources/data/tiedup/tiedup_room_themes/inferno.json index 434af69..a44b075 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/inferno.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/inferno.json @@ -49,10 +49,10 @@ ], "furniture_cluster": [ { "block": "minecraft:soul_campfire", "y_offset": 1 }, - { "block": "minecraft:lava_cauldron", "y_offset": 1 }, - { "block": "minecraft:gilded_blackstone", "y_offset": 1 } + { "block": "minecraft:lava_cauldron", "x_offset": 1, "y_offset": 1 }, + { "block": "minecraft:gilded_blackstone", "y_offset": 1, "z_offset": 1 } ], "use_torch_lighting": false, - "has_ceiling_chain": true + "has_ceiling_chain": false } } diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/oubliette.json b/src/main/resources/data/tiedup/tiedup_room_themes/oubliette.json index 8d2b881..4d7462f 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/oubliette.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/oubliette.json @@ -51,10 +51,10 @@ "wall_midpoint_blocks": [ { "block": "minecraft:soul_lantern", "y_offset": 3 } ], - "first_corner_special": { "block": "minecraft:water_cauldron[level=3]", "y_offset": 1 }, + "first_corner_special": { "block": "minecraft:water_cauldron[level=3]", "x_offset": 1, "y_offset": 1, "z_offset": 1 }, "furniture_cluster": [ { "block": "minecraft:barrel", "y_offset": 1 }, - { "block": "minecraft:brewing_stand", "y_offset": 1 } + { "block": "minecraft:brewing_stand", "x_offset": 1, "y_offset": 1 } ], "use_torch_lighting": false, "has_ceiling_chain": true diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/sandstone.json b/src/main/resources/data/tiedup/tiedup_room_themes/sandstone.json index fdf457c..3bd5296 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/sandstone.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/sandstone.json @@ -43,10 +43,10 @@ "first_corner_special": { "block": "minecraft:tnt", "y_offset": 1 }, "furniture_cluster": [ { "block": "minecraft:barrel", "y_offset": 1 }, - { "block": "minecraft:flower_pot", "y_offset": 1 }, - { "block": "minecraft:orange_terracotta", "y_offset": 1 } + { "block": "minecraft:flower_pot", "x_offset": 1, "y_offset": 1 }, + { "block": "minecraft:orange_terracotta", "y_offset": 1, "z_offset": 1 } ], "use_torch_lighting": true, - "has_ceiling_chain": true + "has_ceiling_chain": false } } diff --git a/src/main/resources/data/tiedup/tiedup_room_themes/sculk.json b/src/main/resources/data/tiedup/tiedup_room_themes/sculk.json index 474b66a..506482d 100644 --- a/src/main/resources/data/tiedup/tiedup_room_themes/sculk.json +++ b/src/main/resources/data/tiedup/tiedup_room_themes/sculk.json @@ -49,10 +49,10 @@ "first_corner_special": { "block": "minecraft:sculk_catalyst", "y_offset": 1 }, "furniture_cluster": [ { "block": "minecraft:sculk_shrieker", "y_offset": 1 }, - { "block": "minecraft:sculk_sensor", "y_offset": 1 }, - { "block": "minecraft:candle[lit=true,candles=3]", "y_offset": 1 } + { "block": "minecraft:sculk_sensor", "x_offset": 1, "y_offset": 1 }, + { "block": "minecraft:candle[lit=true,candles=3]", "y_offset": 1, "z_offset": 1 } ], "use_torch_lighting": false, - "has_ceiling_chain": true + "has_ceiling_chain": false } }