diff --git a/src/main/java/systems/alexander/bellsandwhistles/block/ModBlocks.java b/src/main/java/systems/alexander/bellsandwhistles/block/ModBlocks.java index e28f434..61976d6 100644 --- a/src/main/java/systems/alexander/bellsandwhistles/block/ModBlocks.java +++ b/src/main/java/systems/alexander/bellsandwhistles/block/ModBlocks.java @@ -1,6 +1,7 @@ package systems.alexander.bellsandwhistles.block; import com.simibubi.create.content.decoration.TrainTrapdoorBlock; +import com.simibubi.create.content.decoration.copycat.CopycatPanelBlock; import com.simibubi.create.content.decoration.encasing.CasingBlock; import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlock; import com.tterrag.registrate.builders.BlockBuilder; @@ -55,7 +56,6 @@ public static NonNullFunction, BlockBuil () -> new SlidingDoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion(), false)); public static final RegistryObject FOLDING_METRO_DOOR = registerBlock("folding_metro_door", () -> new SlidingDoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion(), true)); - public static final RegistryObject METRO_TRAPDOOR = registerBlock("metro_trapdoor", () -> new TrainTrapdoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion())); diff --git a/src/main/java/systems/alexander/bellsandwhistles/block/custom/PanelBlock.java b/src/main/java/systems/alexander/bellsandwhistles/block/custom/PanelBlock.java index acb5699..7b739ed 100644 --- a/src/main/java/systems/alexander/bellsandwhistles/block/custom/PanelBlock.java +++ b/src/main/java/systems/alexander/bellsandwhistles/block/custom/PanelBlock.java @@ -1,6 +1,7 @@ package systems.alexander.bellsandwhistles.block.custom; import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllShapes; import com.simibubi.create.content.decoration.copycat.CopycatBlockEntity; import com.simibubi.create.content.decoration.copycat.CopycatPanelBlock; import com.simibubi.create.content.decoration.copycat.CopycatSpecialCases; @@ -23,7 +24,10 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.List; import java.util.function.Predicate; @@ -31,6 +35,9 @@ public class PanelBlock extends Block { public static final DirectionProperty FACING = BlockStateProperties.FACING; + protected static final int AABB_THICKNESS = 3; + + private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper()); public PanelBlock(Properties pProperties) { @@ -38,7 +45,7 @@ public PanelBlock(Properties pProperties) { registerDefaultState(defaultBlockState().setValue(FACING, Direction.UP)); } public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) { - return Blocks.STONE.defaultBlockState(); + return Blocks.MOSSY_COBBLESTONE.defaultBlockState(); } public boolean canFaceBeOccluded(BlockState state, Direction face) { return state.getValue(FACING) @@ -81,6 +88,10 @@ public boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState sta } + + + + public static boolean isOccluded(BlockState state, BlockState other, Direction pDirection) { Direction facing = state.getValue(FACING); if (facing.getOpposite() == other.getValue(FACING) && pDirection == facing) @@ -95,6 +106,12 @@ public BlockState rotate(BlockState state, Rotation rot) { return state.setValue(FACING, rot.rotate(state.getValue(FACING))); } + @Override + public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + return AllShapes.CASING_3PX.get(pState.getValue(FACING)); + } + + @Override @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, Mirror mirrorIn) { diff --git a/src/main/resources/assets/bellsandwhistles/blockstates/corrugated_metro_panel.json b/src/main/resources/assets/bellsandwhistles/blockstates/corrugated_metro_panel.json new file mode 100644 index 0000000..b58fde6 --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/blockstates/corrugated_metro_panel.json @@ -0,0 +1,26 @@ +{ + "variants": { + "facing=down": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_bottom", + "x": 180 + }, + "facing=east": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_side", + "y": 270 + }, + "facing=north": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_side", + "y": 180 + }, + "facing=south": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_side" + }, + "facing=up": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_bottom" + }, + "facing=west": { + "model": "bellsandwhistles:block/metro/corrugated_panel/block_side", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/blockstates/metro_panel.json b/src/main/resources/assets/bellsandwhistles/blockstates/metro_panel.json new file mode 100644 index 0000000..24ecc92 --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/blockstates/metro_panel.json @@ -0,0 +1,26 @@ +{ + "variants": { + "facing=down": { + "model": "bellsandwhistles:block/metro/panel/block_bottom", + "x": 180 + }, + "facing=east": { + "model": "bellsandwhistles:block/metro/panel/block_side", + "y": 270 + }, + "facing=north": { + "model": "bellsandwhistles:block/metro/panel/block_side", + "y": 180 + }, + "facing=south": { + "model": "bellsandwhistles:block/metro/panel/block_side" + }, + "facing=up": { + "model": "bellsandwhistles:block/metro/panel/block_bottom" + }, + "facing=west": { + "model": "bellsandwhistles:block/metro/panel/block_side", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_metro_casing.json b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_metro_casing.json index fcf502d..b947084 100644 --- a/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_metro_casing.json +++ b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_metro_casing.json @@ -1,6 +1,22 @@ { - "parent": "minecraft:block/cube_all", - "textures": { - "all": "bellsandwhistles:metro/corrugated_metro" - } + "credit": "Made with Blockbench", + "textures": { + "0": "bellsandwhistles:block/metro/corrugated_metro", + "1": "bellsandwhistles:block/metro/metro", + "particle": "bellsandwhistles:block/metro/corrugated_metro" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [16, 0, 0, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_bottom.json b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_bottom.json new file mode 100644 index 0000000..e89f987 --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_bottom.json @@ -0,0 +1,23 @@ +{ + "parent": "block/block", + "credit": "Made with Blockbench", + "textures": { + "0": "bellsandwhistles:block/metro/corrugated_panel_side", + "1": "bellsandwhistles:block/metro/corrugated_metro", + "particle": "bellsandwhistles:block/metro/corrugated_metro" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 3, 16], + "faces": { + "north": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_side.json b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_side.json new file mode 100644 index 0000000..da0c67a --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/models/block/metro/corrugated_panel/block_side.json @@ -0,0 +1,23 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "bellsandwhistles:block/metro/corrugated_panel_side", + "1": "bellsandwhistles:block/metro/corrugated_metro", + "particle": "bellsandwhistles:block/metro/corrugated_metro" + }, + "elements": [ + { + "from": [0, 0, 13], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "east": {"uv": [0, 0, 16, 3], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "west": {"uv": [0, 0, 16, 3], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 3], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_bottom.json b/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_bottom.json new file mode 100644 index 0000000..bb05414 --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_bottom.json @@ -0,0 +1,23 @@ +{ + "parent": "block/block", + "credit": "Made with Blockbench", + "textures": { + "0": "bellsandwhistles:block/metro/panel_side", + "1": "bellsandwhistles:block/metro/metro", + "particle": "bellsandwhistles:block/metro/metro" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 3, 16], + "faces": { + "north": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_side.json b/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_side.json new file mode 100644 index 0000000..0404455 --- /dev/null +++ b/src/main/resources/assets/bellsandwhistles/models/block/metro/panel/block_side.json @@ -0,0 +1,23 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "bellsandwhistles:block/metro/panel_side", + "1": "bellsandwhistles:block/metro/metro", + "particle": "bellsandwhistles:block/metro/metro" + }, + "elements": [ + { + "from": [0, 0, 13], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "east": {"uv": [0, 0, 16, 3], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "west": {"uv": [0, 0, 16, 3], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 16, 3], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 3], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/bellsandwhistles/textures/block/metro/corrugated_panel_side.png b/src/main/resources/assets/bellsandwhistles/textures/block/metro/corrugated_panel_side.png new file mode 100644 index 0000000..bf24ab9 Binary files /dev/null and b/src/main/resources/assets/bellsandwhistles/textures/block/metro/corrugated_panel_side.png differ diff --git a/src/main/resources/assets/bellsandwhistles/textures/block/metro/panel_side.png b/src/main/resources/assets/bellsandwhistles/textures/block/metro/panel_side.png new file mode 100644 index 0000000..a65b79e Binary files /dev/null and b/src/main/resources/assets/bellsandwhistles/textures/block/metro/panel_side.png differ