From d44fb3ca9a9f9ecd398c21a2cd3f7d99cdff554a Mon Sep 17 00:00:00 2001 From: TGGamesYT Date: Wed, 25 Mar 2026 15:34:18 +0100 Subject: [PATCH] blueprint small fix --- gradle.properties | 2 +- .../client/BlueprintBlockEntityRenderer.java | 107 +++++++++++------- .../dev/tggamesyt/szar/BlueprintBehavior.java | 5 +- .../tggamesyt/szar/BlueprintBlockEntity.java | 16 ++- .../dev/tggamesyt/szar/BlueprintBlocks.java | 62 +++++----- .../tggamesyt/szar/BlueprintDoorBlock.java | 2 +- .../tggamesyt/szar/BlueprintFenceBlock.java | 2 +- .../tggamesyt/szar/BlueprintSlabBlock.java | 2 +- .../tggamesyt/szar/BlueprintStairsBlock.java | 2 +- .../szar/BlueprintTrapDoorBlock.java | 2 +- .../tggamesyt/szar/BlueprintWallBlock.java | 2 +- .../szar/blockstates/blueprint_wall.json | 23 +--- .../assets/szar/textures/block/blueprint.png | Bin 0 -> 873 bytes 13 files changed, 123 insertions(+), 104 deletions(-) create mode 100644 src/main/resources/assets/szar/textures/block/blueprint.png diff --git a/gradle.properties b/gradle.properties index 19910ca..2c62248 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.18.3 # Mod Properties -mod_version=26.3.25 +mod_version=26.3.25.1 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java b/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java index 07cb1fd..ef43a74 100644 --- a/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java +++ b/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java @@ -11,6 +11,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; +import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; public class BlueprintBlockEntityRenderer implements BlockEntityRenderer { @@ -31,43 +32,19 @@ public class BlueprintBlockEntityRenderer implements BlockEntityRenderer type, BlockPos pos, BlockState state) { - super(type, pos, state); + public BlueprintBlockEntity(BlockPos pos, BlockState state) { + super(getBEType(state), pos, state); + } + + private static BlockEntityType getBEType(BlockState state) { + Block block = state.getBlock(); + if (block instanceof BlueprintStairsBlock) return BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE; + if (block instanceof BlueprintSlabBlock) return BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE; + if (block instanceof BlueprintDoorBlock) return BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE; + if (block instanceof BlueprintTrapDoorBlock) return BlueprintBlocks.BLUEPRINT_TRAPDOOR_BE_TYPE; + if (block instanceof BlueprintWallBlock) return BlueprintBlocks.BLUEPRINT_WALL_BE_TYPE; + if (block instanceof BlueprintFenceBlock) return BlueprintBlocks.BLUEPRINT_FENCE_BE_TYPE; + throw new IllegalStateException("Unknown blueprint block: " + block); } public boolean hasStoredBlock() { diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java b/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java index 7767245..e769228 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java @@ -4,6 +4,7 @@ import dev.tggamesyt.szar.Szar; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; +import net.minecraft.block.Blocks; import net.minecraft.block.MapColor; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.BlockItem; @@ -38,47 +39,44 @@ public class BlueprintBlocks { public static final BlueprintWallBlock BLUEPRINT_WALL = Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_wall"), - new BlueprintWallBlock(settings())); + new BlueprintWallBlock(AbstractBlock.Settings.copy(Blocks.STONE_BRICK_WALL))); public static final BlueprintFenceBlock BLUEPRINT_FENCE = Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_fence"), - new BlueprintFenceBlock(settings())); + new BlueprintFenceBlock(AbstractBlock.Settings.copy(Blocks.OAK_FENCE))); - public static final BlockEntityType BLUEPRINT_STAIRS_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_stairs_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_STAIRS).build()); + public static final BlockEntityType BLUEPRINT_STAIRS_BE_TYPE; + public static final BlockEntityType BLUEPRINT_SLAB_BE_TYPE; + public static final BlockEntityType BLUEPRINT_DOOR_BE_TYPE; + public static final BlockEntityType BLUEPRINT_TRAPDOOR_BE_TYPE; + public static final BlockEntityType BLUEPRINT_WALL_BE_TYPE; + public static final BlockEntityType BLUEPRINT_FENCE_BE_TYPE; - public static final BlockEntityType BLUEPRINT_SLAB_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_slab_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_SLAB).build()); + static { + BLUEPRINT_STAIRS_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_stairs_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_STAIRS).build()); - public static final BlockEntityType BLUEPRINT_DOOR_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_door_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_DOOR).build()); + BLUEPRINT_SLAB_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_slab_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_SLAB).build()); - public static final BlockEntityType BLUEPRINT_TRAPDOOR_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_trapdoor_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_TRAPDOOR).build()); + BLUEPRINT_DOOR_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_door_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_DOOR).build()); - public static final BlockEntityType BLUEPRINT_WALL_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_wall_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_WALL).build()); + BLUEPRINT_TRAPDOOR_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_trapdoor_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_TRAPDOOR).build()); - public static final BlockEntityType BLUEPRINT_FENCE_BE_TYPE = - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_fence_be"), - FabricBlockEntityTypeBuilder.create( - (pos, state) -> new BlueprintBlockEntity(null, pos, state), - BLUEPRINT_FENCE).build()); + BLUEPRINT_WALL_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_wall_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_WALL).build()); + + BLUEPRINT_FENCE_BE_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, + new Identifier(Szar.MOD_ID, "blueprint_fence_be"), + FabricBlockEntityTypeBuilder.create(BlueprintBlockEntity::new, BLUEPRINT_FENCE).build()); + } public static final BlockItem BLUEPRINT_STAIRS_ITEM = Registry.register(Registries.ITEM, new Identifier(Szar.MOD_ID, "blueprint_stairs"), new BlockItem(BLUEPRINT_STAIRS, new Item.Settings())); diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java index 605d898..248cb6b 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java @@ -19,7 +19,7 @@ public class BlueprintDoorBlock extends DoorBlock implements BlockEntityProvider @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java index 3e3fdd3..017e299 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java @@ -18,7 +18,7 @@ public class BlueprintFenceBlock extends FenceBlock implements BlockEntityProvid @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_FENCE_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java index b52501f..793888f 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java @@ -18,7 +18,7 @@ public class BlueprintSlabBlock extends SlabBlock implements BlockEntityProvider @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java index 9cff796..e77d8c0 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java @@ -18,7 +18,7 @@ public class BlueprintStairsBlock extends StairsBlock implements BlockEntityProv @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java index 0355eb2..eb871da 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java @@ -18,7 +18,7 @@ public class BlueprintTrapDoorBlock extends TrapdoorBlock implements BlockEntity @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_TRAPDOOR_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java index 4b965dd..734b4ed 100644 --- a/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java +++ b/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java @@ -18,7 +18,7 @@ public class BlueprintWallBlock extends WallBlock implements BlockEntityProvider @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_WALL_BE_TYPE, pos, state); + return new BlueprintBlockEntity(pos, state); } @Override diff --git a/src/main/resources/assets/szar/blockstates/blueprint_wall.json b/src/main/resources/assets/szar/blockstates/blueprint_wall.json index 1a87b92..d41c07f 100644 --- a/src/main/resources/assets/szar/blockstates/blueprint_wall.json +++ b/src/main/resources/assets/szar/blockstates/blueprint_wall.json @@ -1,22 +1,9 @@ { "multipart": [ - { "apply": { "model": "szar:block/blueprint_wall_post" }, - "when": { "up": "true" } }, - { "apply": { "model": "szar:block/blueprint_wall_side", "uvlock": true }, - "when": { "north": "low" } }, - { "apply": { "model": "szar:block/blueprint_wall_side", "y": 90, "uvlock": true }, - "when": { "east": "low" } }, - { "apply": { "model": "szar:block/blueprint_wall_side", "y": 180, "uvlock": true }, - "when": { "south": "low" } }, - { "apply": { "model": "szar:block/blueprint_wall_side", "y": 270, "uvlock": true }, - "when": { "west": "low" } }, - { "apply": { "model": "szar:block/blueprint_wall_side_tall", "uvlock": true }, - "when": { "north": "tall" } }, - { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 90, "uvlock": true }, - "when": { "east": "tall" } }, - { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 180, "uvlock": true }, - "when": { "south": "tall" } }, - { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 270, "uvlock": true }, - "when": { "west": "tall" } } + { "apply": { "model": "szar:block/blueprint_wall_post" } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "uvlock": true } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 90, "uvlock": true } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 180, "uvlock": true } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 270, "uvlock": true } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/szar/textures/block/blueprint.png b/src/main/resources/assets/szar/textures/block/blueprint.png new file mode 100644 index 0000000000000000000000000000000000000000..e05ab79ed7b3bc2a105a5757f1429f8c7cd243e5 GIT binary patch literal 873 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~q!3HGX7W?Z1DaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheoCO|{#S9F5he4R}c>anMpoaF$kcg59UmvUF{9L`nl>DSry^7odplSvN z8~cia#N_PM5{0DH^vpb4_4m8?t1D!t*s6z{`WpBaIHzW0dQ=sq23ProBv)l8Tc)Vn z+wpSQR9FE`$W1LtRH(?!$t$+1uvG#ZYz1V4g!Pr|Y>HCStb$zJpeleoTcwPWk^(Dz z{qpj1y>er{{GxPyLrY6beFGzXBO_g)3fd$_#E`lw^ClIEGmGmrmNBbtpij-9GkR5i2K)C_87w1hIA} z$L)N2vcI`xe<{`W*g3~9bT*%w*JQz=$Y|&|iR+}0xb+d?{7K((zR&wScmMulpS$b% z4w;7S_O3T!NZ9_dqn|PGNpbn_mgo9`UdHqMxa1u~ewySi4{iSbaGH)c3h7d))=rMV=LBc{nS$Y;8$_uwP`%0ioAFy&GcK z>vJR0ShAQVM<~QE+Ud~v{oyu~V$m?K=T;UwJUQ8Jv`0_5WE$Z!C34QimhjK6FXt@d zTXOkh2~$DnB2I57z2!!w0arO49;bb(yLQXT=b732{8=yAf3Qw9=Mr9|r(F$7@1CxH JF6*2UngF%bLbLz? literal 0 HcmV?d00001