From e94745e39f93902c1b7efe2bd9780d81f8823fbd Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 18:32:59 +0200 Subject: [PATCH 1/8] Update roadmap --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64a4ca30..d0c7d115 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,8 @@ Lighten up your builds with unobtrusive light source - ~~De-separate the particle texture from the block texture in cabinets and others~~ - ~~Make Redstone Jack o'Lanterns to turn off when powered~~ - ~~Make Soul Jack o'Lanterns special in some way (for now particles)~~ - +- ~~Port to newer MC versions:~~ + - ~~1.20.4~~ ### High priority: @@ -150,7 +151,6 @@ Lighten up your builds with unobtrusive light source - Fix nether wood block variants burning - Add Illuminated Cabinet Brightening to the config - Port to newer MC versions: - - 1.20.4 - 1.21.4 From 4d04c2cbf53010a5568ee9b5691ec2b2a7ef7d58 Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 19:42:08 +0200 Subject: [PATCH 2/8] Fix game stuck in loading when coloured feature set is disabled --- .../io/github/mikip98/humilityafm/HumilityAFMClient.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/java/io/github/mikip98/humilityafm/HumilityAFMClient.java b/src/client/java/io/github/mikip98/humilityafm/HumilityAFMClient.java index 1957e9c3..d190eb4b 100644 --- a/src/client/java/io/github/mikip98/humilityafm/HumilityAFMClient.java +++ b/src/client/java/io/github/mikip98/humilityafm/HumilityAFMClient.java @@ -51,9 +51,12 @@ public void onInitializeClient() { BlockRenderLayerMap.INSTANCE.putBlock(floorIlluminatedCabinetBlockVariant, renderLayer); } - // LED block variants - BlockEntityRendererFactories.register(BlockEntityRegistry.LIGHT_STRIP_BLOCK_ENTITY, LightStripBlockEntityRenderer::new); - if (ModConfig.enableLightStripBrightening && !ModConfig.shimmerDetected) LightStripBlockEntityRenderer.enableBrightening(); + // Light Strip variants + if (ModConfig.enableColouredFeatureSetBeta) { + BlockEntityRendererFactories.register(BlockEntityRegistry.LIGHT_STRIP_BLOCK_ENTITY, LightStripBlockEntityRenderer::new); + if (ModConfig.enableLightStripBrightening && !ModConfig.shimmerDetected) + LightStripBlockEntityRenderer.enableBrightening(); + } FabricLoader.getInstance().getModContainer(MOD_ID).ifPresent(container -> { ResourceManagerHelper.registerBuiltinResourcePack(getId("3d_cabinet"), container, ResourcePackActivationType.NORMAL); From 18a92b071b5f0f91e270b04493ed6291e6ceaffd Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 20:07:09 +0200 Subject: [PATCH 3/8] Fix coloured Jack o'Lanterns being registered despite them should be --- .../humilityafm/registries/BlockRegistry.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java index 36b82a70..63a41b31 100644 --- a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java +++ b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java @@ -55,9 +55,9 @@ public class BlockRegistry { // Jack o'Lanterns public static final Block JACK_O_LANTERN_REDSTONE = new JackOLanternRedStone(); public static final Block JACK_O_LANTERN_SOUL = new JackOLanternSoul(); - public static final Block[] COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_weak")).toArray(Block[]::new); - public static final Block[] COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s)).toArray(Block[]::new); - public static final Block[] COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_strong")).toArray(Block[]::new); + public static Block[] COLOURED_WEAK_JACK_O_LANTERNS; + public static Block[] COLOURED_JACK_O_LANTERNS; + public static Block[] COLOURED_STRONG_JACK_O_LANTERNS; public static void register() { @@ -146,6 +146,12 @@ public static void register() { "light_strip_" ); putIntoItemGroup(ColouredFeatureSetGenerator.LightStripBlockVariants, ItemGroups.COLORED_BLOCKS); + + // Register coloured Jack o'Lanterns + COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_weak")).toArray(Block[]::new); + COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s)).toArray(Block[]::new); + COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_strong")).toArray(Block[]::new); + } // Register Forced corner stairs From 4ab20bd2cef3cb24853588591f16f488d52bd25e Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 20:12:47 +0200 Subject: [PATCH 4/8] Added tag for coloured Jack o'Lanterns --- .../github/mikip98/humilityafm/content/ModBlockTags.java | 1 + .../mikip98/humilityafm/datagen/BlockTagGenerator.java | 7 ++++++- .../mikip98/humilityafm/registries/BlockRegistry.java | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/content/ModBlockTags.java b/src/main/java/io/github/mikip98/humilityafm/content/ModBlockTags.java index c333c3a9..c8724e15 100644 --- a/src/main/java/io/github/mikip98/humilityafm/content/ModBlockTags.java +++ b/src/main/java/io/github/mikip98/humilityafm/content/ModBlockTags.java @@ -32,6 +32,7 @@ public class ModBlockTags { // Jack o'Lanterns public static final TagKey JACK_O_LANTERNS = TagKey.of(RegistryKeys.BLOCK, getId("jack_o_lanterns")); + public static final TagKey COLOURED_JACK_O_LANTERNS = TagKey.of(RegistryKeys.BLOCK, getId("coloured_jack_o_lanterns")); // Candlesticks public static final TagKey CANDLESTICKS = TagKey.of(RegistryKeys.BLOCK, getId("candlesticks")); diff --git a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java index 5cf42168..3019c88f 100644 --- a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java +++ b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java @@ -71,6 +71,10 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { getOrCreateTagBuilder(ModBlockTags.JACK_O_LANTERNS) .add(getId("jack_o_lantern_redstone")) .add(getId("jack_o_lantern_soul")); + getOrCreateTagBuilder(ModBlockTags.COLOURED_JACK_O_LANTERNS) + .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_weak"))) + .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s))) + .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_strong"))); // Candlesticks FabricTagProvider.FabricTagBuilder tag = getOrCreateTagBuilder(ModBlockTags.CANDLESTICKS) @@ -94,7 +98,8 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { .addTag(ModBlockTags.WOODEN_INNER_STAIRS) .addTag(ModBlockTags.WOODEN_OUTER_STAIRS) // Jack o'Lanterns - .addTag(ModBlockTags.JACK_O_LANTERNS); + .addTag(ModBlockTags.JACK_O_LANTERNS) + .addOptionalTag(ModBlockTags.COLOURED_JACK_O_LANTERNS); // Pickaxe Mineable getOrCreateTagBuilder(ModBlockTags.PICKAXE_MINEABLE) // Terracotta Tiles diff --git a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java index 63a41b31..8e462a2e 100644 --- a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java +++ b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java @@ -148,9 +148,9 @@ public static void register() { putIntoItemGroup(ColouredFeatureSetGenerator.LightStripBlockVariants, ItemGroups.COLORED_BLOCKS); // Register coloured Jack o'Lanterns - COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_weak")).toArray(Block[]::new); - COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s)).toArray(Block[]::new); - COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_strong")).toArray(Block[]::new); + COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s + "_weak")).toArray(Block[]::new); + COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s)).toArray(Block[]::new); + COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s + "_strong")).toArray(Block[]::new); } From 58fca6f0ba597181921c4b9d10134f6dea1616dd Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 21:49:46 +0200 Subject: [PATCH 5/8] Typo fix --- .../humilityafm/content/blocks/cabinet/CabinetBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/content/blocks/cabinet/CabinetBlock.java b/src/main/java/io/github/mikip98/humilityafm/content/blocks/cabinet/CabinetBlock.java index d57c5ad6..f1e58c63 100644 --- a/src/main/java/io/github/mikip98/humilityafm/content/blocks/cabinet/CabinetBlock.java +++ b/src/main/java/io/github/mikip98/humilityafm/content/blocks/cabinet/CabinetBlock.java @@ -174,7 +174,7 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt if (state.getBlock() != newState.getBlock()) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof CabinetBlockEntity cabinetEntity) { - // Handle item drops and block entity cleanup here + // Handle item drops and block entity clean-up here DefaultedList inventory = cabinetEntity.getItems(); for (ItemStack stack : inventory) { if (!stack.isEmpty()) { From de367b73305ebadd7a976d62fa5ce90400298026 Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 22:52:42 +0200 Subject: [PATCH 6/8] Coloured Jack o'Lantern tag fix + other tag generation improvements --- .../humilityafm/datagen/BlockTagGenerator.java | 15 ++++++++------- .../humilityafm/registries/BlockRegistry.java | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java index 3019c88f..d6e77a7c 100644 --- a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java +++ b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java @@ -2,6 +2,7 @@ import io.github.mikip98.humilityafm.content.ModBlockTags; import io.github.mikip98.humilityafm.generators.CabinetBlockGenerator; +import io.github.mikip98.humilityafm.generators.CandlestickGenerator; import io.github.mikip98.humilityafm.generators.TerracottaTilesGenerator; import io.github.mikip98.humilityafm.generators.WoodenMosaicGenerator; import io.github.mikip98.humilityafm.registries.BlockRegistry; @@ -72,16 +73,16 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { .add(getId("jack_o_lantern_redstone")) .add(getId("jack_o_lantern_soul")); getOrCreateTagBuilder(ModBlockTags.COLOURED_JACK_O_LANTERNS) - .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_weak"))) - .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s))) - .add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_strong"))); + .add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS) + .add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS) + .add(BlockRegistry.COLOURED_STRONG_JACK_O_LANTERNS); // Candlesticks FabricTagProvider.FabricTagBuilder tag = getOrCreateTagBuilder(ModBlockTags.CANDLESTICKS) - .add(getIds(Arrays.stream(GenerationData.vanillaCandlestickMetals).map(s -> "candlestick_" + s))) - .add(getIds(Arrays.stream(GenerationData.vanillaCandlestickMetals).map(s -> "candlestick_wall_" + s))); - GenerationData.vanillaRustableCandlestickMetals.forEach(metals -> tag.add(getIds(Arrays.stream(metals).map(s -> "candlestick_" + s)))); - GenerationData.vanillaRustableCandlestickMetals.forEach(metals -> tag.add(getIds(Arrays.stream(metals).map(s -> "candlestick_wall_" + s)))); + .add(CandlestickGenerator.candlestickClassicStandingVariants) + .add(CandlestickGenerator.candlestickClassicWallVariants); + CandlestickGenerator.candlestickRustableStandingVariants.forEach(tag::add); + CandlestickGenerator.candlestickRustableWallVariants.forEach(tag::add); // ------------ Vanilla Tags ------------ diff --git a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java index 8e462a2e..667952ed 100644 --- a/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java +++ b/src/main/java/io/github/mikip98/humilityafm/registries/BlockRegistry.java @@ -148,9 +148,9 @@ public static void register() { putIntoItemGroup(ColouredFeatureSetGenerator.LightStripBlockVariants, ItemGroups.COLORED_BLOCKS); // Register coloured Jack o'Lanterns - COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s + "_weak")).toArray(Block[]::new); + COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_weak_jack_o_lantern_" + s)).toArray(Block[]::new); COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s)).toArray(Block[]::new); - COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s + "_strong")).toArray(Block[]::new); + COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_strong_jack_o_lantern_" + s)).toArray(Block[]::new); } From 87f8f09a8265b8f572c3775295823cb64a3f5027 Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 23:06:23 +0200 Subject: [PATCH 7/8] Tag generation improvements --- .../humilityafm/datagen/BlockTagGenerator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java index d6e77a7c..0dcfdfea 100644 --- a/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java +++ b/src/main/java/io/github/mikip98/humilityafm/datagen/BlockTagGenerator.java @@ -29,26 +29,26 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { // ------------ Custom Tags ------------ // Cabinet Block Tags getOrCreateTagBuilder(ModBlockTags.CABINET_BLOCKS) - .add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "cabinet_block_" + s))) + .add(CabinetBlockGenerator.cabinetBlockVariants) .add(BlockRegistry.CABINET_BLOCK); // Manual testing block getOrCreateTagBuilder(ModBlockTags.ILLUMINATED_CABINET_BLOCKS) - .add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "illuminated_cabinet_block_" + s))) + .add(CabinetBlockGenerator.illuminatedCabinetBlockVariants) .add(BlockRegistry.ILLUMINATED_CABINET_BLOCK); // Manual testing block getOrCreateTagBuilder(ModBlockTags.CABINET_BLOCKS) - .add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "floor_cabinet_block_" + s))) + .add(CabinetBlockGenerator.floorCabinetBlockVariants) .add(BlockRegistry.FLOOR_CABINET_BLOCK); // Manual testing block getOrCreateTagBuilder(ModBlockTags.ILLUMINATED_CABINET_BLOCKS) - .add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "floor_illuminated_cabinet_block_" + s))) + .add(CabinetBlockGenerator.floorIlluminatedCabinetBlockVariants) .add(BlockRegistry.FLOOR_ILLUMINATED_CABINET_BLOCK); // Manual testing block // Wooden Mosaic Block Tag getOrCreateTagBuilder(ModBlockTags.WOODEN_MOSAIC_BLOCKS) - .add(getIds(Arrays.stream(WoodenMosaicGenerator.woodenMosaicVariantsNames).map(s -> "wooden_mosaic_" + s))) + .add(WoodenMosaicGenerator.woodenMosaicVariants) .add(BlockRegistry.WOODEN_MOSAIC); // Manual testing block // Terracotta Tiles Block Tag getOrCreateTagBuilder(ModBlockTags.TERRACOTTA_TILES_BLOCKS) - .add(getIds(Arrays.stream(TerracottaTilesGenerator.terracottaTilesVariantsNames).map(s -> "terracotta_tiles_" + s))); + .add(TerracottaTilesGenerator.terracottaTilesVariants); // Inner & Outer Stairs Block Tags String[] woodenVariants = GenerationData.vanillaWoodTypes; @@ -70,8 +70,8 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { // Jack o'Lanterns getOrCreateTagBuilder(ModBlockTags.JACK_O_LANTERNS) - .add(getId("jack_o_lantern_redstone")) - .add(getId("jack_o_lantern_soul")); + .add(BlockRegistry.JACK_O_LANTERN_SOUL) + .add(BlockRegistry.JACK_O_LANTERN_REDSTONE); getOrCreateTagBuilder(ModBlockTags.COLOURED_JACK_O_LANTERNS) .add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS) .add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS) From 958ea49a9ced189fe51ef5a20fa8d070c7a4e074 Mon Sep 17 00:00:00 2001 From: MikiP98 Date: Mon, 26 May 2025 23:17:49 +0200 Subject: [PATCH 8/8] Fixed and improved Forced corner stairs voxel shapes --- .../content/blocks/stairs/InnerStairs.java | 89 +++++++++++++++---- .../content/blocks/stairs/OuterStairs.java | 65 +++++++++++--- 2 files changed, 127 insertions(+), 27 deletions(-) diff --git a/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/InnerStairs.java b/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/InnerStairs.java index d0f90a8e..9fb79384 100644 --- a/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/InnerStairs.java +++ b/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/InnerStairs.java @@ -12,28 +12,58 @@ import java.util.Map; public class InnerStairs extends OuterStairs { - protected static final Map bottomVoxelShape = getVoxelShapeMapOfY(0.5f); - protected static final Map topVoxelShape = getVoxelShapeMapOfY(0f); - protected static Map getVoxelShapeMapOfY(double y) { + protected static final VoxelShape voxelShapeBottomNorth; + protected static final VoxelShape voxelShapeBottomSouth; + protected static final VoxelShape voxelShapeBottomEast; + protected static final VoxelShape voxelShapeBottomWest; + + protected static final VoxelShape voxelShapeTopNorth; + protected static final VoxelShape voxelShapeTopSouth; + protected static final VoxelShape voxelShapeTopEast; + protected static final VoxelShape voxelShapeTopWest; + + protected static Map getVoxelShapeMapOfY ( double y){ + VoxelShape base = VoxelShapes.cuboid( + 0f, 0.5f - y, 0f, + 1f, 1f - y, 1f + ); return Map.of( Direction.NORTH, VoxelShapes.union( - VoxelShapes.cuboid(0.5f, y, 0f, 1f, y+0.5f, 1f), - VoxelShapes.cuboid(0f, y, 0.5f, 0.5f, y+0.5f, 1f) + base, + VoxelShapes.cuboid(0.5f, y, 0f, 1f, y + 0.5f, 1f), + VoxelShapes.cuboid(0f, y, 0.5f, 0.5f, y + 0.5f, 1f) ), // original Direction.SOUTH, VoxelShapes.union( - VoxelShapes.cuboid(0f, y, 0f, 0.5f, y+0.5f, 1f), - VoxelShapes.cuboid(0.5f, y, 0f, 1f, y+0.5f, 0.5f) + base, + VoxelShapes.cuboid(0f, y, 0f, 0.5f, y + 0.5f, 1f), + VoxelShapes.cuboid(0.5f, y, 0f, 1f, y + 0.5f, 0.5f) ), // reverse original Direction.EAST, VoxelShapes.union( - VoxelShapes.cuboid(0f, y, 0.5f, 1f, y+0.5f, 1f), - VoxelShapes.cuboid(0f, y, 0f, 0.5f, y+0.5f, 0.5f) + base, + VoxelShapes.cuboid(0f, y, 0.5f, 1f, y + 0.5f, 1f), + VoxelShapes.cuboid(0f, y, 0f, 0.5f, y + 0.5f, 0.5f) ), // swap x <-> z + reverse - Direction.WEST, VoxelShapes.union( - VoxelShapes.cuboid(0f, y, 0f, 1f, y+0.5f, 0.5f), - VoxelShapes.cuboid(0.5f, y, 0.5f, 1f, y+0.5f, 1f) + Direction.WEST, VoxelShapes.union( + base, + VoxelShapes.cuboid(0f, y, 0f, 1f, y + 0.5f, 0.5f), + VoxelShapes.cuboid(0.5f, y, 0.5f, 1f, y + 0.5f, 1f) ) // swap x <-> z ); } + static { + final Map bottomVoxelShape = getVoxelShapeMapOfY(0.5f); + final Map topVoxelShape = getVoxelShapeMapOfY(0f); + + voxelShapeBottomNorth = bottomVoxelShape.get(Direction.NORTH); + voxelShapeBottomSouth = bottomVoxelShape.get(Direction.SOUTH); + voxelShapeBottomEast = bottomVoxelShape.get(Direction.EAST); + voxelShapeBottomWest = bottomVoxelShape.get(Direction.WEST); + + voxelShapeTopNorth = topVoxelShape.get(Direction.NORTH); + voxelShapeTopSouth = topVoxelShape.get(Direction.SOUTH); + voxelShapeTopEast = topVoxelShape.get(Direction.EAST); + voxelShapeTopWest = topVoxelShape.get(Direction.WEST); + } public InnerStairs(Settings settings) { super(settings); @@ -42,8 +72,37 @@ public InnerStairs(Settings settings) { @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { Direction dir = state.get(FACING); - return state.get(Properties.BLOCK_HALF) == BlockHalf.TOP - ? topVoxelShape.get(dir) - : bottomVoxelShape.get(dir); + if (state.get(Properties.BLOCK_HALF) == BlockHalf.BOTTOM) { + switch (dir) { + case NORTH -> { + return voxelShapeBottomNorth; + } + case SOUTH -> { + return voxelShapeBottomSouth; + } + case EAST -> { + return voxelShapeBottomEast; + } + case WEST -> { + return voxelShapeBottomWest; + } + } + } else { + switch (dir) { + case NORTH -> { + return voxelShapeTopNorth; + } + case SOUTH -> { + return voxelShapeTopSouth; + } + case EAST -> { + return voxelShapeTopEast; + } + case WEST -> { + return voxelShapeTopWest; + } + } + } + return VoxelShapes.fullCube(); // Fallback, should not happen } } diff --git a/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/OuterStairs.java b/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/OuterStairs.java index 83a0d618..e0078613 100644 --- a/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/OuterStairs.java +++ b/src/main/java/io/github/mikip98/humilityafm/content/blocks/stairs/OuterStairs.java @@ -17,15 +17,21 @@ import java.util.Map; public class OuterStairs extends HorizontalFacingBlock implements Waterloggable { - protected static final Map bottomVoxelShape = getVoxelShapeMapOfY( - VoxelShapes.cuboid(0f, 0f, 0f, 1f, 0.5f, 1.0f), - 0.5f - ); - protected static final Map topVoxelShape = getVoxelShapeMapOfY( - VoxelShapes.cuboid(0f, 0.5f, 0f, 1f, 1f, 1.0f), - 0f - ); - protected static Map getVoxelShapeMapOfY(VoxelShape base, double y) { + protected static final VoxelShape voxelShapeBottomNorth; + protected static final VoxelShape voxelShapeBottomSouth; + protected static final VoxelShape voxelShapeBottomEast; + protected static final VoxelShape voxelShapeBottomWest; + + protected static final VoxelShape voxelShapeTopNorth; + protected static final VoxelShape voxelShapeTopSouth; + protected static final VoxelShape voxelShapeTopEast; + protected static final VoxelShape voxelShapeTopWest; + + protected static Map getVoxelShapeMapOfY(double y) { + VoxelShape base = VoxelShapes.cuboid( + 0f, 0.5f - y, 0f, + 1f, 1f - y, 1f + ); return Map.of( Direction.NORTH, VoxelShapes.union(base, VoxelShapes.cuboid(0.5f, y, 0.5f, 1.0f, y+0.5f, 1.0f)), // original Direction.SOUTH, VoxelShapes.union(base, VoxelShapes.cuboid(0.0f, y, 0.0f, 0.5f, y+0.5f, 0.5f)), // reverse original @@ -33,6 +39,20 @@ protected static Map getVoxelShapeMapOfY(VoxelShape base, Direction.WEST, VoxelShapes.union(base, VoxelShapes.cuboid(0.5f, y, 0.0f, 1.0f, y+0.5f, 0.5f)) // swap x <-> z ); } + static { + final Map bottomVoxelShape = getVoxelShapeMapOfY(0.5f); + final Map topVoxelShape = getVoxelShapeMapOfY(0f); + + voxelShapeBottomNorth = bottomVoxelShape.get(Direction.NORTH); + voxelShapeBottomSouth = bottomVoxelShape.get(Direction.SOUTH); + voxelShapeBottomEast = bottomVoxelShape.get(Direction.EAST); + voxelShapeBottomWest = bottomVoxelShape.get(Direction.WEST); + + voxelShapeTopNorth = topVoxelShape.get(Direction.NORTH); + voxelShapeTopSouth = topVoxelShape.get(Direction.SOUTH); + voxelShapeTopEast = topVoxelShape.get(Direction.EAST); + voxelShapeTopWest = topVoxelShape.get(Direction.WEST); + } public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; @@ -69,8 +89,29 @@ public FluidState getFluidState(BlockState state) { @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { Direction dir = state.get(FACING); - return state.get(Properties.BLOCK_HALF) == BlockHalf.TOP - ? topVoxelShape.get(dir) - : bottomVoxelShape.get(dir); + if (state.get(Properties.BLOCK_HALF) == BlockHalf.BOTTOM) { + switch (dir) { + case NORTH: + return voxelShapeBottomNorth; + case SOUTH: + return voxelShapeBottomSouth; + case EAST: + return voxelShapeBottomEast; + case WEST: + return voxelShapeBottomWest; + } + } else { + switch (dir) { + case NORTH: + return voxelShapeTopNorth; + case SOUTH: + return voxelShapeTopSouth; + case EAST: + return voxelShapeTopEast; + case WEST: + return voxelShapeTopWest; + } + } + return VoxelShapes.fullCube(); // Fallback, should not happen } }