diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index ef34dee..768c4bd 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -41,7 +41,7 @@ public class ReFramed implements ModInitializer { CUBE, SMALL_CUBE, SMALL_CUBES_STEP, STAIR, STAIRS_CUBE, - HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, + HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, HALF_STAIRS_CUBE_STAIR, HALF_STAIRS_STEP_STAIR, SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, STEP, STEPS_SLAB, STEPS_CROSS, LAYER, @@ -62,38 +62,41 @@ public class ReFramed implements ModInitializer { @Override public void onInitialize() { - CUBE = registerBlock("cube" , new ReFramedBlock(cp(Blocks.OAK_PLANKS))); - SMALL_CUBE = registerBlock("small_cube" , new ReFramedSmallCubeBlock(cp(Blocks.OAK_PLANKS))); - SMALL_CUBES_STEP = registerBlock("small_cubes_step" , new ReFramedSmallCubesStepBlock(cp(Blocks.OAK_PLANKS))); - STAIR = registerBlock("stair" , new ReFramedStairBlock(cp(Blocks.OAK_STAIRS))); - STAIRS_CUBE = registerBlock("stairs_cube" , new ReFramedStairsCubeBlock(cp(Blocks.OAK_STAIRS))); - HALF_STAIR = registerBlock("half_stair" , new ReFramedHalfStairBlock(cp(Blocks.OAK_STAIRS))); - HALF_STAIRS_SLAB = registerBlock("half_stairs_slab" , new ReFramedHalfStairsSlabBlock(cp(Blocks.OAK_STAIRS))); - HALF_STAIRS_STAIR = registerBlock("half_stairs_stair" , new ReFramedHalfStairsStairBlock(cp(Blocks.OAK_STAIRS))); - LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB))); - SLAB = registerBlock("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB))); - SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(cp(Blocks.OAK_SLAB))); - SLABS_STAIR = registerBlock("slabs_stair" , new ReFramedSlabsStairBlock(cp(Blocks.OAK_STAIRS))); - SLABS_OUTER_STAIR = registerBlock("slabs_outer_stair" , new ReFramedSlabsOuterStairBlock(cp(Blocks.OAK_STAIRS))); - SLABS_INNER_STAIR = registerBlock("slabs_inner_stair" , new ReFramedSlabsInnerStairBlock(cp(Blocks.OAK_STAIRS))); - STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB))); - STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB))); - STEPS_CROSS = registerBlock("steps_cross" , new ReFramedStepsCrossBlock(cp(Blocks.OAK_SLAB))); - PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE))); - PILLARS_WALL = registerBlock("pillars_wall" , new ReFramedPillarsWallBlock(cp(Blocks.OAK_FENCE))); - WALL = registerBlock("wall" , new ReFramedWallBlock(cp(Blocks.OAK_FENCE))); - PANE = registerBlock("pane" , new ReFramedPaneBlock(cp(Blocks.OAK_FENCE))); - TRAPDOOR = registerBlock("trapdoor" , new ReFramedTrapdoorBlock(cp(Blocks.OAK_TRAPDOOR))); - DOOR = registerBlock("door" , new ReFramedDoorBlock(cp(Blocks.OAK_DOOR))); - BUTTON = registerBlock("button" , new ReFramedButtonBlock(cp(Blocks.OAK_BUTTON))); - POST = registerBlock("post" , new ReFramedPostBlock(cp(Blocks.OAK_FENCE))); - FENCE = registerBlock("fence" , new ReFramedFenceBlock(cp(Blocks.OAK_FENCE))); - POST_FENCE = registerBlock("post_fence" , new ReFramedPostFenceBlock(cp(Blocks.OAK_FENCE))); + CUBE = registerBlock("cube" , new ReFramedBlock(cp(Blocks.OAK_PLANKS))); + SMALL_CUBE = registerBlock("small_cube" , new ReFramedSmallCubeBlock(cp(Blocks.OAK_PLANKS))); + SMALL_CUBES_STEP = registerBlock("small_cubes_step" , new ReFramedSmallCubesStepBlock(cp(Blocks.OAK_PLANKS))); + STAIR = registerBlock("stair" , new ReFramedStairBlock(cp(Blocks.OAK_STAIRS))); + STAIRS_CUBE = registerBlock("stairs_cube" , new ReFramedStairsCubeBlock(cp(Blocks.OAK_STAIRS))); + HALF_STAIR = registerBlock("half_stair" , new ReFramedHalfStairBlock(cp(Blocks.OAK_STAIRS))); + HALF_STAIRS_SLAB = registerBlock("half_stairs_slab" , new ReFramedHalfStairsSlabBlock(cp(Blocks.OAK_STAIRS))); + HALF_STAIRS_STAIR = registerBlock("half_stairs_stair" , new ReFramedHalfStairsStairBlock(cp(Blocks.OAK_STAIRS))); + HALF_STAIRS_CUBE_STAIR = registerBlock("half_stairs_cube_stair" , new ReFramedHalfStairsCubeStairBlock(cp(Blocks.OAK_STAIRS))); + HALF_STAIRS_STEP_STAIR = registerBlock("half_stairs_step_stair" , new ReFramedHalfStairsStepStairBlock(cp(Blocks.OAK_STAIRS))); + LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB))); + SLAB = registerBlock("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB))); + SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(cp(Blocks.OAK_SLAB))); + SLABS_STAIR = registerBlock("slabs_stair" , new ReFramedSlabsStairBlock(cp(Blocks.OAK_STAIRS))); + SLABS_OUTER_STAIR = registerBlock("slabs_outer_stair" , new ReFramedSlabsOuterStairBlock(cp(Blocks.OAK_STAIRS))); + SLABS_INNER_STAIR = registerBlock("slabs_inner_stair" , new ReFramedSlabsInnerStairBlock(cp(Blocks.OAK_STAIRS))); + STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB))); + STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB))); + STEPS_CROSS = registerBlock("steps_cross" , new ReFramedStepsCrossBlock(cp(Blocks.OAK_SLAB))); + PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE))); + PILLARS_WALL = registerBlock("pillars_wall" , new ReFramedPillarsWallBlock(cp(Blocks.OAK_FENCE))); + WALL = registerBlock("wall" , new ReFramedWallBlock(cp(Blocks.OAK_FENCE))); + PANE = registerBlock("pane" , new ReFramedPaneBlock(cp(Blocks.OAK_FENCE))); + TRAPDOOR = registerBlock("trapdoor" , new ReFramedTrapdoorBlock(cp(Blocks.OAK_TRAPDOOR))); + DOOR = registerBlock("door" , new ReFramedDoorBlock(cp(Blocks.OAK_DOOR))); + BUTTON = registerBlock("button" , new ReFramedButtonBlock(cp(Blocks.OAK_BUTTON))); + POST = registerBlock("post" , new ReFramedPostBlock(cp(Blocks.OAK_FENCE))); + FENCE = registerBlock("fence" , new ReFramedFenceBlock(cp(Blocks.OAK_FENCE))); + POST_FENCE = registerBlock("post_fence" , new ReFramedPostFenceBlock(cp(Blocks.OAK_FENCE))); + + HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1))); + SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1))); + BLUEPRINT = registerItem("blueprint" , new ReFramedBlueprintItem(new Item.Settings())); + BLUEPRINT_WRITTEN = registerItem("blueprint_written" , new ReFramedBlueprintWrittenItem(new Item.Settings().maxCount(1))); - HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1))); - SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1))); - BLUEPRINT = registerItem("blueprint" , new ReFramedBlueprintItem(new Item.Settings())); - BLUEPRINT_WRITTEN = registerItem("blueprint_written" , new ReFramedBlueprintWrittenItem(new Item.Settings().maxCount(1))); REFRAMED_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("camo"), FabricBlockEntityTypeBuilder.create( diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index e2eb626..2873cb3 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -45,38 +45,35 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { @Override @SuppressWarnings("deprecation") public boolean canReplace(BlockState state, ItemPlacementContext context) { - if (context.getPlayer() == null) return false; - Direction dir = state.get(CORNER).getDirection(state.get(CORNER_FACE)); - return !( - context.getPlayer().isSneaking() - || !(context.getStack().getItem() instanceof BlockItem block_item) - || ( - !( - block_item.getBlock() == this - && ReFramed.HALF_STAIRS_STAIR - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.HALF_STAIRS_STAIR.getDefaultState() - .with(EDGE, state.get(CORNER).getEdge(dir)), - dir.getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - ) - ) - && !( - block_item.getBlock() == ReFramed.SMALL_CUBE - && BlockHelper.cursorMatchesFace( - ReFramed.SMALL_CUBE.getOutlineShape( - ReFramed.SMALL_CUBE.getDefaultState() - .with(CORNER, state.get(CORNER).getOpposite(state.get(CORNER_FACE))), - context.getWorld(), - context.getBlockPos(), - ShapeContext.absent() - ), - BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) - ) - ) - ) - ); + if (context.getPlayer() == null + || context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + ) return false; + + // allow replacing with slab, step, small cube and half stair + Block block = block_item.getBlock(); + Corner corner = state.get(CORNER); + Direction dir = corner.getDirection(state.get(CORNER_FACE)); + if (block == this || block == ReFramed.STEP) + return ReFramed.HALF_STAIRS_STAIR.matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.HALF_STAIRS_STAIR.getDefaultState().with(EDGE, corner.getEdge(dir)), + dir.getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 + ); + + if (block == ReFramed.SMALL_CUBE) + return ReFramed.SMALL_CUBE.matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.SMALL_CUBE.getDefaultState().with(CORNER, corner.change(dir)) + ) || ReFramed.SMALL_CUBE.matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.SMALL_CUBE.getDefaultState().with(CORNER, corner.getOpposite(dir)) + ); + + return false; } @Override @@ -94,7 +91,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { return ReFramed.HALF_STAIRS_STAIR.getDefaultState() .with(EDGE, current_state.get(CORNER).getEdge(current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE)))) .with(WATERLOGGED, current_state.get(WATERLOGGED)); - else if (current_state.isOf(ReFramed.SLAB)) { + if (current_state.isOf(ReFramed.SLAB)) { Corner corner = BlockHelper.getPlacementCorner(ctx); Direction face = current_state.get(FACING); if (!corner.hasDirection(face)) corner = corner.change(face.getOpposite()); @@ -134,7 +131,10 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { @Override public Map getThemeMap(BlockState state, BlockState new_state) { - if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB)) return Map.of(1, 1); + if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB) + || new_state.isOf(ReFramed.HALF_STAIRS_CUBE_STAIR) + || new_state.isOf(ReFramed.HALF_STAIRS_STEP_STAIR) + ) return Map.of(1, 1); if (new_state.isOf(ReFramed.HALF_STAIRS_STAIR)) return Map.of( 1, diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsCubeStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsCubeStairBlock.java new file mode 100644 index 0000000..ae507c3 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsCubeStairBlock.java @@ -0,0 +1,48 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.Corner; +import fr.adrien1106.reframed.util.blocks.Edge; +import fr.adrien1106.reframed.util.blocks.StairShape; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; + +import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape; +import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.getSmallCubeShape; +import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE; + +public class ReFramedHalfStairsCubeStairBlock extends CornerDoubleReFramedBlock { + + public ReFramedHalfStairsCubeStairBlock(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + Corner corner = state.get(CORNER); + Direction face = corner.getDirection(state.get(CORNER_FACE)); + Edge edge = corner.getEdge(face); + return getStairShape( + edge, + face.getDirection() == Direction.AxisDirection.POSITIVE + ? StairShape.OUTER_LEFT + : StairShape.OUTER_RIGHT + ); + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Corner corner = state.get(CORNER); + Direction face = corner.getDirection(state.get(CORNER_FACE)); + if (i == 2) corner = corner.change(face); + return i == 2 + ? getSmallCubeShape(corner) + : getHalfStairShape(corner, state.get(CORNER_FACE)); + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStepStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStepStairBlock.java new file mode 100644 index 0000000..385020d --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStepStairBlock.java @@ -0,0 +1,76 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Corner; +import fr.adrien1106.reframed.util.blocks.Edge; +import fr.adrien1106.reframed.util.blocks.StairShape; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import org.jetbrains.annotations.Nullable; + +import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape; +import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; +import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; + +public class ReFramedHalfStairsStepStairBlock extends CornerDoubleReFramedBlock { + + public ReFramedHalfStairsStepStairBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(CORNER_FEATURE, 0)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(CORNER_FEATURE)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState state = super.getPlacementState(ctx); + Corner corner = state.get(CORNER); + int face_index = state.get(CORNER_FACE); + Direction face = corner.getDirection(face_index); + face = BlockHelper.getPlacementEdge(ctx).getOtherDirection(face); + int feature_index = corner.getDirectionIndex(face); + return state.with(CORNER_FEATURE, feature_index > face_index ? feature_index - 1 : feature_index); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + Corner corner = state.get(CORNER); + int feature_index = state.get(CORNER_FEATURE), face_index = state.get(CORNER_FACE); + Direction feature_face = corner.getDirection(feature_index >= face_index ? feature_index + 1 : feature_index); + Direction face = corner.getDirection(face_index); + Edge edge = Edge.getByDirections(feature_face, face); + return getStairShape( + edge, + corner.getOtherDirection(edge).getDirection() == Direction.AxisDirection.POSITIVE + ? edge.getDirectionIndex(face) == 0 + ? StairShape.FIRST_OUTER_LEFT + : StairShape.SECOND_OUTER_LEFT + : edge.getDirectionIndex(face) == 0 + ? StairShape.FIRST_OUTER_RIGHT + : StairShape.SECOND_OUTER_RIGHT + ); + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Corner corner = state.get(CORNER); + int feature_index = state.get(CORNER_FEATURE), face_index = state.get(CORNER_FACE); + Direction feature_face = corner.getDirection(feature_index >= face_index ? feature_index + 1 : feature_index); + Direction face = corner.getDirection(face_index); + return i == 2 + ? getStepShape(Edge.getByDirections(face.getOpposite(), feature_face)) + : getHalfStairShape(corner, face_index); + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 7ff057a..b939931 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -49,10 +49,11 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { ) return false; // allow replacing with slab, step, small cube and half stair - if (block_item.getBlock() != this - && block_item.getBlock() != ReFramed.STEP - && block_item.getBlock() != ReFramed.SMALL_CUBE - && block_item.getBlock() != ReFramed.HALF_STAIR + Block block = block_item.getBlock(); + if (block != this + && block != ReFramed.STEP + && block != ReFramed.SMALL_CUBE + && block != ReFramed.HALF_STAIR ) return false; // check if the player is clicking on the inner part of the block diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index be3d187..f711770 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -96,12 +96,20 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { BlockPos pos = ctx.getBlockPos(); BlockState current_state = ctx.getWorld().getBlockState(pos); - if (current_state.isOf(ReFramed.HALF_STAIR)) - return ReFramed.HALF_STAIRS_SLAB.getDefaultState() + + if (current_state.isOf(ReFramed.HALF_STAIR)) { + BlockState new_state; + Direction face = current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE)); + if (matchesShape( + ctx.getHitPos(), pos, + getDefaultState().with(CORNER, current_state.get(CORNER).change(face)) + )) new_state = ReFramed.HALF_STAIRS_CUBE_STAIR.getDefaultState(); + else new_state = ReFramed.HALF_STAIRS_SLAB.getDefaultState(); + return new_state .with(CORNER, current_state.get(CORNER)) .with(CORNER_FACE, current_state.get(CORNER_FACE)) .with(WATERLOGGED, current_state.get(WATERLOGGED)); - + } if (current_state.isOf(this)) { Vec3d hit = ctx.getHitPos(); @@ -120,7 +128,9 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 )) return state; return state.with(EDGE, corner.getEdge(corner.getThirdDirection())); - } else if (current_state.isOf(ReFramed.SLAB)) { + } + + if (current_state.isOf(ReFramed.SLAB)) { Corner corner = BlockHelper.getPlacementCorner(ctx); Direction face = current_state.get(FACING); if (!corner.hasDirection(face)) corner = corner.change(face.getOpposite()); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index dda1c8d..fcaaec3 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -3,6 +3,7 @@ package fr.adrien1106.reframed.block; import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.util.VoxelHelper; import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Corner; import fr.adrien1106.reframed.util.blocks.Edge; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -48,27 +49,17 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { || !(context.getStack().getItem() instanceof BlockItem block_item) ) return false; - Edge edge = state.get(EDGE); + Block block = block_item.getBlock(); // allow replacing with stair - if (block_item.getBlock() == ReFramed.STAIR) - return ReFramed.STAIRS_CUBE - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.STAIRS_CUBE.getDefaultState().with(EDGE, edge.opposite()), - 1 - ); + if (block != this && block != ReFramed.STAIR) return false; - if (block_item.getBlock() == this) - return ReFramed.STAIR - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.STAIR.getDefaultState() - .with(EDGE, edge.opposite()) - ); - - return false; + Edge edge = state.get(EDGE); + return ReFramed.STAIR + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.STAIRS_CUBE.getDefaultState().with(EDGE, edge.opposite()) + ); } @Nullable @@ -76,6 +67,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { public BlockState getPlacementState(ItemPlacementContext ctx) { BlockPos pos = ctx.getBlockPos(); BlockState current_state = ctx.getWorld().getBlockState(pos); + if (current_state.isOf(ReFramed.STAIR)) return ReFramed.STAIRS_CUBE.getDefaultState() .with(EDGE, current_state.get(EDGE)) @@ -105,7 +97,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { return ReFramed.STEPS_CROSS.getDefaultState() .with(EDGE, edge) .with(WATERLOGGED, current_state.get(WATERLOGGED)); - } else if (current_state.isOf(ReFramed.SLAB)) { + } + + if (current_state.isOf(ReFramed.SLAB)) { Direction facing = current_state.get(FACING); Edge edge; @@ -120,6 +114,26 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { } + if (current_state.isOf(ReFramed.HALF_STAIR)) { + Corner corner = current_state.get(CORNER); + int face_index = current_state.get(CORNER_FACE), feature_index; + Direction face = corner.getDirection(current_state.get(CORNER_FACE)); + Direction side = ctx.getSide().getOpposite(); + + if (side.getAxis() == face.getAxis()) + side = BlockHelper.getPlacementEdge(ctx).getOtherDirection(face == side ? face : face.getOpposite()); + + if (side.getAxis() != face.getAxis() && !corner.hasDirection(side)) + side = corner.getOtherDirection(Edge.getByDirections(face, side.getOpposite())); + + feature_index = corner.getDirectionIndex(side); + return ReFramed.HALF_STAIRS_STEP_STAIR.getDefaultState() + .with(CORNER, corner) + .with(CORNER_FACE, face_index) + .with(CORNER_FEATURE, feature_index > face_index ? feature_index - 1 : feature_index) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + } + return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx)); } diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 4e0939a..d59d0f4 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -27,164 +27,174 @@ public class ReFramedClient implements ClientModInitializer { BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), ReFramed.BLOCKS.toArray(new Block[0])); // CUBE - HELPER.addReFramedModel("cube" , HELPER.auto(new Identifier("block/cube"))); + HELPER.addReFramedModel("cube" , HELPER.auto(new Identifier("block/cube"))); // SMALL_CUBE - HELPER.addReFramedModel("small_cube" , HELPER.auto(ReFramed.id("block/small_cube/base"))); + HELPER.addReFramedModel("small_cube" , HELPER.auto(ReFramed.id("block/small_cube/base"))); // SMALL_CUBES_STEP - HELPER.addReFramedModel("small_cubes_step" , HELPER.autoDouble(ReFramed.id("block/small_cube/base"), ReFramed.id("block/small_cube/step/base"))); - HELPER.addReFramedModel("small_cubes_step_reverse" , HELPER.autoDouble(ReFramed.id("block/small_cube/step/base"), ReFramed.id("block/small_cube/base"))); + HELPER.addReFramedModel("small_cubes_step" , HELPER.autoDouble(ReFramed.id("block/small_cube/base"), ReFramed.id("block/small_cube/step/base"))); + HELPER.addReFramedModel("small_cubes_step_reverse" , HELPER.autoDouble(ReFramed.id("block/small_cube/step/base"), ReFramed.id("block/small_cube/base"))); // SLAB - HELPER.addReFramedModel("slab" , HELPER.auto(new Identifier("block/slab"))); + HELPER.addReFramedModel("slab" , HELPER.auto(new Identifier("block/slab"))); // SLAB_CUBE - HELPER.addReFramedModel("double_slab" , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top"))); + HELPER.addReFramedModel("double_slab" , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top"))); // STAIR - HELPER.addReFramedModel("stair" , HELPER.auto(ReFramed.id("block/stair/straight"))); - HELPER.addReFramedModel("outers_stair" , HELPER.auto(ReFramed.id("block/stair/double_outer"))); - HELPER.addReFramedModel("inner_stair" , HELPER.auto(ReFramed.id("block/stair/inner"))); - HELPER.addReFramedModel("outer_stair" , HELPER.auto(ReFramed.id("block/stair/outer"))); - HELPER.addReFramedModel("outer_side_stair" , HELPER.auto(ReFramed.id("block/stair/outer_side"))); + HELPER.addReFramedModel("stair" , HELPER.auto(ReFramed.id("block/stair/straight"))); + HELPER.addReFramedModel("outers_stair" , HELPER.auto(ReFramed.id("block/stair/double_outer"))); + HELPER.addReFramedModel("inner_stair" , HELPER.auto(ReFramed.id("block/stair/inner"))); + HELPER.addReFramedModel("outer_stair" , HELPER.auto(ReFramed.id("block/stair/outer"))); + HELPER.addReFramedModel("outer_side_stair" , HELPER.auto(ReFramed.id("block/stair/outer_side"))); // STAIRS_CUBE - HELPER.addReFramedModel("stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/straight"), ReFramed.id("block/stair/cube/straight"))); - HELPER.addReFramedModel("outers_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/double_outer"), ReFramed.id("block/stair/cube/double_outer"))); - HELPER.addReFramedModel("inner_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/inner"), ReFramed.id("block/stair/cube/inner"))); - HELPER.addReFramedModel("outer_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer"), ReFramed.id("block/stair/cube/outer"))); - HELPER.addReFramedModel("outer_side_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer_side"), ReFramed.id("block/stair/cube/outer_side"))); + HELPER.addReFramedModel("stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/straight"), ReFramed.id("block/stair/cube/straight"))); + HELPER.addReFramedModel("outers_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/double_outer"), ReFramed.id("block/stair/cube/double_outer"))); + HELPER.addReFramedModel("inner_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/inner"), ReFramed.id("block/stair/cube/inner"))); + HELPER.addReFramedModel("outer_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer"), ReFramed.id("block/stair/cube/outer"))); + HELPER.addReFramedModel("outer_side_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer_side"), ReFramed.id("block/stair/cube/outer_side"))); // HALF_STAIR - HELPER.addReFramedModel("half_stair_down" , HELPER.auto(ReFramed.id("block/half_stair/down"))); - HELPER.addReFramedModel("half_stair_side" , HELPER.auto(ReFramed.id("block/half_stair/side"))); + HELPER.addReFramedModel("half_stair_down" , HELPER.auto(ReFramed.id("block/half_stair/down"))); + HELPER.addReFramedModel("half_stair_side" , HELPER.auto(ReFramed.id("block/half_stair/side"))); // HALF_STAIRS_SLAB - HELPER.addReFramedModel("half_stairs_slab_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/slab/down"))); - HELPER.addReFramedModel("half_stairs_slab_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/slab/side"))); + HELPER.addReFramedModel("half_stairs_slab_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/slab/down"))); + HELPER.addReFramedModel("half_stairs_slab_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/slab/side"))); // HALF_STAIRS_STAIR - HELPER.addReFramedModel("half_stairs_stair_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/stair/down"))); - HELPER.addReFramedModel("half_stairs_stair_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/stair/side"))); - HELPER.addReFramedModel("half_stairs_stair_reverse" , HELPER.autoDouble(ReFramed.id("block/half_stair/stair/side"), ReFramed.id("block/half_stair/side"))); + HELPER.addReFramedModel("half_stairs_stair_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/stair/down"))); + HELPER.addReFramedModel("half_stairs_stair_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/stair/side"))); + HELPER.addReFramedModel("half_stairs_stair_reverse" , HELPER.autoDouble(ReFramed.id("block/half_stair/stair/side"), ReFramed.id("block/half_stair/side"))); // STEP - HELPER.addReFramedModel("step" , HELPER.auto(ReFramed.id("block/step/down"))); + HELPER.addReFramedModel("step" , HELPER.auto(ReFramed.id("block/step/down"))); // STEPS_SLAB - HELPER.addReFramedModel("steps_slab" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/slab/down"))); - HELPER.addReFramedModel("steps_slab_side" , HELPER.autoDouble(ReFramed.id("block/step/side"), ReFramed.id("block/step/slab/side"))); + HELPER.addReFramedModel("steps_slab" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/slab/down"))); + HELPER.addReFramedModel("steps_slab_side" , HELPER.autoDouble(ReFramed.id("block/step/side"), ReFramed.id("block/step/slab/side"))); // LAYER - HELPER.addReFramedModel("layer_1" , HELPER.auto(new Identifier("block/snow_height2"))); - HELPER.addReFramedModel("layer_2" , HELPER.auto(new Identifier("block/snow_height4"))); - HELPER.addReFramedModel("layer_3" , HELPER.auto(new Identifier("block/snow_height6"))); - HELPER.addReFramedModel("layer_4" , HELPER.auto(new Identifier("block/snow_height8"))); - HELPER.addReFramedModel("layer_5" , HELPER.auto(new Identifier("block/snow_height10"))); - HELPER.addReFramedModel("layer_6" , HELPER.auto(new Identifier("block/snow_height12"))); - HELPER.addReFramedModel("layer_7" , HELPER.auto(new Identifier("block/snow_height14"))); - HELPER.addReFramedModel("layer_8" , HELPER.auto(new Identifier("block/cube"))); + HELPER.addReFramedModel("layer_1" , HELPER.auto(new Identifier("block/snow_height2"))); + HELPER.addReFramedModel("layer_2" , HELPER.auto(new Identifier("block/snow_height4"))); + HELPER.addReFramedModel("layer_3" , HELPER.auto(new Identifier("block/snow_height6"))); + HELPER.addReFramedModel("layer_4" , HELPER.auto(new Identifier("block/snow_height8"))); + HELPER.addReFramedModel("layer_5" , HELPER.auto(new Identifier("block/snow_height10"))); + HELPER.addReFramedModel("layer_6" , HELPER.auto(new Identifier("block/snow_height12"))); + HELPER.addReFramedModel("layer_7" , HELPER.auto(new Identifier("block/snow_height14"))); + HELPER.addReFramedModel("layer_8" , HELPER.auto(new Identifier("block/cube"))); // PILLAR - HELPER.addReFramedModel("pillar" , HELPER.auto(ReFramed.id("block/pillar"))); + HELPER.addReFramedModel("pillar" , HELPER.auto(ReFramed.id("block/pillar"))); // WALL - HELPER.addReFramedModel("wall_inventory" , HELPER.auto(ReFramed.id("block/wall/inventory/default"))); + HELPER.addReFramedModel("wall_inventory" , HELPER.auto(ReFramed.id("block/wall/inventory/default"))); // --------------------- pillar - HELPER.addReFramedModel("wall_core" , HELPER.auto(ReFramed.id("block/wall/pillar/core"))); - HELPER.addReFramedModel("wall_pillar_low" , HELPER.auto(ReFramed.id("block/wall/pillar/low"))); - HELPER.addReFramedModel("wall_pillar_tall" , HELPER.auto(ReFramed.id("block/wall/pillar/tall"))); - HELPER.addReFramedModel("wall_pillar_none" , HELPER.auto(ReFramed.id("block/wall/pillar/none"))); + HELPER.addReFramedModel("wall_core" , HELPER.auto(ReFramed.id("block/wall/pillar/core"))); + HELPER.addReFramedModel("wall_pillar_low" , HELPER.auto(ReFramed.id("block/wall/pillar/low"))); + HELPER.addReFramedModel("wall_pillar_tall" , HELPER.auto(ReFramed.id("block/wall/pillar/tall"))); + HELPER.addReFramedModel("wall_pillar_none" , HELPER.auto(ReFramed.id("block/wall/pillar/none"))); // --------------------- side - HELPER.addReFramedModel("wall_side_low" , HELPER.auto(ReFramed.id("block/wall/side/low"))); - HELPER.addReFramedModel("wall_side_tall" , HELPER.auto(ReFramed.id("block/wall/side/tall"))); + HELPER.addReFramedModel("wall_side_low" , HELPER.auto(ReFramed.id("block/wall/side/low"))); + HELPER.addReFramedModel("wall_side_tall" , HELPER.auto(ReFramed.id("block/wall/side/tall"))); // --------------------- junction - HELPER.addReFramedModel("wall_low_e" , HELPER.auto(ReFramed.id("block/wall/junction/low"))); - HELPER.addReFramedModel("wall_tall_e" , HELPER.auto(ReFramed.id("block/wall/junction/tall"))); + HELPER.addReFramedModel("wall_low_e" , HELPER.auto(ReFramed.id("block/wall/junction/low"))); + HELPER.addReFramedModel("wall_tall_e" , HELPER.auto(ReFramed.id("block/wall/junction/tall"))); // --------------------- junction_i - HELPER.addReFramedModel("wall_low_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_i"))); - HELPER.addReFramedModel("wall_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i"))); - HELPER.addReFramedModel("wall_low_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_i"))); + HELPER.addReFramedModel("wall_low_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_i"))); + HELPER.addReFramedModel("wall_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i"))); + HELPER.addReFramedModel("wall_low_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_i"))); // --------------------- junction_c - HELPER.addReFramedModel("wall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_c"))); - HELPER.addReFramedModel("wall_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c"))); - HELPER.addReFramedModel("wall_low_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c"))); - HELPER.addReFramedModel("wall_tall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c"))); + HELPER.addReFramedModel("wall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_c"))); + HELPER.addReFramedModel("wall_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c"))); + HELPER.addReFramedModel("wall_low_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c"))); + HELPER.addReFramedModel("wall_tall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c"))); // --------------------- junction_t - HELPER.addReFramedModel("wall_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_t"))); - HELPER.addReFramedModel("wall_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t"))); - HELPER.addReFramedModel("wall_tall_low_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c_t"))); - HELPER.addReFramedModel("wall_tall_i_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_t"))); - HELPER.addReFramedModel("wall_low_i_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_i_tall_t"))); - HELPER.addReFramedModel("wall_low_tall_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c_t"))); - HELPER.addReFramedModel("wall_low_c_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_c_tall_t"))); - HELPER.addReFramedModel("wall_tall_c_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_t"))); + HELPER.addReFramedModel("wall_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_t"))); + HELPER.addReFramedModel("wall_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t"))); + HELPER.addReFramedModel("wall_tall_low_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c_t"))); + HELPER.addReFramedModel("wall_tall_i_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_t"))); + HELPER.addReFramedModel("wall_low_i_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_i_tall_t"))); + HELPER.addReFramedModel("wall_low_tall_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c_t"))); + HELPER.addReFramedModel("wall_low_c_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_c_tall_t"))); + HELPER.addReFramedModel("wall_tall_c_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_t"))); // --------------------- junction_x - HELPER.addReFramedModel("wall_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/low_x"))); - HELPER.addReFramedModel("wall_tall_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_x"))); - HELPER.addReFramedModel("wall_tall_i_low_i_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_i_x"))); - HELPER.addReFramedModel("wall_tall_low_t_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_t_x"))); - HELPER.addReFramedModel("wall_tall_c_low_c_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_c_x"))); - HELPER.addReFramedModel("wall_tall_t_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t_low_x"))); + HELPER.addReFramedModel("wall_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/low_x"))); + HELPER.addReFramedModel("wall_tall_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_x"))); + HELPER.addReFramedModel("wall_tall_i_low_i_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_i_x"))); + HELPER.addReFramedModel("wall_tall_low_t_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_t_x"))); + HELPER.addReFramedModel("wall_tall_c_low_c_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_c_x"))); + HELPER.addReFramedModel("wall_tall_t_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t_low_x"))); // PILLAR WALL - HELPER.addReFramedModel("pillars_wall_inventory" , HELPER.autoDouble(ReFramed.id("block/pillar"), ReFramed.id("block/wall/full/inventory/sides"))); - HELPER.addReFramedModel("pillars_wall_low" , HELPER.autoDouble(ReFramed.id("block/wall/full/pillar/low"), ReFramed.id("block/wall/full/side/low"))); - HELPER.addReFramedModel("pillars_wall_tall" , HELPER.autoDouble(ReFramed.id("block/wall/full/pillar/tall"), ReFramed.id("block/wall/full/side/tall"))); + HELPER.addReFramedModel("pillars_wall_inventory" , HELPER.autoDouble(ReFramed.id("block/pillar"), ReFramed.id("block/wall/full/inventory/sides"))); + HELPER.addReFramedModel("pillars_wall_low" , HELPER.autoDouble(ReFramed.id("block/wall/full/pillar/low"), ReFramed.id("block/wall/full/side/low"))); + HELPER.addReFramedModel("pillars_wall_tall" , HELPER.autoDouble(ReFramed.id("block/wall/full/pillar/tall"), ReFramed.id("block/wall/full/side/tall"))); // PANE - HELPER.addReFramedModel("pane_inventory" , HELPER.auto(ReFramed.id("block/pane"))); - HELPER.addReFramedModel("pane_post" , HELPER.auto(new Identifier("block/glass_pane_post"))); - HELPER.addReFramedModel("pane_side" , HELPER.auto(new Identifier("block/glass_pane_side"))); - HELPER.addReFramedModel("pane_side_alt" , HELPER.auto(new Identifier("block/glass_pane_side_alt"))); - HELPER.addReFramedModel("pane_noside" , HELPER.auto(new Identifier("block/glass_pane_noside"))); - HELPER.addReFramedModel("pane_noside_alt" , HELPER.auto(new Identifier("block/glass_pane_noside_alt"))); + HELPER.addReFramedModel("pane_inventory" , HELPER.auto(ReFramed.id("block/pane"))); + HELPER.addReFramedModel("pane_post" , HELPER.auto(new Identifier("block/glass_pane_post"))); + HELPER.addReFramedModel("pane_side" , HELPER.auto(new Identifier("block/glass_pane_side"))); + HELPER.addReFramedModel("pane_side_alt" , HELPER.auto(new Identifier("block/glass_pane_side_alt"))); + HELPER.addReFramedModel("pane_noside" , HELPER.auto(new Identifier("block/glass_pane_noside"))); + HELPER.addReFramedModel("pane_noside_alt" , HELPER.auto(new Identifier("block/glass_pane_noside_alt"))); // TRAPDOOR - HELPER.addReFramedModel("trapdoor_open" , HELPER.auto(new Identifier("block/oak_trapdoor_open"))); - HELPER.addReFramedModel("trapdoor_bottom" , HELPER.auto(new Identifier("block/oak_trapdoor_bottom"))); - HELPER.addReFramedModel("trapdoor_top" , HELPER.auto(new Identifier("block/oak_trapdoor_top"))); + HELPER.addReFramedModel("trapdoor_open" , HELPER.auto(new Identifier("block/oak_trapdoor_open"))); + HELPER.addReFramedModel("trapdoor_bottom" , HELPER.auto(new Identifier("block/oak_trapdoor_bottom"))); + HELPER.addReFramedModel("trapdoor_top" , HELPER.auto(new Identifier("block/oak_trapdoor_top"))); // DOOR - HELPER.addReFramedModel("door_inventory" , HELPER.auto(ReFramed.id("block/door"))); + HELPER.addReFramedModel("door_inventory" , HELPER.auto(ReFramed.id("block/door"))); // BUTTON - HELPER.addReFramedModel("button_inventory" , HELPER.auto(new Identifier("block/button_inventory"))); - HELPER.addReFramedModel("button" , HELPER.auto(new Identifier("block/button"))); - HELPER.addReFramedModel("button_pressed" , HELPER.auto(new Identifier("block/button_pressed"))); + HELPER.addReFramedModel("button_inventory" , HELPER.auto(new Identifier("block/button_inventory"))); + HELPER.addReFramedModel("button" , HELPER.auto(new Identifier("block/button"))); + HELPER.addReFramedModel("button_pressed" , HELPER.auto(new Identifier("block/button_pressed"))); // POST - HELPER.addReFramedModel("post" , HELPER.auto(ReFramed.id("block/post"))); + HELPER.addReFramedModel("post" , HELPER.auto(ReFramed.id("block/post"))); // FENCE - HELPER.addReFramedModel("fence_inventory" , HELPER.auto(ReFramed.id("block/fence/inventory"))); - HELPER.addReFramedModel("fence_core" , HELPER.auto(ReFramed.id("block/fence/core"))); - HELPER.addReFramedModel("fence_side_off" , HELPER.auto(ReFramed.id("block/fence/side_off"))); - HELPER.addReFramedModel("fence_side_on" , HELPER.auto(ReFramed.id("block/fence/side_on"))); + HELPER.addReFramedModel("fence_inventory" , HELPER.auto(ReFramed.id("block/fence/inventory"))); + HELPER.addReFramedModel("fence_core" , HELPER.auto(ReFramed.id("block/fence/core"))); + HELPER.addReFramedModel("fence_side_off" , HELPER.auto(ReFramed.id("block/fence/side_off"))); + HELPER.addReFramedModel("fence_side_on" , HELPER.auto(ReFramed.id("block/fence/side_on"))); // POST FENCE - HELPER.addReFramedModel("post_fence_inventory" , HELPER.autoDouble(ReFramed.id("block/post"), ReFramed.id("block/fence/full/inventory"))); - HELPER.addReFramedModel("post_fence_side" , HELPER.autoDouble(ReFramed.id("block/fence/full/side_core"), ReFramed.id("block/fence/full/side_bars"))); + HELPER.addReFramedModel("post_fence_inventory" , HELPER.autoDouble(ReFramed.id("block/post"), ReFramed.id("block/fence/full/inventory"))); + HELPER.addReFramedModel("post_fence_side" , HELPER.autoDouble(ReFramed.id("block/fence/full/side_core"), ReFramed.id("block/fence/full/side_bars"))); // SLABS STAIR - HELPER.addReFramedModel("slabs_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/slab"), ReFramed.id("block/slabs_stair/step"))); - HELPER.addReFramedModel("slabs_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/side/slab"), ReFramed.id("block/slabs_stair/side/step"))); + HELPER.addReFramedModel("slabs_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/slab"), ReFramed.id("block/slabs_stair/step"))); + HELPER.addReFramedModel("slabs_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/side/slab"), ReFramed.id("block/slabs_stair/side/step"))); // SLABS OUTER STAIR - HELPER.addReFramedModel("slabs_outer_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/outer/slab"), ReFramed.id("block/slabs_stair/outer/cube"))); - HELPER.addReFramedModel("slabs_outer_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/outer/side/slab"), ReFramed.id("block/slabs_stair/outer/side/cube"))); + HELPER.addReFramedModel("slabs_outer_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/outer/slab"), ReFramed.id("block/slabs_stair/outer/cube"))); + HELPER.addReFramedModel("slabs_outer_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/outer/side/slab"), ReFramed.id("block/slabs_stair/outer/side/cube"))); // SLABS OUTER STAIR - HELPER.addReFramedModel("slabs_inner_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/slab"), ReFramed.id("block/slabs_stair/inner/half_stair"))); - HELPER.addReFramedModel("slabs_inner_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/side/slab"), ReFramed.id("block/slabs_stair/inner/side/half_stair"))); + HELPER.addReFramedModel("slabs_inner_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/slab"), ReFramed.id("block/slabs_stair/inner/half_stair"))); + HELPER.addReFramedModel("slabs_inner_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/side/slab"), ReFramed.id("block/slabs_stair/inner/side/half_stair"))); // SLABS OUTER STAIR - HELPER.addReFramedModel("steps_cross" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/cross"))); + HELPER.addReFramedModel("steps_cross" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/cross"))); + // HALF STAIRS CUBE STAIR + HELPER.addReFramedModel("half_stairs_cube_stair" , HELPER.autoDouble(ReFramed.id("block/half_stair/base"), ReFramed.id("block/half_stair/stair/cube"))); + HELPER.addReFramedModel("half_stairs_cube_stair_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/cube_side"))); + // HALF STAIRS STEP STAIR + HELPER.addReFramedModel("half_stairs_step_stair_1" , HELPER.autoDouble(ReFramed.id("block/half_stair/base"), ReFramed.id("block/half_stair/stair/step_1"))); + HELPER.addReFramedModel("half_stairs_step_stair_side_1", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_1"))); + HELPER.addReFramedModel("half_stairs_step_stair_2" , HELPER.autoDouble(ReFramed.id("block/half_stair/base"), ReFramed.id("block/half_stair/stair/step_2"))); + HELPER.addReFramedModel("half_stairs_step_stair_side_2", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_2"))); - //item model assignments (in lieu of models/item/___.json) - HELPER.assignItemModel("cube" , ReFramed.CUBE); - HELPER.assignItemModel("small_cube" , ReFramed.SMALL_CUBE); - HELPER.assignItemModel("small_cubes_step" , ReFramed.SMALL_CUBES_STEP); - HELPER.assignItemModel("slab" , ReFramed.SLAB); - HELPER.assignItemModel("double_slab" , ReFramed.SLABS_CUBE); - HELPER.assignItemModel("stair" , ReFramed.STAIR); - HELPER.assignItemModel("stairs_cube" , ReFramed.STAIRS_CUBE); - HELPER.assignItemModel("half_stair_down" , ReFramed.HALF_STAIR); - HELPER.assignItemModel("half_stairs_slab_down" , ReFramed.HALF_STAIRS_SLAB); - HELPER.assignItemModel("half_stairs_stair_down", ReFramed.HALF_STAIRS_STAIR); - HELPER.assignItemModel("step" , ReFramed.STEP); - HELPER.assignItemModel("steps_slab" , ReFramed.STEPS_SLAB); - HELPER.assignItemModel("layer_1" , ReFramed.LAYER); - HELPER.assignItemModel("pillar" , ReFramed.PILLAR); - HELPER.assignItemModel("pillars_wall_inventory", ReFramed.PILLARS_WALL); - HELPER.assignItemModel("wall_inventory" , ReFramed.WALL); - HELPER.assignItemModel("pane_inventory" , ReFramed.PANE); - HELPER.assignItemModel("trapdoor_bottom" , ReFramed.TRAPDOOR); - HELPER.assignItemModel("door_inventory" , ReFramed.DOOR); - HELPER.assignItemModel("button_inventory" , ReFramed.BUTTON); - HELPER.assignItemModel("post" , ReFramed.POST); - HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE); - HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE); - HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR); - HELPER.assignItemModel("slabs_outer_stair" , ReFramed.SLABS_OUTER_STAIR); - HELPER.assignItemModel("slabs_inner_stair" , ReFramed.SLABS_INNER_STAIR); - HELPER.assignItemModel("steps_cross" , ReFramed.STEPS_CROSS); + // item model assignments (in lieu of models/item/___.json) + HELPER.assignItemModel("cube" , ReFramed.CUBE); + HELPER.assignItemModel("small_cube" , ReFramed.SMALL_CUBE); + HELPER.assignItemModel("small_cubes_step" , ReFramed.SMALL_CUBES_STEP); + HELPER.assignItemModel("slab" , ReFramed.SLAB); + HELPER.assignItemModel("double_slab" , ReFramed.SLABS_CUBE); + HELPER.assignItemModel("stair" , ReFramed.STAIR); + HELPER.assignItemModel("stairs_cube" , ReFramed.STAIRS_CUBE); + HELPER.assignItemModel("half_stair_down" , ReFramed.HALF_STAIR); + HELPER.assignItemModel("half_stairs_slab_down" , ReFramed.HALF_STAIRS_SLAB); + HELPER.assignItemModel("half_stairs_stair_down" , ReFramed.HALF_STAIRS_STAIR); + HELPER.assignItemModel("step" , ReFramed.STEP); + HELPER.assignItemModel("steps_slab" , ReFramed.STEPS_SLAB); + HELPER.assignItemModel("layer_1" , ReFramed.LAYER); + HELPER.assignItemModel("pillar" , ReFramed.PILLAR); + HELPER.assignItemModel("pillars_wall_inventory" , ReFramed.PILLARS_WALL); + HELPER.assignItemModel("wall_inventory" , ReFramed.WALL); + HELPER.assignItemModel("pane_inventory" , ReFramed.PANE); + HELPER.assignItemModel("trapdoor_bottom" , ReFramed.TRAPDOOR); + HELPER.assignItemModel("door_inventory" , ReFramed.DOOR); + HELPER.assignItemModel("button_inventory" , ReFramed.BUTTON); + HELPER.assignItemModel("post" , ReFramed.POST); + HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE); + HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE); + HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR); + HELPER.assignItemModel("slabs_outer_stair" , ReFramed.SLABS_OUTER_STAIR); + HELPER.assignItemModel("slabs_inner_stair" , ReFramed.SLABS_INNER_STAIR); + HELPER.assignItemModel("steps_cross" , ReFramed.STEPS_CROSS); + HELPER.assignItemModel("half_stairs_cube_stair" , ReFramed.HALF_STAIRS_CUBE_STAIR); + HELPER.assignItemModel("half_stairs_step_stair_1", ReFramed.HALF_STAIRS_STEP_STAIR); } private void privateInit() { diff --git a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java index fd7962a..585b9ca 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -22,6 +22,8 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedHalfStairBlock.class, new HalfStair()); providers.put(ReFramedHalfStairsSlabBlock.class, new HalfStairsSlab()); providers.put(ReFramedHalfStairsStairBlock.class, new HalfStairsStair()); + providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); + providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedLayerBlock.class, new Layer()); providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index 39ba39a..4ea5c2d 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -24,6 +24,8 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedHalfStairBlock.class, new HalfStair()); providers.put(ReFramedHalfStairsSlabBlock.class, new HalfStairsSlab()); providers.put(ReFramedHalfStairsStairBlock.class, new HalfStairsStair()); + providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); + providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedLayerBlock.class, new Layer()); providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsCubeStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsCubeStair.java new file mode 100644 index 0000000..1d4401a --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsCubeStair.java @@ -0,0 +1,33 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.MultipartBlockStateSupplier; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.RecipeProvider; +import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; + +public class HalfStairsCubeStair implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.SMALL_CUBE) + .input(ReFramed.HALF_STAIR) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public MultipartBlockStateSupplier getMultipart(Block block) { + return CornerDouble.getMultipart(block, "half_stairs_cube_stair"); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStepStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStepStair.java new file mode 100644 index 0000000..fda8498 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStepStair.java @@ -0,0 +1,159 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.generator.GBlockstate; +import fr.adrien1106.reframed.generator.RecipeSetter; +import fr.adrien1106.reframed.util.blocks.Corner; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.MultipartBlockStateSupplier; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.RecipeProvider; +import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.util.Identifier; + +import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.data.client.VariantSettings.Rotation.R270; + +public class HalfStairsStepStair implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.SMALL_CUBE) + .input(ReFramed.HALF_STAIR) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public MultipartBlockStateSupplier getMultipart(Block block) { + Identifier model_1_id = ReFramed.id("half_stairs_step_stair_1_special"); + Identifier side_1_id = ReFramed.id("half_stairs_step_stair_side_1_special"); + Identifier model_2_id = ReFramed.id("half_stairs_step_stair_2_special"); + Identifier side_2_id = ReFramed.id("half_stairs_step_stair_side_2_special"); + return MultipartBlockStateSupplier.create(block) + // BOTTOM + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_1_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_1_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_1_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_1_id, true, R0, R270)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_2_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_2_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_2_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_2_id, true, R0, R270)) + // TOP + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_1_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_1_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_1_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 2, CORNER_FEATURE, 1), + GBlockstate.variant(model_1_id, true, R180, R270)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_2_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_2_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_2_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 2, CORNER_FEATURE, 0), + GBlockstate.variant(model_2_id, true, R180, R270)) + // EAST + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R90, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R270, R0)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R90, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R270, R0)) + // SOUTH + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R90, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R270, R90)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R90, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R270, R90)) + // WEST + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R90, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R270, R180)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R90, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R270, R180)) + // NORTH + // --- 1 --- + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R0, R270)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R90, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_1_id, true, R180, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_1_id, true, R270, R270)) + // --- 2 --- + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 0, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R0, R270)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 0, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R90, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 1, CORNER_FEATURE, 1), + GBlockstate.variant(side_2_id, true, R180, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 1, CORNER_FEATURE, 0), + GBlockstate.variant(side_2_id, true, R270, R270)) + ; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java index 789ffda..4c38e78 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java @@ -10,5 +10,6 @@ public class BlockProperties { public static final IntProperty EDGE_FACE = IntProperty.of("face", 0, 1); public static final EnumProperty CORNER = EnumProperty.of("corner", Corner.class); public static final IntProperty CORNER_FACE = IntProperty.of("face", 0, 2); + public static final IntProperty CORNER_FEATURE = IntProperty.of("corner_feature", 0, 1); public static final EnumProperty STAIR_SHAPE = EnumProperty.of("shape", StairShape.class); } diff --git a/src/main/resources/assets/reframed/models/block/half_stair/base.json b/src/main/resources/assets/reframed/models/block/half_stair/base.json new file mode 100644 index 0000000..f8bb407 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/base.json @@ -0,0 +1,56 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 8], + "to": [16, 8, 16], + "faces": { + "east": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 0], + "to": [16, 8, 8], + "faces": { + "north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "east"}, + "west": {"uv": [0, 8, 8, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#top"}, + "down": {"uv": [8, 8, 16, 16], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [0, 0, 8], + "to": [8, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 8]}, + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side"}, + "south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/base_side.json b/src/main/resources/assets/reframed/models/block/half_stair/base_side.json new file mode 100644 index 0000000..0fe8207 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/base_side.json @@ -0,0 +1,58 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 0, 0], + "to": [16, 8, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 0]}, + "faces": { + "north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "east"}, + "west": {"uv": [0, 8, 8, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#top"}, + "down": {"uv": [8, 8, 16, 16], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 8], + "to": [16, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "east": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "down"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/cube.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/cube.json new file mode 100644 index 0000000..02cfc46 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/cube.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/cube_side.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/cube_side.json new file mode 100644 index 0000000..b56aa5e --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/cube_side.json @@ -0,0 +1,35 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 8], + "to": [8, 8, 16], + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 8, 8, 16], "texture": "#side"}, + "south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/step_1.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_1.json new file mode 100644 index 0000000..b355585 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_1.json @@ -0,0 +1,47 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "east": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom"} + } + }, + { + "from": [8, 8, 0], + "to": [16, 16, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "west": {"uv": [0, 0, 8, 8], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 8, 16, 16], "texture": "#bottom"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/step_2.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_2.json new file mode 100644 index 0000000..e6948a4 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_2.json @@ -0,0 +1,47 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom"} + } + }, + { + "from": [0, 8, 8], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 8]}, + "faces": { + "north": {"uv": [8, 0, 16, 8], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_1.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_1.json new file mode 100644 index 0000000..730670e --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_1.json @@ -0,0 +1,47 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 8], + "to": [8, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, 0]}, + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 8, 8, 16], "texture": "#side"}, + "south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "west"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [0, 8, 8], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 8]}, + "faces": { + "north": {"uv": [8, 0, 16, 8], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_2.json b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_2.json new file mode 100644 index 0000000..5604b00 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_2.json @@ -0,0 +1,46 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 8], + "to": [8, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, 0]}, + "faces": { + "east": {"uv": [0, 8, 8, 16], "texture": "#side"}, + "south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [0, 0, 0], + "to": [8, 8, 8], + "faces": { + "north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 8, 16, 16], "texture": "#side"}, + "west": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#top"}, + "down": {"uv": [0, 8, 8, 16], "texture": "#bottom", "cullface": "down"} + } + } + ], + "display": { + "thirdperson_lefthand": { + "rotation": [75, -135, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "gui": { + "rotation": [30, 135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [0, -90, 0] + } + } +} \ No newline at end of file