From d7ad6ed0c1d61b8f1b57e30f06d74f525f6b3214 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 17 Jun 2024 10:52:21 +0200 Subject: [PATCH 01/10] feat: added and improved logic to merge step with slabs --- .../java/fr/adrien1106/reframed/ReFramed.java | 2 +- .../reframed/block/ReFramedBlock.java | 14 +++ .../reframed/block/ReFramedDoubleBlock.java | 8 -- .../reframed/block/ReFramedSlabBlock.java | 32 ++--- .../reframed/block/ReFramedStepBlock.java | 113 +++++++++--------- 5 files changed, 87 insertions(+), 82 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 098f8dd..40139c5 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -37,7 +37,7 @@ public class ReFramed implements ModInitializer { public static final String MODID = "reframed"; public static final ArrayList BLOCKS = new ArrayList<>(); - public static Block + public static ReFramedBlock CUBE, SMALL_CUBE, SMALL_CUBES_STEP, STAIR, STAIRS_CUBE, diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java index ceac63c..c2cd457 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java @@ -20,6 +20,7 @@ import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; @@ -135,6 +136,19 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } onPlaced(world, pos, state, placer, stack); } + + public boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state) { + return matchesShape(hit, pos, state, 0); + } + + public boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) { + Vec3d rel = BlockHelper.getRelativePos(hit, pos); + return matchesShape(rel, getShape(state, i)); + } + + public boolean matchesShape(Vec3d rel_hit, VoxelShape shape) { + return BlockHelper.cursorMatchesFace(shape, rel_hit); + } @Override public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java index 7f67064..459c5b0 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java @@ -49,14 +49,6 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock { return 0; } - public boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) { - Vec3d rel = BlockHelper.getRelativePos(hit, pos); - return BlockHelper.cursorMatchesFace( - getShape(state, i), - rel - ); - } - @Override public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) { return world.getBlockEntity(pos) instanceof ThemeableBlockEntity framed_entity diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 39a813e..0c8252e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -42,21 +42,23 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { - if (context.getPlayer() == null) return false; - return !( - context.getPlayer().isSneaking() - || !(context.getStack().getItem() instanceof BlockItem block_item) - || !( - block_item.getBlock() == this - && ((ReFramedSlabsCubeBlock) ReFramed.SLABS_CUBE) - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.SLABS_CUBE.getDefaultState().with(AXIS, state.get(FACING).getAxis()), - state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - ) - ) - ); + if (context.getPlayer() == null + || context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + ) return false; + + // allow replacing with slab and step + if (block_item.getBlock() != this && block_item.getBlock() != ReFramed.STEP) + return false; + + // check if the player is clicking on the inner part of the block + return ReFramed.SLABS_CUBE + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.SLABS_CUBE.getDefaultState().with(AXIS, state.get(FACING).getAxis()), + state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 + ); } @Nullable diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 121cace..f344db9 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -22,10 +22,9 @@ import org.jetbrains.annotations.Nullable; import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; -import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE; import static net.minecraft.state.property.Properties.*; -import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedStepBlock extends WaterloggableReFramedBlock { @@ -43,48 +42,32 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { - if (context.getPlayer() == null) return false; - Edge edge = state.get(EDGE); - return !( - context.getPlayer().isSneaking() + if (context.getPlayer() == null + || context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) - || ( - !( - block_item.getBlock() == ReFramed.STAIR - && ((ReFramedStairsCubeBlock) ReFramed.STAIRS_CUBE) - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.STAIRS_CUBE.getDefaultState().with(EDGE, edge.opposite()), - 1 - ) + ) return false; - ) - && !( - block_item.getBlock() == this - && ( - ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB) - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.STEPS_SLAB.getDefaultState() - .with(FACING, edge.getFirstDirection()) - .with(AXIS, edge.getSecondDirection().getAxis()), - edge.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - ) - || ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB) - .matchesShape( - context.getHitPos(), - context.getBlockPos(), - ReFramed.STEPS_SLAB.getDefaultState() - .with(FACING, edge.getSecondDirection()) - .with(AXIS, edge.getFirstDirection().getAxis()), - edge.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - ) - ) - ) - ) - ); + Edge edge = state.get(EDGE); + // 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_item.getBlock() == this) + return ReFramed.STAIR + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.STAIR.getDefaultState() + .with(EDGE, edge.opposite()) + ); + + return false; } @Nullable @@ -101,23 +84,37 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { if (current_state.isOf(this)) { Vec3d hit = ctx.getHitPos(); Edge edge = current_state.get(EDGE); - Direction dir = edge.getFirstDirection(); - ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB); - BlockState state = block.getDefaultState() - .with(FACING, dir) - .with(AXIS, edge.getOtherDirection(dir).getAxis()) + + // Steps Slab + if (matchesShape(hit, pos, + current_state.with(EDGE, edge.getOpposite(edge.getFirstDirection())) + )) return ReFramed.STEPS_SLAB.getDefaultState() + .with(FACING, edge.getFirstDirection()) + .with(AXIS, edge.getSecondDirection().getAxis()) .with(WATERLOGGED, current_state.get(WATERLOGGED)); - if (!block.matchesShape( - hit, pos, - state, - edge.getOtherDirection(dir).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - )) { - dir = edge.getSecondDirection(); - state = state - .with(FACING, dir) - .with(AXIS, edge.getOtherDirection(dir).getAxis()); - } - return state; + + else if (matchesShape(hit, pos, + current_state.with(EDGE, edge.getOpposite(edge.getSecondDirection())) + )) return ReFramed.STEPS_SLAB.getDefaultState() + .with(FACING, edge.getFirstDirection()) + .with(AXIS, edge.getSecondDirection().getAxis()) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + + // Steps Cross + return null; // TODO STEP cross + } else if (current_state.isOf(ReFramed.SLAB)) { + Direction facing = current_state.get(FACING); + Edge edge; + + // Slabs Stair + if (ctx.getSide() == facing || ctx.getSide() == facing.getOpposite()) + edge = BlockHelper.getPlacementEdge(ctx); + else + edge = Edge.getByDirections(facing, ctx.getSide().getOpposite()); + return ReFramed.SLABS_STAIR.getDefaultState() + .with(EDGE, edge) + .with(EDGE_FACE, edge.getDirectionIndex(facing)); + } return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx)); From 1e6cab04cc04550deebe4e4226baf509d9a17457 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 17 Jun 2024 19:19:13 +0200 Subject: [PATCH 02/10] feat: added SlabsInnerStair and SlabsOuterStair with additive logic + depreciation warning suppressing on AbstractBlock Methods --- .../java/fr/adrien1106/reframed/ReFramed.java | 4 +- .../block/ConnectingReFramedBlock.java | 3 + .../block/CornerDoubleReFramedBlock.java | 68 ++++++++++++++++ .../reframed/block/PillarReFramedBlock.java | 3 + .../reframed/block/ReFramedBlock.java | 6 ++ .../reframed/block/ReFramedButtonBlock.java | 8 ++ .../reframed/block/ReFramedDoorBlock.java | 8 ++ .../reframed/block/ReFramedDoubleBlock.java | 3 +- .../reframed/block/ReFramedFenceBlock.java | 3 + .../block/ReFramedHalfStairBlock.java | 16 +++- .../block/ReFramedHalfStairsSlabBlock.java | 9 +-- .../block/ReFramedHalfStairsStairBlock.java | 9 +-- .../reframed/block/ReFramedLayerBlock.java | 13 +--- .../block/ReFramedPillarsWallBlock.java | 3 + .../block/ReFramedPostFenceBlock.java | 5 ++ .../reframed/block/ReFramedSlabBlock.java | 17 +++- .../block/ReFramedSlabsCubeBlock.java | 3 +- .../block/ReFramedSlabsInnerStairBlock.java | 48 ++++++++++++ .../block/ReFramedSlabsOuterStairBlock.java | 51 ++++++++++++ .../block/ReFramedSlabsStairBlock.java | 9 +-- .../block/ReFramedSmallCubeBlock.java | 19 ++++- .../block/ReFramedSmallCubesStepBlock.java | 9 +-- .../reframed/block/ReFramedStairBlock.java | 4 + .../block/ReFramedStairsCubeBlock.java | 3 + .../reframed/block/ReFramedStepBlock.java | 8 +- .../block/ReFramedStepsSlabBlock.java | 9 +-- .../reframed/block/ReFramedTrapdoorBlock.java | 6 ++ .../reframed/block/ReFramedWallBlock.java | 3 + .../block/WaterloggableReFramedBlock.java | 5 +- .../WaterloggableReFramedDoubleBlock.java | 3 + .../reframed/client/ReFramedClient.java | 8 ++ .../reframed/generator/GBlockstate.java | 2 + .../reframed/generator/GRecipe.java | 2 + .../generator/block/CornerDouble.java | 77 +++++++++++++++++++ .../generator/block/SlabsInnerStair.java | 33 ++++++++ .../generator/block/SlabsOuterStair.java | 33 ++++++++ .../reframed/util/blocks/Corner.java | 17 ++++ .../block/slabs_stair/inner/side/slab.json | 67 ++++++++++++++++ .../models/block/slabs_stair/inner/slab.json | 67 ++++++++++++++++ .../models/block/slabs_stair/outer/cube.json | 36 +++++++++ .../block/slabs_stair/outer/side/cube.json | 36 +++++++++ .../block/slabs_stair/outer/side/slab.json | 56 ++++++++++++++ .../models/block/slabs_stair/outer/slab.json | 55 +++++++++++++ 43 files changed, 791 insertions(+), 56 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/CornerDoubleReFramedBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsInnerStairBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsOuterStairBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/CornerDouble.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SlabsInnerStair.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SlabsOuterStair.java create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/slab.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/inner/slab.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/outer/cube.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/cube.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/slab.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/outer/slab.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 40139c5..0ebcbe7 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -42,7 +42,7 @@ public class ReFramed implements ModInitializer { SMALL_CUBE, SMALL_CUBES_STEP, STAIR, STAIRS_CUBE, HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, - SLAB, SLABS_CUBE, SLABS_STAIR, + SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, STEP, STEPS_SLAB, LAYER, PILLAR, PILLARS_WALL, WALL, @@ -74,6 +74,8 @@ public class ReFramed implements ModInitializer { 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))); PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java index 5b63d7a..26f67dd 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java @@ -62,6 +62,7 @@ public abstract class ConnectingReFramedBlock extends WaterloggableReFramedBlock } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getConnectionProperty(rotation.rotate(dir)), state.get(getConnectionProperty(dir))) @@ -69,6 +70,7 @@ public abstract class ConnectingReFramedBlock extends WaterloggableReFramedBlock } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getConnectionProperty(mirror.apply(dir)), state.get(getConnectionProperty(dir))) @@ -78,6 +80,7 @@ public abstract class ConnectingReFramedBlock extends WaterloggableReFramedBlock protected abstract boolean connectsTo(BlockState state, boolean fs, Direction dir); @Override + @SuppressWarnings("deprecation") public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context); public static BooleanProperty getConnectionProperty(Direction dir) { diff --git a/src/main/java/fr/adrien1106/reframed/block/CornerDoubleReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/CornerDoubleReFramedBlock.java new file mode 100644 index 0000000..46619d1 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/CornerDoubleReFramedBlock.java @@ -0,0 +1,68 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Corner; +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.BlockMirror; +import net.minecraft.util.BlockRotation; +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.util.blocks.BlockProperties.CORNER; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE; + +public abstract class CornerDoubleReFramedBlock extends WaterloggableReFramedDoubleBlock { + + public CornerDoubleReFramedBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(CORNER, Corner.NORTH_EAST_DOWN).with(CORNER_FACE, 0)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(CORNER,CORNER_FACE)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + Corner corner = BlockHelper.getPlacementCorner(ctx); + return super.getPlacementState(ctx) + .with(CORNER, corner) + .with(CORNER_FACE, corner.getDirectionIndex(ctx.getSide().getOpposite())); + } + + @Override + @SuppressWarnings("deprecation") + public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context); + + + @Override + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + Corner corner = state.get(CORNER); + Direction face = corner.getDirection(state.get(CORNER_FACE)); + return state + .with(CORNER, corner.rotate(rotation)) + .with(CORNER_FACE, corner.getDirectionIndex(rotation.rotate(face))); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + Corner corner = state.get(CORNER); + Direction face = corner.getDirection(state.get(CORNER_FACE)); + return state + .with(CORNER, corner.mirror(mirror)) + .with(CORNER_FACE, corner.getDirectionIndex(mirror.apply(face))); + } + + @Override + public abstract VoxelShape getShape(BlockState state, int i); +} diff --git a/src/main/java/fr/adrien1106/reframed/block/PillarReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/PillarReFramedBlock.java index 1360d9e..dab0224 100644 --- a/src/main/java/fr/adrien1106/reframed/block/PillarReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/PillarReFramedBlock.java @@ -32,14 +32,17 @@ public abstract class PillarReFramedBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context); @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(AXIS, rotation.rotate(Direction.get(Direction.AxisDirection.POSITIVE, state.get(AXIS))).getAxis()); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(AXIS, mirror.apply(Direction.get(Direction.AxisDirection.POSITIVE, state.get(AXIS))).getAxis()); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java index c2cd457..8b80451 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java @@ -60,6 +60,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } @Override + @SuppressWarnings("deprecation") public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!canUse(world, pos, player)) return ActionResult.PASS; ActionResult result = BlockHelper.useUpgrade(state, world, pos, player, hand); @@ -73,6 +74,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } @Override + @SuppressWarnings("deprecation") public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { if(!(new_state.getBlock() instanceof ReFramedBlock) && world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity && @@ -151,6 +153,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } @Override + @SuppressWarnings("deprecation") public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { return isGhost(view, pos) ? VoxelShapes.empty() @@ -158,6 +161,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } @Override + @SuppressWarnings("deprecation") public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) { return isGhost(view, pos) ? VoxelShapes.empty() @@ -174,11 +178,13 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { } @Override + @SuppressWarnings("deprecation") public int getWeakRedstonePower(BlockState state, BlockView view, BlockPos pos, Direction dir) { return view.getBlockEntity(pos) instanceof ReFramedEntity be && be.emitsRedstone() ? 15 : 0; } @Override + @SuppressWarnings("deprecation") public int getStrongRedstonePower(BlockState state, BlockView view, BlockPos pos, Direction dir) { return getWeakRedstonePower(state, view, pos, dir); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java index 15d8f9b..5fcca2d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java @@ -51,6 +51,7 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { return canPlaceAt(world, pos, getDirection(state).getOpposite()); } @@ -96,6 +97,7 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer stackMerger) { if (explosion.getDestructionType() == Explosion.DestructionType.TRIGGER_BLOCK && !world.isClient() && !(Boolean)state.get(POWERED)) { powerOn(state, world, pos); @@ -120,6 +122,7 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return BUTTON_VOXELS[ (state.get(POWERED) ? 12 : 0) + @@ -129,11 +132,13 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(HORIZONTAL_FACING, mirror.apply(state.get(HORIZONTAL_FACING))); } @@ -159,16 +164,19 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean emitsRedstonePower(BlockState state) { return true; } @Override + @SuppressWarnings("deprecation") public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { if (state.get(POWERED)) tryPowerWithProjectiles(state, world, pos); } @Override + @SuppressWarnings("deprecation") public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { if (!world.isClient && !state.get(POWERED)) tryPowerWithProjectiles(state, world, pos); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java index 4cc239f..6508a90 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java @@ -57,6 +57,7 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { BlockPos pos_down = pos.down(); BlockState state_down = world.getBlockState(pos_down); @@ -64,6 +65,7 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public void neighborUpdate(BlockState state, World world, BlockPos pos, Block source, BlockPos sourcePos, boolean notify) { if (world.isClient) return; boolean powered = world.isReceivingRedstonePower(pos) @@ -162,6 +164,7 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return switch (type) { case LAND, AIR -> state.get(OPEN); @@ -170,6 +173,7 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer stack_merger) { if (explosion.getDestructionType() == Explosion.DestructionType.TRIGGER_BLOCK && !world.isClient() @@ -192,6 +196,7 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { Direction direction = state.get(HORIZONTAL_FACING); if (state.get(OPEN)) direction = switch (state.get(DOOR_HINGE)) { @@ -202,16 +207,19 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return mirror == BlockMirror.NONE ? state : state.with(HORIZONTAL_FACING, mirror.apply(state.get(HORIZONTAL_FACING))).cycle(DOOR_HINGE); } @Override + @SuppressWarnings("deprecation") public long getRenderingSeed(BlockState state, BlockPos pos) { return MathHelper.hashCode(pos.getX(), pos.down(state.get(DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), pos.getZ()); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java index 459c5b0..c31db83 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java @@ -19,7 +19,6 @@ import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import static net.minecraft.util.shape.VoxelShapes.empty; -import static net.minecraft.util.shape.VoxelShapes.fullCube; public abstract class ReFramedDoubleBlock extends ReFramedBlock { public ReFramedDoubleBlock(Settings settings) { @@ -61,7 +60,7 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock { @Override public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty() : fullCube(); + return isGhost(view, pos) ? empty() : getOutlineShape(state, view, pos, ctx); } @Override diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedFenceBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedFenceBlock.java index d34b717..de44d4c 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedFenceBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedFenceBlock.java @@ -56,6 +56,7 @@ public class ReFramedFenceBlock extends ConnectingReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getOutlineShape(state, world, pos, context); } @@ -66,10 +67,12 @@ public class ReFramedFenceBlock extends ConnectingReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return false; } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult result = super.onUse(state, world, pos, player, hand, hit); if (result.isAccepted()) return result; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index dcfff14..e2eb626 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -25,6 +25,7 @@ import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; +import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { @@ -42,6 +43,7 @@ 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)); @@ -51,7 +53,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { || ( !( block_item.getBlock() == this - && ((ReFramedHalfStairsStairBlock) ReFramed.HALF_STAIRS_STAIR) + && ReFramed.HALF_STAIRS_STAIR .matchesShape( context.getHitPos(), context.getBlockPos(), @@ -92,6 +94,15 @@ 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)) { + Corner corner = BlockHelper.getPlacementCorner(ctx); + Direction face = current_state.get(FACING); + if (!corner.hasDirection(face)) corner = corner.change(face.getOpposite()); + return ReFramed.SLABS_INNER_STAIR.getDefaultState() + .with(CORNER, corner) + .with(CORNER_FACE, corner.getDirectionIndex(face)) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + } Corner corner = BlockHelper.getPlacementCorner(ctx); return super.getPlacementState(ctx) @@ -100,11 +111,13 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getHalfStairShape(state.get(CORNER), state.get(CORNER_FACE)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { Corner corner = state.get(CORNER).rotate(rotation); Direction face = state.get(CORNER).getDirection(state.get(CORNER_FACE)); @@ -112,6 +125,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { Corner corner = state.get(CORNER).mirror(mirror); Direction face = state.get(CORNER).getDirection(state.get(CORNER_FACE)); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java index de1d8dc..07c3f81 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java @@ -21,7 +21,6 @@ import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.getSmallCubeSh import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER; import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE; import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN; -import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBlock { @@ -44,16 +43,13 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty(): getOutlineShape(state, view, pos, ctx); - } - - @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getSlabShape(state.get(CORNER).getDirection(state.get(CORNER_FACE))); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { Corner corner = state.get(CORNER).rotate(rotation); Direction face = state.get(CORNER).getDirection(state.get(CORNER_FACE)); @@ -61,6 +57,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { Corner corner = state.get(CORNER).mirror(mirror); Direction face = state.get(CORNER).getDirection(state.get(CORNER_FACE)); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java index 2817427..38548bb 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java @@ -21,7 +21,6 @@ import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairSh import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.Edge.*; -import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlock { public ReFramedHalfStairsStairBlock(Settings settings) { @@ -41,21 +40,19 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty(): getStairShape(state.get(EDGE), StairShape.STRAIGHT); - } - - @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStairShape(state.get(EDGE), StairShape.STRAIGHT); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(EDGE, state.get(EDGE).rotate(rotation)); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(EDGE, state.get(EDGE).mirror(mirror)); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index 46d8037..9b9e0ba 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -9,8 +9,6 @@ import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.loot.context.LootContextParameterSet; import net.minecraft.state.StateManager; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; @@ -32,6 +30,7 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { } @Override + @SuppressWarnings("deprecation") public List getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) { List drops = super.getDroppedStacks(state, builder); drops.forEach((stack) -> { @@ -68,16 +67,6 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { return previous.with(LAYERS, previous.get(LAYERS) + 1); } - @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); - } - - @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.with(FACING, mirror.apply(state.get(FACING))); - } - static { VoxelListBuilder builder = VoxelListBuilder.create(createCuboidShape(0, 0, 0, 16, 2, 16), 48) .add(createCuboidShape(0, 0, 0, 16, 4, 16)) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java index 1896945..84d61aa 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java @@ -95,6 +95,7 @@ public class ReFramedPillarsWallBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { VoxelShape shape = WALL_VOXELS[0]; for (Direction dir: Direction.Type.HORIZONTAL) { @@ -106,6 +107,7 @@ public class ReFramedPillarsWallBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getWallShape(rotation.rotate(dir)), state.get(getWallShape(dir))) @@ -113,6 +115,7 @@ public class ReFramedPillarsWallBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getWallShape(mirror.apply(dir)), state.get(getWallShape(dir))) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java index a90423d..f9fd178 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java @@ -74,6 +74,7 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getConnectionProperty(rotation.rotate(dir)), state.get(getConnectionProperty(dir))) @@ -81,6 +82,7 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getConnectionProperty(mirror.apply(dir)), state.get(getConnectionProperty(dir))) @@ -104,6 +106,7 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { VoxelShape shape = FENCE_VOXELS[0]; for (Direction dir: Direction.Type.HORIZONTAL) { @@ -124,6 +127,7 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getOutlineShape(state, world, pos, context); } @@ -134,6 +138,7 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return false; } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 0c8252e..7ff057a 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -41,15 +41,19 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canReplace(BlockState state, ItemPlacementContext context) { if (context.getPlayer() == null || context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) ) return false; - // allow replacing with slab and step - if (block_item.getBlock() != this && block_item.getBlock() != ReFramed.STEP) - 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 + ) return false; // check if the player is clicking on the inner part of the block return ReFramed.SLABS_CUBE @@ -73,16 +77,19 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getSlabShape(state.get(FACING)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(FACING, rotation.rotate(state.get(FACING))); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(FACING, mirror.apply(state.get(FACING))); } @@ -100,6 +107,10 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { @Override public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.SLABS_STAIR) + || new_state.isOf(ReFramed.SLABS_OUTER_STAIR) + || new_state.isOf(ReFramed.SLABS_INNER_STAIR) + ) return Map.of(1, 1); if (new_state.isOf(ReFramed.SLABS_CUBE)) return Map.of(1, state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1); return super.getThemeMap(state, new_state); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java index cec5797..674689d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java @@ -11,7 +11,6 @@ import net.minecraft.util.shape.VoxelShape; import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*; -import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static net.minecraft.state.property.Properties.AXIS; public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock { @@ -33,11 +32,13 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(AXIS, rotation.rotate(Direction.get(Direction.AxisDirection.POSITIVE, state.get(AXIS))).getAxis()); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(AXIS, mirror.apply(Direction.get(Direction.AxisDirection.POSITIVE, state.get(AXIS))).getAxis()); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsInnerStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsInnerStairBlock.java new file mode 100644 index 0000000..1540af7 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsInnerStairBlock.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.ReFramedSlabBlock.getSlabShape; +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 ReFramedSlabsInnerStairBlock extends CornerDoubleReFramedBlock { + + public ReFramedSlabsInnerStairBlock(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.INNER_LEFT + : StairShape.INNER_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 + ? getHalfStairShape(corner, corner.getDirectionIndex(face.getOpposite())) + : getSlabShape(face); + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsOuterStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsOuterStairBlock.java new file mode 100644 index 0000000..24d65af --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsOuterStairBlock.java @@ -0,0 +1,51 @@ +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.ReFramedSlabBlock.getSlabShape; +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 ReFramedSlabsOuterStairBlock extends CornerDoubleReFramedBlock { + + public ReFramedSlabsOuterStairBlock(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.getEdgeWith(face); + return getStairShape( + edge, + corner.getOtherDirection(edge).getDirection() == Direction.AxisDirection.POSITIVE + ? edge.getDirectionIndex(face) == 1 + ? StairShape.FIRST_OUTER_LEFT + : StairShape.SECOND_OUTER_LEFT + : edge.getDirectionIndex(face) == 1 + ? StairShape.FIRST_OUTER_RIGHT + : StairShape.SECOND_OUTER_RIGHT + ); + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Corner corner = state.get(CORNER); + Direction face = corner.getDirection(state.get(CORNER_FACE)); + return i == 2 + ? getSmallCubeShape(corner.change(face)) + : getSlabShape(face); + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java index ab8f8ba..b682731 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java @@ -21,7 +21,6 @@ import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; -import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock { @@ -44,16 +43,13 @@ public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock { } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty() : getOutlineShape(state, view, pos, ctx); - } - - @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStairShape(state.get(EDGE), StairShape.STRAIGHT); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { Edge edge = state.get(EDGE).rotate(rotation); Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); @@ -61,6 +57,7 @@ public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { Edge edge = state.get(EDGE).mirror(mirror); Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index e824c62..be3d187 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -25,6 +25,7 @@ import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; +import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { @@ -42,6 +43,7 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canReplace(BlockState state, ItemPlacementContext context) { if (context.getPlayer() == null) return false; Corner corner = state.get(CORNER); @@ -63,21 +65,21 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { && !( block_item.getBlock() == this && ( - ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) + ReFramed.SMALL_CUBES_STEP .matchesShape( context.getHitPos(), context.getBlockPos(), ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection())), corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 ) - || ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) + || ReFramed.SMALL_CUBES_STEP .matchesShape( context.getHitPos(), context.getBlockPos(), ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getSecondDirection())), corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 ) - || ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) + || ReFramed.SMALL_CUBES_STEP .matchesShape( context.getHitPos(), context.getBlockPos(), @@ -118,22 +120,33 @@ 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)) { + Corner corner = BlockHelper.getPlacementCorner(ctx); + Direction face = current_state.get(FACING); + if (!corner.hasDirection(face)) corner = corner.change(face.getOpposite()); + return ReFramed.SLABS_OUTER_STAIR.getDefaultState() + .with(CORNER, corner) + .with(CORNER_FACE, corner.getDirectionIndex(face)) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); } return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx)); } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getSmallCubeShape(state.get(CORNER)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(CORNER, state.get(CORNER).rotate(rotation)); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(CORNER, state.get(CORNER).mirror(mirror)); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java index 7d5b4fb..c5d5a3e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java @@ -18,7 +18,6 @@ import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.SMALL_CUBE_VOXELS; import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; -import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBlock { @@ -39,21 +38,19 @@ public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBloc } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty(): getStepShape(state.get(EDGE)); - } - - @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStepShape(state.get(EDGE)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(EDGE, state.get(EDGE).rotate(rotation)); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(EDGE, state.get(EDGE).mirror(mirror)); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index 60f7601..e3ed281 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -45,6 +45,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canReplace(BlockState state, ItemPlacementContext context) { if (context.getPlayer() == null) return false; return !( @@ -94,11 +95,13 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStairShape(state.get(EDGE), state.get(STAIR_SHAPE)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { Edge prev_edge = state.get(EDGE); Edge edge = prev_edge.rotate(rotation); @@ -115,6 +118,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { Edge prev_edge = state.get(EDGE); Edge edge = prev_edge.mirror(mirror); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java index ab16582..51d402a 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java @@ -36,6 +36,7 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) { return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved) .with(STAIR_SHAPE, BlockHelper.getStairsShape(state.get(EDGE), world, pos)); @@ -52,6 +53,7 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock { @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { Edge prev_edge = state.get(EDGE); Edge edge = prev_edge.rotate(rotation); @@ -68,6 +70,7 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { Edge prev_edge = state.get(EDGE); Edge edge = prev_edge.mirror(mirror); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index f344db9..50300f7 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -41,6 +41,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canReplace(BlockState state, ItemPlacementContext context) { if (context.getPlayer() == null || context.getPlayer().isSneaking() @@ -96,8 +97,8 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { else if (matchesShape(hit, pos, current_state.with(EDGE, edge.getOpposite(edge.getSecondDirection())) )) return ReFramed.STEPS_SLAB.getDefaultState() - .with(FACING, edge.getFirstDirection()) - .with(AXIS, edge.getSecondDirection().getAxis()) + .with(FACING, edge.getSecondDirection()) + .with(AXIS, edge.getFirstDirection().getAxis()) .with(WATERLOGGED, current_state.get(WATERLOGGED)); // Steps Cross @@ -121,16 +122,19 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStepShape(state.get(EDGE)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(EDGE, state.get(EDGE).rotate(rotation)); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(EDGE, state.get(EDGE).mirror(mirror)); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java index 82ebc0a..6e71933 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java @@ -21,7 +21,6 @@ import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; import static net.minecraft.state.property.Properties.AXIS; import static net.minecraft.state.property.Properties.FACING; -import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock { @@ -44,16 +43,13 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock { } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { - return isGhost(view, pos) ? empty() : getSlabShape(state.get(FACING)); - } - - @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getSlabShape(state.get(FACING)); } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state .with(AXIS, rotation.rotate(Direction.get(Direction.AxisDirection.POSITIVE, state.get(AXIS))).getAxis()) @@ -61,6 +57,7 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { if (state.get(FACING).getAxis() != Axis.Y) return state.with(FACING, mirror.apply(state.get(FACING))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java index 3ae4785..8a6b821 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java @@ -48,6 +48,7 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public void neighborUpdate(BlockState state, World world, BlockPos pos, Block source, BlockPos sourcePos, boolean notify) { if (world.isClient) return; boolean powered = world.isReceivingRedstonePower(pos); @@ -99,6 +100,7 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return switch (type) { case LAND, AIR -> state.get(OPEN); @@ -107,6 +109,7 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer stack_merger) { if (explosion.getDestructionType() == Explosion.DestructionType.TRIGGER_BLOCK && !world.isClient() @@ -129,6 +132,7 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { int index; if (!state.get(OPEN)) index = state.get(BLOCK_HALF) == BlockHalf.BOTTOM ? 0 : 1; @@ -137,11 +141,13 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state.with(HORIZONTAL_FACING, mirror.apply(state.get(HORIZONTAL_FACING))); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java index 7fcd9f9..c8a6a46 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java @@ -87,6 +87,7 @@ public class ReFramedWallBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { VoxelShape shape = state.get(UP) ? WALL_VOXELS[0]: VoxelShapes.empty(); for (Direction dir : Direction.Type.HORIZONTAL) { @@ -109,6 +110,7 @@ public class ReFramedWallBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getWallShape(rotation.rotate(dir)), state.get(getWallShape(dir))) @@ -116,6 +118,7 @@ public class ReFramedWallBlock extends WaterloggableReFramedBlock { } @Override + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return Direction.Type.HORIZONTAL.stream().reduce(state, (s, dir) -> s.with(getWallShape(mirror.apply(dir)), state.get(getWallShape(dir))) diff --git a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedBlock.java index daea024..b0040bb 100644 --- a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedBlock.java @@ -33,10 +33,13 @@ public class WaterloggableReFramedBlock extends ReFramedBlock implements Waterlo } @Override + @SuppressWarnings("deprecation") public FluidState getFluidState(BlockState state) { return state.get(Properties.WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } - + + @Override + @SuppressWarnings("deprecation") public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState otherState, WorldAccess world, BlockPos pos, BlockPos moved) { if(state.get(Properties.WATERLOGGED)) world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); return super.getStateForNeighborUpdate(state, direction, otherState, world, pos, moved); diff --git a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java index 60e10e9..0b98508 100644 --- a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java @@ -33,10 +33,13 @@ public class WaterloggableReFramedDoubleBlock extends ReFramedDoubleBlock implem } @Override + @SuppressWarnings("deprecation") public FluidState getFluidState(BlockState state) { return state.get(Properties.WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } + @Override + @SuppressWarnings("deprecation") public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState otherState, WorldAccess world, BlockPos pos, BlockPos moved) { if(state.get(Properties.WATERLOGGED)) world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); return super.getStateForNeighborUpdate(state, direction, otherState, world, pos, moved); diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 92f1430..def2f9d 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -147,6 +147,12 @@ public class ReFramedClient implements ClientModInitializer { // 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"))); + // 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"))); + // 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"))); //item model assignments (in lieu of models/item/___.json) @@ -174,6 +180,8 @@ public class ReFramedClient implements ClientModInitializer { 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); } 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 56085fe..34a863c 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -27,6 +27,8 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); + providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); + providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index 65ef86d..df4f020 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -29,6 +29,8 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); + providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); + providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/CornerDouble.java b/src/main/java/fr/adrien1106/reframed/generator/block/CornerDouble.java new file mode 100644 index 0000000..e4bbc36 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/CornerDouble.java @@ -0,0 +1,77 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.GBlockstate; +import fr.adrien1106.reframed.util.blocks.Corner; +import net.minecraft.block.Block; +import net.minecraft.data.client.MultipartBlockStateSupplier; +import net.minecraft.util.Identifier; + +import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class CornerDouble { + + + public static MultipartBlockStateSupplier getMultipart(Block block, String model_name) { + Identifier model_id = ReFramed.id(model_name + "_special"); + Identifier side_id = ReFramed.id(model_name + "_side_special"); + return MultipartBlockStateSupplier.create(block) + // BOTTOM + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R0, R270)) + // TOP + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 2), + GBlockstate.variant(model_id, true, R180, R270)) + // EAST + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R90, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R270, R0)) + // SOUTH + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R90, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_UP, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, Corner.EAST_SOUTH_DOWN, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R270, R90)) + // WEST + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R90, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_UP, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, Corner.SOUTH_WEST_DOWN, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R270, R180)) + // NORTH + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_DOWN, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R0, R270)) + .with(GBlockstate.when(CORNER, Corner.NORTH_EAST_UP, CORNER_FACE, 0), + GBlockstate.variant(side_id, true, R90, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_UP, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R180, R270)) + .with(GBlockstate.when(CORNER, Corner.WEST_NORTH_DOWN, CORNER_FACE, 1), + GBlockstate.variant(side_id, true, R270, R270)) + ; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SlabsInnerStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsInnerStair.java new file mode 100644 index 0000000..8e2af6d --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsInnerStair.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 SlabsInnerStair 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.HALF_STAIR) + .input(ReFramed.SLAB) + .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, "slabs_inner_stair"); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SlabsOuterStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsOuterStair.java new file mode 100644 index 0000000..5b9e94d --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsOuterStair.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 SlabsOuterStair 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.SLAB) + .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, "slabs_outer_stair"); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java b/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java index f6a2f65..4e44632 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java @@ -116,6 +116,14 @@ public enum Corner implements StringIdentifiable { ); } + public Edge getEdgeWith(Direction direction) { + return Edge.getByDirections( + first_direction == direction ? first_direction : second_direction, + first_direction == direction ? second_direction : third_direction + ); + + } + public Direction getOtherDirection(Edge edge) { if (edge.getFirstDirection() != second_direction && edge.getSecondDirection() != second_direction) return second_direction; if (edge.getFirstDirection() != third_direction && edge.getSecondDirection() != third_direction) return third_direction; @@ -137,4 +145,13 @@ public enum Corner implements StringIdentifiable { mirror.apply(third_direction) ); } + + public Corner change(Direction face) { + Direction opposite = face.getOpposite(); + return getByDirections( + first_direction == face ? opposite : first_direction, + second_direction == face ? opposite : second_direction, + third_direction == face ? opposite : third_direction + ); + } } diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/slab.json new file mode 100644 index 0000000..48f238a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/slab.json @@ -0,0 +1,67 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "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"}, + "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"} + } + }, + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "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"} + } + }, + { + "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"} + } + } + ], + "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/slabs_stair/inner/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/slab.json new file mode 100644 index 0000000..21d1699 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/slab.json @@ -0,0 +1,67 @@ +{ + "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, 8]}, + "faces": { + "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], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, 0]}, + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"}, + "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"} + } + }, + { + "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"}, + "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"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top"}, + "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/slabs_stair/outer/cube.json b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/cube.json new file mode 100644 index 0000000..02cfc46 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/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/slabs_stair/outer/side/cube.json b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/cube.json new file mode 100644 index 0000000..dca815f --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/cube.json @@ -0,0 +1,36 @@ +{ + "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"}, + "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/slabs_stair/outer/side/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/slab.json new file mode 100644 index 0000000..e65e174 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/side/slab.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"}, + "west": {"uv": [8, 8, 16, 16], "texture": "#side"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "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"} + } + }, + { + "from": [8, 0, 0], + "to": [16, 16, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, -8]}, + "faces": { + "north": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "west": {"uv": [0, 0, 8, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 8, 16, 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 diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/outer/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/slab.json new file mode 100644 index 0000000..9d1d3e0 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/outer/slab.json @@ -0,0 +1,55 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "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"}, + "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": [0, 0, 8]}, + "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": [0, 0, 0], + "to": [8, 8, 16], + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"}, + "south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 8, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 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 From 5812812bd9a7203e8bc6a139dcd893cd2066f407 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 17 Jun 2024 19:19:36 +0200 Subject: [PATCH 03/10] feat: added missing models --- .../block/slabs_stair/inner/half_stair.json | 58 +++++++++++++++++++ .../slabs_stair/inner/side/half_stair.json | 58 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/inner/half_stair.json create mode 100644 src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/half_stair.json diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/inner/half_stair.json b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/half_stair.json new file mode 100644 index 0000000..5f4da12 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/half_stair.json @@ -0,0 +1,58 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 8], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 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"} + } + }, + { + "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"} + } + }, + { + "from": [8, 8, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "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"} + } + } + ], + "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/slabs_stair/inner/side/half_stair.json b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/half_stair.json new file mode 100644 index 0000000..b29bd52 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/inner/side/half_stair.json @@ -0,0 +1,58 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 8], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 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"} + } + }, + { + "from": [0, 0, 0], + "to": [8, 8, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, 0]}, + "faces": { + "north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "down"}, + "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"} + } + }, + { + "from": [0, 0, 8], + "to": [8, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, 8]}, + "faces": { + "east": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "down"}, + "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"} + } + } + ], + "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 From 3bf9fc2268236d87fb365d8014cd1d51aa546185 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 17 Jun 2024 21:10:57 +0200 Subject: [PATCH 04/10] feat: added StepCross --- .../java/fr/adrien1106/reframed/ReFramed.java | 3 +- .../reframed/block/ReFramedStepBlock.java | 5 +- .../block/ReFramedStepsCrossBlock.java | 87 +++++++++++++++++++ .../reframed/client/ReFramedClient.java | 3 + .../reframed/generator/GBlockstate.java | 1 + .../reframed/generator/GRecipe.java | 1 + .../generator/block/SmallCubesStep.java | 39 +-------- .../reframed/generator/block/Step.java | 19 ++-- .../reframed/generator/block/StepsCross.java | 34 ++++++++ .../reframed/generator/block/StepsSlab.java | 7 +- .../reframed/models/block/step/cross.json | 36 ++++++++ 11 files changed, 187 insertions(+), 48 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedStepsCrossBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/StepsCross.java create mode 100644 src/main/resources/assets/reframed/models/block/step/cross.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 0ebcbe7..ef34dee 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -43,7 +43,7 @@ public class ReFramed implements ModInitializer { STAIR, STAIRS_CUBE, HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, - STEP, STEPS_SLAB, + STEP, STEPS_SLAB, STEPS_CROSS, LAYER, PILLAR, PILLARS_WALL, WALL, PANE, TRAPDOOR, DOOR, @@ -78,6 +78,7 @@ public class ReFramed implements ModInitializer { 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))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 50300f7..dda1c8d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -102,7 +102,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { .with(WATERLOGGED, current_state.get(WATERLOGGED)); // Steps Cross - return null; // TODO STEP cross + return ReFramed.STEPS_CROSS.getDefaultState() + .with(EDGE, edge) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); } else if (current_state.isOf(ReFramed.SLAB)) { Direction facing = current_state.get(FACING); Edge edge; @@ -145,6 +147,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { @Override public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.STEPS_CROSS)) return Map.of(1, 1); if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2); if (new_state.isOf(ReFramed.STEPS_SLAB)) return Map.of( diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsCrossBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsCrossBlock.java new file mode 100644 index 0000000..a1bc455 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsCrossBlock.java @@ -0,0 +1,87 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.VoxelHelper; +import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Edge; +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.BlockMirror; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; +import org.jetbrains.annotations.Nullable; + +import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; + +public class ReFramedStepsCrossBlock extends WaterloggableReFramedDoubleBlock { + + public static VoxelShape[] STEP_CROSS_VOXELS; + + public ReFramedStepsCrossBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(EDGE)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + Edge edge = BlockHelper.getPlacementCorner(ctx).getEdge(ctx.getSide().getOpposite()); + return super.getPlacementState(ctx).with(EDGE, edge); + } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return STEP_CROSS_VOXELS[state.get(EDGE).ordinal()]; + } + + @Override + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(EDGE, state.get(EDGE).rotate(rotation)); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.with(EDGE, state.get(EDGE).mirror(mirror)); + } + + @Override + public VoxelShape getShape(BlockState state, int i) { +// return getStepShape(i == 1 ? state.get(EDGE): state.get(EDGE).opposite()); + return getOutlineShape(state, null, null, null); + } + + static { + VoxelShape STEP_CROSS = VoxelShapes.combineAndSimplify( + getStepShape(Edge.NORTH_DOWN), + getStepShape(Edge.SOUTH_UP), + BooleanBiFunction.OR + ); + STEP_CROSS_VOXELS = VoxelHelper.VoxelListBuilder.create(STEP_CROSS, 12) + .add(VoxelHelper::rotateX) + .add(VoxelHelper::rotateX) + .add(VoxelHelper::rotateX) + .add(0, VoxelHelper::rotateCY) + .add(VoxelHelper::rotateZ) + .add(VoxelHelper::rotateZ) + .add(VoxelHelper::rotateZ) + .add(0, VoxelHelper::rotateCZ) + .add(VoxelHelper::rotateY) + .add(VoxelHelper::rotateY) + .add(VoxelHelper::rotateY) + .build(); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index def2f9d..4e0939a 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -153,6 +153,8 @@ public class ReFramedClient implements ClientModInitializer { // 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"))); + // SLABS OUTER STAIR + HELPER.addReFramedModel("steps_cross" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/cross"))); //item model assignments (in lieu of models/item/___.json) @@ -182,6 +184,7 @@ public class ReFramedClient implements ClientModInitializer { 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); } 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 34a863c..fd7962a 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -35,6 +35,7 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedStairsCubeBlock.class, new StairsCube()); providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); + providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedPaneBlock.class, new Pane()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index df4f020..39ba39a 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -37,6 +37,7 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedStairsCubeBlock.class, new StairsCube()); providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); + providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedPaneBlock.class, new Pane()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java index c7c547e..70e97c7 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java @@ -2,23 +2,15 @@ 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 net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.data.client.BlockStateSupplier; -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.EDGE; -import static fr.adrien1106.reframed.util.blocks.Edge.*; -import static fr.adrien1106.reframed.util.blocks.Edge.SOUTH_UP; -import static net.minecraft.data.client.VariantSettings.Rotation.*; public class SmallCubesStep implements RecipeSetter, BlockStateProvider { @@ -35,35 +27,6 @@ public class SmallCubesStep implements RecipeSetter, BlockStateProvider { @Override public BlockStateSupplier getMultipart(Block block) { - Identifier model_id = ReFramed.id("small_cubes_step_special"); - Identifier reverse_model_id = ReFramed.id("small_cubes_step_reverse_special"); - return MultipartBlockStateSupplier.create(block) - /* X AXIS */ - .with(GBlockstate.when(EDGE, DOWN_EAST), - GBlockstate.variant(model_id, true, R0, R0)) - .with(GBlockstate.when(EDGE, EAST_UP), - GBlockstate.variant(reverse_model_id, true, R180, R0)) - .with(GBlockstate.when(EDGE, UP_WEST), - GBlockstate.variant(model_id, true, R180, R180)) - .with(GBlockstate.when(EDGE, WEST_DOWN), - GBlockstate.variant(reverse_model_id, true, R0, R180)) - /* Y AXIS */ - .with(GBlockstate.when(EDGE, EAST_SOUTH), - GBlockstate.variant(model_id, true, R90, R0)) - .with(GBlockstate.when(EDGE, SOUTH_WEST), - GBlockstate.variant(model_id, true, R90, R90)) - .with(GBlockstate.when(EDGE, WEST_NORTH), - GBlockstate.variant(model_id, true, R90, R180)) - .with(GBlockstate.when(EDGE, NORTH_EAST), - GBlockstate.variant(model_id, true, R90, R270)) - /* Z AXIS */ - .with(GBlockstate.when(EDGE, DOWN_SOUTH), - GBlockstate.variant(reverse_model_id, true, R0, R90)) - .with(GBlockstate.when(EDGE, NORTH_DOWN), - GBlockstate.variant(model_id, true, R0, R270)) - .with(GBlockstate.when(EDGE, UP_NORTH), - GBlockstate.variant(reverse_model_id, true, R180, R270)) - .with(GBlockstate.when(EDGE, SOUTH_UP), - GBlockstate.variant(model_id, true, R180, R90)); + return Step.getMultipart(block, "small_cubes_step", "small_cubes_step_reverse"); } } diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Step.java b/src/main/java/fr/adrien1106/reframed/generator/block/Step.java index 0bd28a9..2ef2b3f 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/block/Step.java +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Step.java @@ -36,17 +36,26 @@ public class Step implements RecipeSetter, BlockStateProvider { @Override public BlockStateSupplier getMultipart(Block block) { - Identifier model_id = ReFramed.id("step_special"); + return getMultipart(block, "step"); + } + + public static BlockStateSupplier getMultipart(Block block, String model_name) { + return getMultipart(block, model_name, model_name); + } + + public static BlockStateSupplier getMultipart(Block block, String model_name, String reverse_model_name) { + Identifier model_id = ReFramed.id(model_name + "_special"); + Identifier reverse_model_id = ReFramed.id(reverse_model_name + "_special"); return MultipartBlockStateSupplier.create(block) /* X AXIS */ .with(GBlockstate.when(EDGE, DOWN_EAST), GBlockstate.variant(model_id, true, R0, R0)) .with(GBlockstate.when(EDGE, EAST_UP), - GBlockstate.variant(model_id, true, R180, R0)) + GBlockstate.variant(reverse_model_id, true, R180, R0)) .with(GBlockstate.when(EDGE, UP_WEST), GBlockstate.variant(model_id, true, R180, R180)) .with(GBlockstate.when(EDGE, WEST_DOWN), - GBlockstate.variant(model_id, true, R0, R180)) + GBlockstate.variant(reverse_model_id, true, R0, R180)) /* Y AXIS */ .with(GBlockstate.when(EDGE, EAST_SOUTH), GBlockstate.variant(model_id, true, R90, R0)) @@ -58,11 +67,11 @@ public class Step implements RecipeSetter, BlockStateProvider { GBlockstate.variant(model_id, true, R90, R270)) /* Z AXIS */ .with(GBlockstate.when(EDGE, DOWN_SOUTH), - GBlockstate.variant(model_id, true, R0, R90)) + GBlockstate.variant(reverse_model_id, true, R0, R90)) .with(GBlockstate.when(EDGE, NORTH_DOWN), GBlockstate.variant(model_id, true, R0, R270)) .with(GBlockstate.when(EDGE, UP_NORTH), - GBlockstate.variant(model_id, true, R180, R270)) + GBlockstate.variant(reverse_model_id, true, R180, R270)) .with(GBlockstate.when(EDGE, SOUTH_UP), GBlockstate.variant(model_id, true, R180, R90)); } diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/StepsCross.java b/src/main/java/fr/adrien1106/reframed/generator/block/StepsCross.java new file mode 100644 index 0000000..cd4b09b --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/StepsCross.java @@ -0,0 +1,34 @@ +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.BlockStateSupplier; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.RecipeProvider; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; + +public class StepsCross implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 8) + .pattern(" I") + .pattern("I ") + .input('I', ReFramed.STEP) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + return Step.getMultipart(block, "steps_cross"); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java b/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java index e2bc29b..0674f42 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java +++ b/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java @@ -9,7 +9,7 @@ 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.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.ItemConvertible; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.util.Identifier; @@ -25,9 +25,10 @@ public class StepsSlab implements RecipeSetter, BlockStateProvider { @Override public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); - ShapelessRecipeJsonBuilder + ShapedRecipeJsonBuilder .create(RecipeCategory.BUILDING_BLOCKS, convertible) - .input(ReFramed.STEP, 2) + .pattern("II") + .input('I', ReFramed.STEP) .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) .offerTo(exporter); diff --git a/src/main/resources/assets/reframed/models/block/step/cross.json b/src/main/resources/assets/reframed/models/block/step/cross.json new file mode 100644 index 0000000..95f0d84 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/step/cross.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 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 From 6f8304d638aa8ad2c407ba0cc95058484c786cba Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Tue, 18 Jun 2024 14:56:46 +0200 Subject: [PATCH 05/10] feat: added HalfStairsCubeStair and HalfStairsStepStair --- .../java/fr/adrien1106/reframed/ReFramed.java | 67 ++--- .../block/ReFramedHalfStairBlock.java | 68 ++--- .../ReFramedHalfStairsCubeStairBlock.java | 48 ++++ .../ReFramedHalfStairsStepStairBlock.java | 76 ++++++ .../reframed/block/ReFramedSlabBlock.java | 9 +- .../block/ReFramedSmallCubeBlock.java | 18 +- .../reframed/block/ReFramedStepBlock.java | 54 ++-- .../reframed/client/ReFramedClient.java | 256 +++++++++--------- .../reframed/generator/GBlockstate.java | 2 + .../reframed/generator/GRecipe.java | 2 + .../generator/block/HalfStairsCubeStair.java | 33 +++ .../generator/block/HalfStairsStepStair.java | 159 +++++++++++ .../reframed/util/blocks/BlockProperties.java | 1 + .../models/block/half_stair/base.json | 56 ++++ .../models/block/half_stair/base_side.json | 58 ++++ .../models/block/half_stair/stair/cube.json | 36 +++ .../block/half_stair/stair/cube_side.json | 35 +++ .../models/block/half_stair/stair/step_1.json | 47 ++++ .../models/block/half_stair/stair/step_2.json | 47 ++++ .../block/half_stair/stair/step_side_1.json | 47 ++++ .../block/half_stair/stair/step_side_2.json | 46 ++++ 21 files changed, 948 insertions(+), 217 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsCubeStairBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStepStairBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsCubeStair.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStepStair.java create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/base.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/base_side.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/cube.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/cube_side.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/step_1.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/step_2.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_1.json create mode 100644 src/main/resources/assets/reframed/models/block/half_stair/stair/step_side_2.json 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 From 4d353bab274eeb58fa5bef791ff03c182a734e9b Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Tue, 18 Jun 2024 15:23:59 +0200 Subject: [PATCH 06/10] refactor: changed method to non depreciated version --- src/main/java/fr/adrien1106/reframed/ReFramed.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 768c4bd..cb1de54 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -7,7 +7,6 @@ import fr.adrien1106.reframed.item.ReFramedBlueprintWrittenItem; import fr.adrien1106.reframed.item.ReFramedScrewdriverItem; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; -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; @@ -99,7 +98,7 @@ public class ReFramed implements ModInitializer { REFRAMED_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("camo"), - FabricBlockEntityTypeBuilder.create( + BlockEntityType.Builder.create( (pos, state) -> new ReFramedEntity(REFRAMED_BLOCK_ENTITY, pos, state), BLOCKS.stream() .filter(block -> !(block instanceof ReFramedDoubleBlock)) @@ -107,7 +106,7 @@ public class ReFramed implements ModInitializer { ); REFRAMED_DOUBLE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("double_camo"), - FabricBlockEntityTypeBuilder.create( + BlockEntityType.Builder.create( (pos, state) -> new ReFramedDoubleEntity(REFRAMED_DOUBLE_BLOCK_ENTITY, pos, state), BLOCKS.stream() .filter(block -> block instanceof ReFramedDoubleBlock) From d325e3c5a5fbb2c9b5d423d5b028eef54a5b310e Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 19 Jun 2024 02:42:03 +0200 Subject: [PATCH 07/10] feat: added 3 blocks and some refactoring --- .../java/fr/adrien1106/reframed/ReFramed.java | 9 +- .../block/ConnectingReFramedBlock.java | 7 - .../block/EdgeDoubleReFramedBlock.java | 64 ++++++ .../block/HalfLayerDoubleReFramedBlock.java | 45 +++++ .../reframed/block/LayeredReFramedBlock.java | 64 ++++++ .../reframed/block/ReFramedBlock.java | 3 + .../reframed/block/ReFramedButtonBlock.java | 1 - .../reframed/block/ReFramedDoorBlock.java | 7 - .../block/ReFramedHalfLayerBlock.java | 188 ++++++++++++++++++ .../reframed/block/ReFramedLayerBlock.java | 50 ++--- .../block/ReFramedPillarsWallBlock.java | 7 - .../block/ReFramedPostFenceBlock.java | 7 - .../reframed/block/ReFramedSlabBlock.java | 20 +- .../block/ReFramedSlabsHalfLayerBlock.java | 62 ++++++ .../block/ReFramedSlabsStairBlock.java | 40 +--- .../reframed/block/ReFramedStairBlock.java | 10 +- .../block/ReFramedStairsCubeBlock.java | 8 - .../reframed/block/ReFramedStepBlock.java | 28 ++- .../block/ReFramedStepsHalfLayerBlock.java | 62 ++++++ .../reframed/block/ReFramedTrapdoorBlock.java | 7 - .../reframed/block/ReFramedWallBlock.java | 7 - .../reframed/client/ReFramedClient.java | 44 ++++ .../reframed/generator/GBlockstate.java | 3 + .../reframed/generator/GRecipe.java | 3 + .../reframed/generator/block/HalfLayer.java | 171 ++++++++++++++++ .../generator/block/SlabsHalfLayer.java | 93 +++++++++ .../generator/block/StepsHalfLayer.java | 69 +++++++ .../adrien1106/reframed/util/VoxelHelper.java | 19 ++ .../block/half_layer/east/layer_10.json | 22 ++ .../block/half_layer/east/layer_12.json | 22 ++ .../block/half_layer/east/layer_14.json | 22 ++ .../block/half_layer/east/layer_16.json | 22 ++ .../models/block/half_layer/east/layer_2.json | 22 ++ .../models/block/half_layer/east/layer_4.json | 22 ++ .../models/block/half_layer/east/layer_6.json | 22 ++ .../models/block/half_layer/east/layer_8.json | 22 ++ .../block/half_layer/side/layer_10.json | 22 ++ .../block/half_layer/side/layer_12.json | 22 ++ .../block/half_layer/side/layer_14.json | 22 ++ .../block/half_layer/side/layer_16.json | 22 ++ .../models/block/half_layer/side/layer_2.json | 22 ++ .../models/block/half_layer/side/layer_4.json | 22 ++ .../models/block/half_layer/side/layer_6.json | 22 ++ .../models/block/half_layer/side/layer_8.json | 22 ++ .../block/half_layer/slab/east/layer_10.json | 22 ++ .../block/half_layer/slab/east/layer_12.json | 22 ++ .../block/half_layer/slab/east/layer_14.json | 22 ++ .../block/half_layer/slab/east/layer_16.json | 22 ++ .../block/half_layer/slab/east/layer_2.json | 22 ++ .../block/half_layer/slab/east/layer_4.json | 22 ++ .../block/half_layer/slab/east/layer_6.json | 22 ++ .../block/half_layer/slab/east/layer_8.json | 22 ++ .../block/half_layer/slab/side/layer_10.json | 22 ++ .../block/half_layer/slab/side/layer_12.json | 22 ++ .../block/half_layer/slab/side/layer_14.json | 22 ++ .../block/half_layer/slab/side/layer_16.json | 22 ++ .../block/half_layer/slab/side/layer_2.json | 22 ++ .../block/half_layer/slab/side/layer_4.json | 22 ++ .../block/half_layer/slab/side/layer_6.json | 22 ++ .../block/half_layer/slab/side/layer_8.json | 22 ++ .../models/block/layer_top/layer_2.json | 22 ++ .../models/block/layer_top/layer_4.json | 22 ++ .../models/block/layer_top/layer_6.json | 22 ++ .../models/block/layer_top/layer_8.json | 22 ++ .../assets/reframed/models/block/step/up.json | 36 ++++ 65 files changed, 1790 insertions(+), 136 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/EdgeDoubleReFramedBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/HalfLayerDoubleReFramedBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/LayeredReFramedBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedHalfLayerBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsHalfLayerBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedStepsHalfLayerBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfLayer.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SlabsHalfLayer.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/StepsHalfLayer.java create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_10.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_12.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_14.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_16.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_2.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_4.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_6.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/east/layer_8.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_10.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_12.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_14.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_16.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_2.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_4.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_6.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/side/layer_8.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_10.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_12.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_14.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_16.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_2.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_4.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_6.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_8.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_10.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_12.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_14.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_16.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_2.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_4.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_6.json create mode 100644 src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_8.json create mode 100644 src/main/resources/assets/reframed/models/block/layer_top/layer_2.json create mode 100644 src/main/resources/assets/reframed/models/block/layer_top/layer_4.json create mode 100644 src/main/resources/assets/reframed/models/block/layer_top/layer_6.json create mode 100644 src/main/resources/assets/reframed/models/block/layer_top/layer_8.json create mode 100644 src/main/resources/assets/reframed/models/block/step/up.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index cb1de54..60fefd8 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -41,9 +41,9 @@ public class ReFramed implements ModInitializer { SMALL_CUBE, SMALL_CUBES_STEP, STAIR, STAIRS_CUBE, 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, + SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, SLABS_HALF_LAYER, + STEP, STEPS_SLAB, STEPS_CROSS, STEPS_HALF_LAYER, + LAYER, HALF_LAYER, PILLAR, PILLARS_WALL, WALL, PANE, TRAPDOOR, DOOR, BUTTON, @@ -72,14 +72,17 @@ public class ReFramed implements ModInitializer { 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))); + HALF_LAYER = registerBlock("half_layer" , new ReFramedHalfLayerBlock(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))); + SLABS_HALF_LAYER = registerBlock("slabs_half_layer" , new ReFramedSlabsHalfLayerBlock(cp(Blocks.OAK_SLAB))); 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))); + STEPS_HALF_LAYER = registerBlock("steps_half_layer" , new ReFramedStepsHalfLayerBlock(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))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java index 26f67dd..b2964da 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ConnectingReFramedBlock.java @@ -54,13 +54,6 @@ public abstract class ConnectingReFramedBlock extends WaterloggableReFramedBlock return placementState(state, world, pos, this::connectsTo); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { diff --git a/src/main/java/fr/adrien1106/reframed/block/EdgeDoubleReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/EdgeDoubleReFramedBlock.java new file mode 100644 index 0000000..d77b113 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/EdgeDoubleReFramedBlock.java @@ -0,0 +1,64 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Edge; +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.BlockMirror; +import net.minecraft.util.BlockRotation; +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.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; + +public abstract class EdgeDoubleReFramedBlock extends WaterloggableReFramedDoubleBlock { + + public EdgeDoubleReFramedBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(EDGE, EDGE_FACE)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + Edge edge = BlockHelper.getPlacementEdge(ctx); + return super.getPlacementState(ctx) + .with(EDGE, edge) + .with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite())); + } + + @Override + @SuppressWarnings("deprecation") + public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context); + + @Override + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + Edge edge = state.get(EDGE).rotate(rotation); + Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); + return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(rotation.rotate(face))); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + Edge edge = state.get(EDGE).mirror(mirror); + Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); + return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(mirror.apply(face))); + } + + @Override + public abstract VoxelShape getShape(BlockState state, int i); + +} diff --git a/src/main/java/fr/adrien1106/reframed/block/HalfLayerDoubleReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/HalfLayerDoubleReFramedBlock.java new file mode 100644 index 0000000..ce4e5d6 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/HalfLayerDoubleReFramedBlock.java @@ -0,0 +1,45 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.ReFramed; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.context.LootContextParameterSet; +import net.minecraft.state.StateManager; + +import java.util.List; + +import static net.minecraft.state.property.Properties.LAYERS; + +public abstract class HalfLayerDoubleReFramedBlock extends EdgeDoubleReFramedBlock { + + public HalfLayerDoubleReFramedBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(LAYERS, 1)); + } + + @Override + @SuppressWarnings("deprecation") + public List getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) { + List drops = super.getDroppedStacks(state, builder); + drops.add(new ItemStack(ReFramed.HALF_LAYER, state.get(LAYERS)-1)); + return drops; + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(LAYERS)); + } + + @Override + @SuppressWarnings("deprecation") + public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null + || context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + ) return false; + return block_item.getBlock() == ReFramed.HALF_LAYER && state.get(LAYERS) < 8; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/LayeredReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/LayeredReFramedBlock.java new file mode 100644 index 0000000..38d2a83 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/LayeredReFramedBlock.java @@ -0,0 +1,64 @@ +package fr.adrien1106.reframed.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.context.LootContextParameterSet; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +import static net.minecraft.state.property.Properties.LAYERS; + +public abstract class LayeredReFramedBlock extends WaterloggableReFramedBlock { + + public LayeredReFramedBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(LAYERS, 1)); + } + + @Override + @SuppressWarnings("deprecation") + public List getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) { + List drops = super.getDroppedStacks(state, builder); + drops.forEach((stack) -> { + if (stack.getItem() instanceof BlockItem bi && bi.getBlock() instanceof LayeredReFramedBlock) + stack.setCount(state.get(LAYERS)); + }); + return drops; + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(LAYERS)); + } + + @Override + @SuppressWarnings("deprecation") + public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context); + + @Override + @SuppressWarnings("deprecation") + public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || !(block_item.getBlock() == this && state.get(LAYERS) < 8) + ); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos()); + if (!previous.isOf(this)) return super.getPlacementState(ctx); + return previous.with(LAYERS, previous.get(LAYERS) + 1); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java index 8b80451..274099e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java @@ -76,6 +76,8 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { @Override @SuppressWarnings("deprecation") public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { + if (!new_state.isOf(state.getBlock())) world.removeBlockEntity(pos); + if(!(new_state.getBlock() instanceof ReFramedBlock) && world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) @@ -168,6 +170,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider { : super.getCullingShape(state, view, pos); } + @SuppressWarnings("deprecation") public VoxelShape getShape(BlockState state, int i) { // assuming the shape don't need the world and position return getOutlineShape(state, null, null, null); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java index 5fcca2d..482fdae 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedButtonBlock.java @@ -149,7 +149,6 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock { if(!state.isOf(new_state.getBlock())) { if (!moved && state.get(POWERED)) updateNeighbors(state, world, pos); - world.removeBlockEntity(pos); } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java index 6508a90..11a1d9f 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoorBlock.java @@ -128,13 +128,6 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock { return super.onBreak(world, pos, state, player); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState other, WorldAccess world, BlockPos pos, BlockPos moved) { if (direction.getAxis() == Direction.Axis.Y diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfLayerBlock.java new file mode 100644 index 0000000..3f47af8 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfLayerBlock.java @@ -0,0 +1,188 @@ +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.Edge; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.util.BlockMirror; +import net.minecraft.util.BlockRotation; +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 java.util.Map; + +import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static net.minecraft.state.property.Properties.*; + +public class ReFramedHalfLayerBlock extends LayeredReFramedBlock { + + public static final VoxelShape[] HALF_LAYER_VOXELS; + + public ReFramedHalfLayerBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(EDGE, EDGE_FACE)); + } + + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (super.canReplace(state, context)) return true; + + if (context.getPlayer() == null + || context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + ) return false; + + Edge edge = state.get(EDGE); + Direction face = edge.getDirection(state.get(EDGE_FACE)); + if (block_item.getBlock() == ReFramed.SLAB) + return ReFramed.SLAB + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.SLAB.getDefaultState().with(FACING, edge.getOtherDirection(face).getOpposite()) + ); + + if (block_item.getBlock() == ReFramed.STEP) + return ReFramed.STEP + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.STEP.getDefaultState().with(EDGE, edge.getOpposite(face)) + ); + + return false; + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getHalfLayerShape( + state.get(EDGE), + state.get(EDGE_FACE), + state.get(LAYERS) + ); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos()); + BlockState state = super.getPlacementState(ctx); + + if (previous.isOf(this)) + return state; + + if (previous.isOf(ReFramed.SLABS_HALF_LAYER) || previous.isOf(ReFramed.STEPS_HALF_LAYER)) + return previous.with(LAYERS, Math.min(8, previous.get(LAYERS) + 1)); + + if (previous.isOf(ReFramed.SLAB)) { + Direction face = previous.get(FACING); + Edge edge; + if (face.getAxis() == ctx.getSide().getAxis()) { + edge = BlockHelper.getPlacementEdge(ctx); + if (face == ctx.getSide()) edge = edge.getOpposite(edge.getOtherDirection(ctx.getSide())); + } else edge = Edge.getByDirections(face, ctx.getSide().getOpposite()); + + return ReFramed.SLABS_HALF_LAYER.getDefaultState() + .with(EDGE, edge) + .with(EDGE_FACE, edge.getDirectionIndex(face)) + .with(WATERLOGGED, previous.get(WATERLOGGED)); + } + + if (previous.isOf(ReFramed.STEP)) { + int face_index = 0; + Edge edge = previous.get(EDGE); + if (!ReFramed.STEP.matchesShape( + ctx.getHitPos(), + ctx.getBlockPos(), + ReFramed.STEP.getDefaultState().with(EDGE, edge.getOpposite(1)) + )) face_index = 1; + return ReFramed.STEPS_HALF_LAYER.getDefaultState() + .with(EDGE, edge) + .with(EDGE_FACE, face_index) + .with(WATERLOGGED, previous.get(WATERLOGGED)); + } + + Edge edge = BlockHelper.getPlacementEdge(ctx); + return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite())); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + Edge edge = state.get(EDGE); + Direction face = rotation.rotate(edge.getDirection(state.get(EDGE_FACE))); + edge = edge.rotate(rotation); + return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(face)); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + Edge edge = state.get(EDGE); + Direction face = mirror.apply(edge.getDirection(state.get(EDGE_FACE))); + edge = edge.mirror(mirror); + return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(face)); + } + + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.SLABS_HALF_LAYER) + || new_state.isOf(ReFramed.STEPS_HALF_LAYER) + ) return Map.of(1, 2); + return super.getThemeMap(state, new_state); + } + + public static VoxelShape getHalfLayerShape(Edge edge, int face, int layer) { + return HALF_LAYER_VOXELS[edge.ordinal() * 16 + face * 8 + layer - 1]; + } + + static { + VoxelListBuilder builder = VoxelListBuilder.create(createCuboidShape(0, 0, 0, 16, 8, 2), 192) + .add(createCuboidShape(0, 0, 0, 16, 8, 4)) + .add(createCuboidShape(0, 0, 0, 16, 8, 6)) + .add(createCuboidShape(0, 0, 0, 16, 8, 8)) + .add(createCuboidShape(0, 0, 0, 16, 8, 10)) + .add(createCuboidShape(0, 0, 0, 16, 8, 12)) + .add(createCuboidShape(0, 0, 0, 16, 8, 14)) + .add(createCuboidShape(0, 0, 0, 16, 8, 16)); + + for (int i = 0; i < 8; i++) { + builder.add(i, VoxelHelper::rotateCX, VoxelHelper::mirrorZ); + } + for (int i = 0; i < 48; i++) { + builder.add(i, VoxelHelper::rotateCX); + } + for (int i = 0; i < 64; i++) { + builder.add(i, VoxelHelper::rotateCY); + } + for (int i = 64; i < 80; i++) { + builder.add(i, VoxelHelper::rotateX); + } + for (int i = 80; i < 96; i++) { + builder.add(i, VoxelHelper::rotateX); + } + for (int i = 96; i < 112; i++) { + builder.add(i, VoxelHelper::rotateX); + } + for (int i = 112; i < 128; i++) { + builder.add(i, VoxelHelper::rotateX); + } + + HALF_LAYER_VOXELS = builder.build(); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index 9b9e0ba..da3ec84 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -4,45 +4,32 @@ import fr.adrien1106.reframed.util.VoxelHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; -import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootContextParameterSet; import net.minecraft.state.StateManager; +import net.minecraft.util.BlockMirror; +import net.minecraft.util.BlockRotation; 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 java.util.List; - import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.state.property.Properties.LAYERS; -public class ReFramedLayerBlock extends ReFramedSlabBlock { +public class ReFramedLayerBlock extends LayeredReFramedBlock { public static final VoxelShape[] LAYER_VOXELS; public ReFramedLayerBlock(Settings settings) { super(settings); - setDefaultState(getDefaultState().with(LAYERS, 1)); - } - - @Override - @SuppressWarnings("deprecation") - public List getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) { - List drops = super.getDroppedStacks(state, builder); - drops.forEach((stack) -> { - if (stack.getItem() instanceof BlockItem bi && bi.getBlock() instanceof ReFramedLayerBlock) - stack.setCount(state.get(LAYERS)); - }); - return drops; + setDefaultState(getDefaultState().with(FACING, Direction.DOWN)); } @Override protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder.add(LAYERS)); + super.appendProperties(builder.add(FACING)); } @Override @@ -51,20 +38,23 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { } @Override - public boolean canReplace(BlockState state, ItemPlacementContext context) { - if (context.getPlayer() == null) return false; - return !( - context.getPlayer().isSneaking() - || !(context.getStack().getItem() instanceof BlockItem block_item) - || !(block_item.getBlock() == this && state.get(LAYERS) < 8) - ); + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos()); + BlockState state = super.getPlacementState(ctx); + if (previous.isOf(this)) return state; + return state.with(FACING, ctx.getSide().getOpposite()); } @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos()); - if (!previous.isOf(this)) return super.getPlacementState(ctx); - return previous.with(LAYERS, previous.get(LAYERS) + 1); + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.with(FACING, mirror.apply(state.get(FACING))); } static { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java index 84d61aa..07c7128 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarsWallBlock.java @@ -71,13 +71,6 @@ public class ReFramedPillarsWallBlock extends WaterloggableReFramedDoubleBlock { return getWallState(state, top_state, neighbors, top_shape, fs, world, pos); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { if (isGhost(view, pos)) return empty(); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java index f9fd178..7e11f09 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPostFenceBlock.java @@ -49,13 +49,6 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock { super.appendProperties(builder.add(EAST, NORTH, SOUTH, WEST)); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override public BlockState getStateForNeighborUpdate(BlockState state, Direction dir, BlockState other_state, WorldAccess world, BlockPos pos, BlockPos moved) { BlockState new_state = super.getStateForNeighborUpdate(state, dir, other_state, world, pos, moved); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index b939931..67bcf20 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -1,6 +1,7 @@ package fr.adrien1106.reframed.block; import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.util.blocks.Edge; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; @@ -18,8 +19,9 @@ import org.jetbrains.annotations.Nullable; import java.util.Map; -import static net.minecraft.state.property.Properties.AXIS; -import static net.minecraft.state.property.Properties.FACING; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static net.minecraft.state.property.Properties.*; public class ReFramedSlabBlock extends WaterloggableReFramedBlock { @@ -54,6 +56,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { && block != ReFramed.STEP && block != ReFramed.SMALL_CUBE && block != ReFramed.HALF_STAIR + && block != ReFramed.HALF_LAYER ) return false; // check if the player is clicking on the inner part of the block @@ -70,10 +73,22 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { @Override public BlockState getPlacementState(ItemPlacementContext ctx) { BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); + if (current_state.isOf(this)) return ReFramed.SLABS_CUBE.getDefaultState() .with(AXIS, current_state.get(FACING).getAxis()); + if (current_state.isOf(ReFramed.HALF_LAYER)) { + Edge edge = current_state.get(EDGE); + Direction face = edge.getDirection(current_state.get(EDGE_FACE)); + edge = edge.getOpposite(face); + return ReFramed.SLABS_HALF_LAYER.getDefaultState() + .with(EDGE, edge) + .with(EDGE_FACE, edge.getDirectionIndex(edge.getOtherDirection(face))) + .with(LAYERS, current_state.get(LAYERS)) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + } + return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite()); } @@ -111,6 +126,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { if (new_state.isOf(ReFramed.SLABS_STAIR) || new_state.isOf(ReFramed.SLABS_OUTER_STAIR) || new_state.isOf(ReFramed.SLABS_INNER_STAIR) + || new_state.isOf(ReFramed.SLABS_HALF_LAYER) ) return Map.of(1, 1); if (new_state.isOf(ReFramed.SLABS_CUBE)) return Map.of(1, state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1); return super.getThemeMap(state, new_state); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsHalfLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsHalfLayerBlock.java new file mode 100644 index 0000000..7d534c8 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsHalfLayerBlock.java @@ -0,0 +1,62 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.Edge; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +import static fr.adrien1106.reframed.block.ReFramedHalfLayerBlock.getHalfLayerShape; +import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static net.minecraft.state.property.Properties.LAYERS; + +public class ReFramedSlabsHalfLayerBlock extends HalfLayerDoubleReFramedBlock { + + private static final VoxelShape[] SLABS_HALF_LAYER_VOXELS = new VoxelShape[196]; + + public ReFramedSlabsHalfLayerBlock(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getSlabsHalfLayerShape(state.get(EDGE), state.get(EDGE_FACE), state.get(LAYERS)); + } + + public static VoxelShape getSlabsHalfLayerShape(Edge edge, int face, int layers) { + int i = edge.ordinal() * 16 + face * 8 + layers - 1; + VoxelShape shape = SLABS_HALF_LAYER_VOXELS[i]; + if (shape == null) { + shape = VoxelShapes.combineAndSimplify( + getShape(edge, edge.getDirection(face), layers, 1), + getShape(edge, edge.getDirection(face), layers, 2), + BooleanBiFunction.OR + ); + SLABS_HALF_LAYER_VOXELS[i] = shape; + } + return shape; + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Edge edge = state.get(EDGE); + Direction face = edge.getDirection(state.get(EDGE_FACE)); + return getShape(edge, face, state.get(LAYERS), i); + } + + private static VoxelShape getShape(Edge edge, Direction face, int layers, int i) { + if (i == 2) { + face = edge.getOtherDirection(face); + edge = edge.getOpposite(face); + } + return i == 2 + ? getHalfLayerShape(edge, edge.getDirectionIndex(face), layers) + : getSlabShape(face); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java index b682731..5a104c1 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java @@ -1,20 +1,13 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.util.blocks.BlockHelper; 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.BlockMirror; -import net.minecraft.util.BlockRotation; 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.ReFramedSlabBlock.getSlabShape; import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; @@ -22,48 +15,17 @@ import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; -public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock { +public class ReFramedSlabsStairBlock extends EdgeDoubleReFramedBlock { public ReFramedSlabsStairBlock(Settings settings) { super(settings); - setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0)); } @Override - protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder.add(EDGE, EDGE_FACE)); - } - - @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - Edge edge = BlockHelper.getPlacementEdge(ctx); - return super.getPlacementState(ctx) - .with(EDGE, edge) - .with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite())); - } - - @Override - @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return getStairShape(state.get(EDGE), StairShape.STRAIGHT); } - @Override - @SuppressWarnings("deprecation") - public BlockState rotate(BlockState state, BlockRotation rotation) { - Edge edge = state.get(EDGE).rotate(rotation); - Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); - return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(rotation.rotate(face))); - } - - @Override - @SuppressWarnings("deprecation") - public BlockState mirror(BlockState state, BlockMirror mirror) { - Edge edge = state.get(EDGE).mirror(mirror); - Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE)); - return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(mirror.apply(face))); - } - @Override public VoxelShape getShape(BlockState state, int i) { Edge edge = state.get(EDGE); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index e3ed281..b08b016 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -19,7 +19,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; -import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import org.jetbrains.annotations.Nullable; @@ -53,7 +52,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { || !(context.getStack().getItem() instanceof BlockItem block_item) || !( block_item.getBlock() == ReFramed.STEP - && ((ReFramedStairsCubeBlock) ReFramed.STAIRS_CUBE) + && ReFramed.STAIRS_CUBE .matchesShape( context.getHitPos(), context.getBlockPos(), @@ -87,13 +86,6 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { return super.getPlacementState(ctx).with(EDGE, edge).with(STAIR_SHAPE, shape); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java index 51d402a..33e5c6e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java @@ -12,7 +12,6 @@ import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import org.jetbrains.annotations.Nullable; @@ -79,13 +78,6 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock { .with(EDGE, edge); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override public VoxelShape getShape(BlockState state, int i) { Edge edge = state.get(EDGE); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index fcaaec3..4d700cf 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -50,10 +50,21 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { ) return false; Block block = block_item.getBlock(); + Edge edge = state.get(EDGE); + if (block == ReFramed.HALF_LAYER) + return matchesShape( + context.getHitPos(), + context.getBlockPos(), + getDefaultState().with(EDGE, edge.getOpposite(edge.getFirstDirection())) + ) || matchesShape( + context.getHitPos(), + context.getBlockPos(), + getDefaultState().with(EDGE, edge.getOpposite(edge.getSecondDirection())) + ); + // allow replacing with stair if (block != this && block != ReFramed.STAIR) return false; - Edge edge = state.get(EDGE); return ReFramed.STAIR .matchesShape( context.getHitPos(), @@ -134,6 +145,17 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { .with(WATERLOGGED, current_state.get(WATERLOGGED)); } + if (current_state.isOf(ReFramed.HALF_LAYER)) { + Edge edge = current_state.get(EDGE); + Direction face = edge.getDirection(current_state.get(EDGE_FACE)); + edge = edge.getOpposite(face); + return ReFramed.STEPS_HALF_LAYER.getDefaultState() + .with(EDGE, edge) + .with(EDGE_FACE, edge.getDirectionIndex(edge.getOtherDirection(face))) + .with(LAYERS, current_state.get(LAYERS)) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + } + return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx)); } @@ -161,7 +183,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { @Override public Map getThemeMap(BlockState state, BlockState new_state) { - if (new_state.isOf(ReFramed.STEPS_CROSS)) return Map.of(1, 1); + if (new_state.isOf(ReFramed.STEPS_CROSS) + || new_state.isOf(ReFramed.STEPS_HALF_LAYER) + ) return Map.of(1, 1); if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2); if (new_state.isOf(ReFramed.STEPS_SLAB)) return Map.of( diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsHalfLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsHalfLayerBlock.java new file mode 100644 index 0000000..fab7802 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsHalfLayerBlock.java @@ -0,0 +1,62 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.blocks.Edge; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +import static fr.adrien1106.reframed.block.ReFramedHalfLayerBlock.getHalfLayerShape; +import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static net.minecraft.state.property.Properties.LAYERS; + +public class ReFramedStepsHalfLayerBlock extends HalfLayerDoubleReFramedBlock { + + private static final VoxelShape[] SLABS_HALF_LAYER_VOXELS = new VoxelShape[196]; + + public ReFramedStepsHalfLayerBlock(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getStepsHalfLayerShape(state.get(EDGE), state.get(EDGE_FACE), state.get(LAYERS)); + } + + public static VoxelShape getStepsHalfLayerShape(Edge edge, int face, int layers) { + int i = edge.ordinal() * 16 + face * 8 + layers - 1; + VoxelShape shape = SLABS_HALF_LAYER_VOXELS[i]; + if (shape == null) { + shape = VoxelShapes.combineAndSimplify( + getShape(edge, edge.getDirection(face), layers, 1), + getShape(edge, edge.getDirection(face), layers, 2), + BooleanBiFunction.OR + ); + SLABS_HALF_LAYER_VOXELS[i] = shape; + } + return shape; + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Edge edge = state.get(EDGE); + Direction face = edge.getDirection(state.get(EDGE_FACE)); + return getShape(edge, face, state.get(LAYERS), i); + } + + private static VoxelShape getShape(Edge edge, Direction face, int layers, int i) { + if (i == 2) { + face = edge.getOtherDirection(face); + edge = edge.getOpposite(face); + } + return i == 2 + ? getHalfLayerShape(edge, edge.getDirectionIndex(face), layers) + : getStepShape(edge); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java index 8a6b821..df4c483 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedTrapdoorBlock.java @@ -84,13 +84,6 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock { return state; } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { ActionResult result = super.onUse(state, world, pos, player, hand, hit); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java index c8a6a46..ba2936e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedWallBlock.java @@ -79,13 +79,6 @@ public class ReFramedWallBlock extends WaterloggableReFramedBlock { return state.with(UP, shouldHavePost(state, top_state, top_shape)); } - @Override - public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { - super.onStateReplaced(state, world, pos, new_state, moved); - - if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); - } - @Override @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index d59d0f4..b7d237e 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -163,6 +163,47 @@ public class ReFramedClient implements ClientModInitializer { 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"))); + // HALF LAYER + // --------------------- east + HELPER.addReFramedModel("half_layer_2" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_2"))); + HELPER.addReFramedModel("half_layer_4" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_4"))); + HELPER.addReFramedModel("half_layer_6" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_6"))); + HELPER.addReFramedModel("half_layer_8" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_8"))); + HELPER.addReFramedModel("half_layer_10" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_10"))); + HELPER.addReFramedModel("half_layer_12" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_12"))); + HELPER.addReFramedModel("half_layer_14" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_14"))); + HELPER.addReFramedModel("half_layer_16" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_16"))); + // --------------------- side + HELPER.addReFramedModel("half_layer_side_2" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_2"))); + HELPER.addReFramedModel("half_layer_side_4" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_4"))); + HELPER.addReFramedModel("half_layer_side_6" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_6"))); + HELPER.addReFramedModel("half_layer_side_8" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_8"))); + HELPER.addReFramedModel("half_layer_side_10" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_10"))); + HELPER.addReFramedModel("half_layer_side_12" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_12"))); + HELPER.addReFramedModel("half_layer_side_14" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_14"))); + HELPER.addReFramedModel("half_layer_side_16" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_16"))); + // SLAB HALF LAYER + HELPER.addReFramedModel("slabs_half_inventory" , HELPER.autoDouble(new Identifier("block/slab"), ReFramed.id("block/half_layer/slab/east/layer_4"))); + // STEP HALF LAYER + HELPER.addReFramedModel("steps_half_inventory" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/half_layer/slab/east/layer_4"))); + // --------------------- east + HELPER.addReFramedModel("second_half_layer_2" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_2")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_4" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_4")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_6" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_6")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_8" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_8")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_10" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_10")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_12" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_12")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_14" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_14")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_16" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_16")).setThemeIndex(2)); + // --------------------- side + HELPER.addReFramedModel("second_half_layer_side_2" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_2")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_4" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_4")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_6" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_6")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_8" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_8")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_10" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_10")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_12" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_12")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_14" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_14")).setThemeIndex(2)); + HELPER.addReFramedModel("second_half_layer_side_16" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_16")).setThemeIndex(2)); // item model assignments (in lieu of models/item/___.json) @@ -195,6 +236,9 @@ public class ReFramedClient implements ClientModInitializer { 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); + HELPER.assignItemModel("half_layer_2" , ReFramed.HALF_LAYER); + HELPER.assignItemModel("slabs_half_inventory" , ReFramed.SLABS_HALF_LAYER); + HELPER.assignItemModel("steps_half_inventory" , ReFramed.STEPS_HALF_LAYER); } 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 585b9ca..8e251a6 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -25,12 +25,14 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedLayerBlock.class, new Layer()); + providers.put(ReFramedHalfLayerBlock.class, new HalfLayer()); providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); + providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); @@ -38,6 +40,7 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); + providers.put(ReFramedStepsHalfLayerBlock.class, new StepsHalfLayer()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedPaneBlock.class, new Pane()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index 4ea5c2d..f898727 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -27,12 +27,14 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedLayerBlock.class, new Layer()); + providers.put(ReFramedHalfLayerBlock.class, new HalfLayer()); providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); + providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); @@ -40,6 +42,7 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); + providers.put(ReFramedStepsHalfLayerBlock.class, new StepsHalfLayer()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedPaneBlock.class, new Pane()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfLayer.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfLayer.java new file mode 100644 index 0000000..4cc5bac --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfLayer.java @@ -0,0 +1,171 @@ +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.BlockStateSupplier; +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 java.util.Map; + +import static fr.adrien1106.reframed.generator.GBlockstate.variant; +import static fr.adrien1106.reframed.generator.GBlockstate.when; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static fr.adrien1106.reframed.util.blocks.Edge.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.LAYERS; + +public class HalfLayer implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 16); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 2) + .input(ReFramed.LAYER) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + return getMultipart(block, "half_layer"); + } + + public static MultipartBlockStateSupplier getMultipart(Block block, String layer) { + Map layer_model = Map.of( + 1, ReFramed.id(layer + "_2_special"), + 2, ReFramed.id(layer + "_4_special"), + 3, ReFramed.id(layer + "_6_special"), + 4, ReFramed.id(layer + "_8_special"), + 5, ReFramed.id(layer + "_10_special"), + 6, ReFramed.id(layer + "_12_special"), + 7, ReFramed.id(layer + "_14_special"), + 8, ReFramed.id(layer + "_16_special") + ); + Map layer_side = Map.of( + 1, ReFramed.id(layer + "_side_2_special"), + 2, ReFramed.id(layer + "_side_4_special"), + 3, ReFramed.id(layer + "_side_6_special"), + 4, ReFramed.id(layer + "_side_8_special"), + 5, ReFramed.id(layer + "_side_10_special"), + 6, ReFramed.id(layer + "_side_12_special"), + 7, ReFramed.id(layer + "_side_14_special"), + 8, ReFramed.id(layer + "_side_16_special") + ); + MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(block); + // DOWN + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, DOWN_EAST, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R0)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, DOWN_SOUTH, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R90)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, WEST_DOWN, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R0, R180)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, NORTH_DOWN, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R0, R270)) + ); + // UP + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, EAST_UP, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R0)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, SOUTH_UP, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R90)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, UP_WEST, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R180, R180)) + ); + layer_model.forEach((i, model) -> + supplier.with(when(EDGE, UP_NORTH, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R180, R270)) + ); + // EAST + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, EAST_SOUTH, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R0)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, EAST_UP, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R90, R0)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, NORTH_EAST, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R0)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, DOWN_EAST, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R270, R0)) + ); + // SOUTH + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, SOUTH_WEST, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R90)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, SOUTH_UP, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R90, R90)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, EAST_SOUTH, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R90)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, DOWN_SOUTH, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R270, R90)) + ); + // WEST + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, WEST_NORTH, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R180)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, UP_WEST, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R90, R180)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, SOUTH_WEST, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R180)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, WEST_DOWN, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R270, R180)) + ); + // NORTH + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, NORTH_EAST, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R0, R270)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, UP_NORTH, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R90, R270)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, WEST_NORTH, EDGE_FACE, 1, LAYERS, i), + variant(model, true, R180, R270)) + ); + layer_side.forEach((i, model) -> + supplier.with(when(EDGE, NORTH_DOWN, EDGE_FACE, 0, LAYERS, i), + variant(model, true, R270, R270)) + ); + return supplier; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SlabsHalfLayer.java b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsHalfLayer.java new file mode 100644 index 0000000..fa5f94a --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsHalfLayer.java @@ -0,0 +1,93 @@ +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.BlockStateSupplier; +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.generator.GBlockstate.variant; +import static fr.adrien1106.reframed.generator.GBlockstate.when; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; +import static fr.adrien1106.reframed.util.blocks.Edge.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.data.client.When.anyOf; + +public class SlabsHalfLayer implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.HALF_LAYER) + .input(ReFramed.SLAB) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier slab_model = ReFramed.id("slab_special"); + return HalfLayer.getMultipart(block, "second_half_layer") + .with( + anyOf( + when(EDGE, DOWN_EAST, EDGE_FACE, 0), + when(EDGE, DOWN_SOUTH, EDGE_FACE, 0), + when(EDGE, WEST_DOWN, EDGE_FACE, 1), + when(EDGE, NORTH_DOWN, EDGE_FACE, 1) + ), + variant(slab_model, true, R0, R0)) + .with( + anyOf( + when(EDGE, EAST_SOUTH, EDGE_FACE, 1), + when(EDGE, DOWN_SOUTH, EDGE_FACE, 1), + when(EDGE, SOUTH_WEST, EDGE_FACE, 0), + when(EDGE, SOUTH_UP, EDGE_FACE, 0) + ), + variant(slab_model, true, R90, R0)) + .with( + anyOf( + when(EDGE, UP_WEST, EDGE_FACE, 0), + when(EDGE, UP_NORTH, EDGE_FACE, 0), + when(EDGE, EAST_UP, EDGE_FACE, 1), + when(EDGE, SOUTH_UP, EDGE_FACE, 1) + ), + variant(slab_model, true, R180, R0)) + .with( + anyOf( + when(EDGE, WEST_NORTH, EDGE_FACE, 1), + when(EDGE, UP_NORTH, EDGE_FACE, 1), + when(EDGE, NORTH_EAST, EDGE_FACE, 0), + when(EDGE, NORTH_DOWN, EDGE_FACE, 0) + ), + variant(slab_model, true, R270, R0)) + .with( + anyOf( + when(EDGE, SOUTH_WEST, EDGE_FACE, 1), + when(EDGE, UP_WEST, EDGE_FACE, 1), + when(EDGE, WEST_NORTH, EDGE_FACE, 0), + when(EDGE, WEST_DOWN, EDGE_FACE, 0) + ), + variant(slab_model, true, R90, R90)) + .with( + anyOf( + when(EDGE, NORTH_EAST, EDGE_FACE, 1), + when(EDGE, DOWN_EAST, EDGE_FACE, 1), + when(EDGE, EAST_SOUTH, EDGE_FACE, 0), + when(EDGE, EAST_UP, EDGE_FACE, 0) + ), + variant(slab_model, true, R90, R270)) + ; + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/StepsHalfLayer.java b/src/main/java/fr/adrien1106/reframed/generator/block/StepsHalfLayer.java new file mode 100644 index 0000000..f236125 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/StepsHalfLayer.java @@ -0,0 +1,69 @@ +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 net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.BlockStateSupplier; +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.EDGE; +import static fr.adrien1106.reframed.util.blocks.Edge.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class StepsHalfLayer implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.HALF_LAYER) + .input(ReFramed.STEP) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier step_model = ReFramed.id("step_special"); + return HalfLayer.getMultipart(block, "second_half_layer") + /* X AXIS */ + .with(GBlockstate.when(EDGE, DOWN_EAST), + GBlockstate.variant(step_model, true, R0, R0)) + .with(GBlockstate.when(EDGE, EAST_UP), + GBlockstate.variant(step_model, true, R180, R0)) + .with(GBlockstate.when(EDGE, UP_WEST), + GBlockstate.variant(step_model, true, R180, R180)) + .with(GBlockstate.when(EDGE, WEST_DOWN), + GBlockstate.variant(step_model, true, R0, R180)) + /* Y AXIS */ + .with(GBlockstate.when(EDGE, EAST_SOUTH), + GBlockstate.variant(step_model, true, R90, R0)) + .with(GBlockstate.when(EDGE, SOUTH_WEST), + GBlockstate.variant(step_model, true, R90, R90)) + .with(GBlockstate.when(EDGE, WEST_NORTH), + GBlockstate.variant(step_model, true, R90, R180)) + .with(GBlockstate.when(EDGE, NORTH_EAST), + GBlockstate.variant(step_model, true, R90, R270)) + /* Z AXIS */ + .with(GBlockstate.when(EDGE, DOWN_SOUTH), + GBlockstate.variant(step_model, true, R0, R90)) + .with(GBlockstate.when(EDGE, NORTH_DOWN), + GBlockstate.variant(step_model, true, R0, R270)) + .with(GBlockstate.when(EDGE, UP_NORTH), + GBlockstate.variant(step_model, true, R180, R270)) + .with(GBlockstate.when(EDGE, SOUTH_UP), + GBlockstate.variant(step_model, true, R180, R90)) + ; + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/util/VoxelHelper.java b/src/main/java/fr/adrien1106/reframed/util/VoxelHelper.java index ba4d0d8..395cf92 100644 --- a/src/main/java/fr/adrien1106/reframed/util/VoxelHelper.java +++ b/src/main/java/fr/adrien1106/reframed/util/VoxelHelper.java @@ -201,5 +201,24 @@ public class VoxelHelper { } return shapes; } + + /** + * build a new set of voxels based on the combination of two sets of voxels + * @param long_voxels - the first set of voxels + * @param short_voxels - the second set of voxels + * @param mapping_function - the function to map the index of the first set to the index of the second set + * @return the array of added voxels + */ + public static VoxelShape[] buildFrom(VoxelShape[] long_voxels, VoxelShape[] short_voxels, Function mapping_function) { + VoxelShape[] shapes = new VoxelShape[long_voxels.length]; + for (int i = 0; i < shapes.length; i++) { + shapes[i] = VoxelShapes.combineAndSimplify( + long_voxels[i], + short_voxels[mapping_function.apply(i)], + BooleanBiFunction.OR + ); + } + return shapes; + } } } diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_10.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_10.json new file mode 100644 index 0000000..4fda1ae --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_10.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 6, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 6, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 6, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 6, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_12.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_12.json new file mode 100644 index 0000000..470af2d --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_12.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 4, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 4, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 4, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 4, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_14.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_14.json new file mode 100644 index 0000000..cd7d6a5 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_14.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 14, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 2, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 2, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 2, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 2, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_16.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_16.json new file mode 100644 index 0000000..a994ef1 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_16.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_2.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_2.json new file mode 100644 index 0000000..5a47180 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_2.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 2, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 14, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 14, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 14, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 14, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_4.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_4.json new file mode 100644 index 0000000..88b2318 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_4.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 4, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 12, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 12, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 12, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_6.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_6.json new file mode 100644 index 0000000..d3b5e88 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_6.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 6, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 10, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 10, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 10, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 10, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/east/layer_8.json b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_8.json new file mode 100644 index 0000000..96e1312 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/east/layer_8.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [16, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 8, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_10.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_10.json new file mode 100644 index 0000000..bbb86fc --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_10.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [6, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 10, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [6, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [6, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [6, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_12.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_12.json new file mode 100644 index 0000000..d37f52d --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_12.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 12, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [4, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [4, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_14.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_14.json new file mode 100644 index 0000000..5906808 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_14.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [2, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 14, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [2, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [2, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [2, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_16.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_16.json new file mode 100644 index 0000000..f9712ff --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_16.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_2.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_2.json new file mode 100644 index 0000000..2fa7154 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_2.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [14, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 2, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [14, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [14, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [14, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_4.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_4.json new file mode 100644 index 0000000..6e4e1d5 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_4.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [12, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 4, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [12, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [12, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [12, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_6.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_6.json new file mode 100644 index 0000000..bf82aa0 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_6.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [10, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 6, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [10, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [10, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [10, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/side/layer_8.json b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_8.json new file mode 100644 index 0000000..6ba6f73 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/side/layer_8.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 0, 8], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_10.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_10.json new file mode 100644 index 0000000..ca6e5cc --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_10.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [6, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 10, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [6, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [6, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [6, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_12.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_12.json new file mode 100644 index 0000000..b94941b --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_12.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 12, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [4, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [4, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_14.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_14.json new file mode 100644 index 0000000..122d11c --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_14.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [2, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 14, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [2, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [2, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [2, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_16.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_16.json new file mode 100644 index 0000000..0c2f16b --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_16.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_2.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_2.json new file mode 100644 index 0000000..579a1da --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_2.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [14, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 2, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [14, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [14, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [14, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_4.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_4.json new file mode 100644 index 0000000..678fd41 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_4.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [12, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 4, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [12, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [12, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [12, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_6.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_6.json new file mode 100644 index 0000000..76445b6 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_6.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [10, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 6, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [10, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [10, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [10, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_8.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_8.json new file mode 100644 index 0000000..7ea14ad --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/east/layer_8.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_10.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_10.json new file mode 100644 index 0000000..889d1cc --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_10.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 6], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 10, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [6, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 6, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 10], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_12.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_12.json new file mode 100644 index 0000000..5bc9c47 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_12.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 4], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [4, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 4, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_14.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_14.json new file mode 100644 index 0000000..c0124b7 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_14.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 2], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 14, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [2, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 2, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 14], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_16.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_16.json new file mode 100644 index 0000000..1fc3f64 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_16.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 0, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_2.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_2.json new file mode 100644 index 0000000..ffd0a59 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_2.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 14], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 2, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [14, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 14, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 2], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_4.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_4.json new file mode 100644 index 0000000..c43bed9 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_4.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 12], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 4, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [12, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 12, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 4], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_6.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_6.json new file mode 100644 index 0000000..f471549 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_6.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 10], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 6, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [10, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 10, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 6], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_8.json b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_8.json new file mode 100644 index 0000000..a46c0df --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_layer/slab/side/layer_8.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 8], + "to": [8, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]}, + "faces": { + "north": {"uv": [8, 0, 16, 16], "texture": "#side"}, + "east": {"uv": [0, 0, 8, 16], "texture": "#side"}, + "south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "east"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/layer_top/layer_2.json b/src/main/resources/assets/reframed/models/block/layer_top/layer_2.json new file mode 100644 index 0000000..3696e90 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/layer_top/layer_2.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [16, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/layer_top/layer_4.json b/src/main/resources/assets/reframed/models/block/layer_top/layer_4.json new file mode 100644 index 0000000..a42999d --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/layer_top/layer_4.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [16, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/layer_top/layer_6.json b/src/main/resources/assets/reframed/models/block/layer_top/layer_6.json new file mode 100644 index 0000000..700833b --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/layer_top/layer_6.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [16, 14, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/layer_top/layer_8.json b/src/main/resources/assets/reframed/models/block/layer_top/layer_8.json new file mode 100644 index 0000000..b0b5cb0 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/layer_top/layer_8.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/step/up.json b/src/main/resources/assets/reframed/models/block/step/up.json new file mode 100644 index 0000000..38cfa25 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/step/up.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [8, 8, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 8, 16, 16], "texture": "#side"}, + "up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 0, 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 From 48c7c4e5387754f8095ad10a4c805d6e9f3ecc4f Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 19 Jun 2024 13:20:12 +0200 Subject: [PATCH 08/10] fix: made frames properly update on every client when using blueprint/screwdriver/hammer --- .../adrien1106/reframed/block/ReFramedDoubleEntity.java | 2 +- .../fr/adrien1106/reframed/block/ReFramedEntity.java | 9 ++++----- .../reframed/item/ReFramedBlueprintWrittenItem.java | 9 ++++++++- .../fr/adrien1106/reframed/item/ReFramedHammerItem.java | 2 +- .../reframed/item/ReFramedScrewdriverItem.java | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleEntity.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleEntity.java index cecd4f6..61d9785 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleEntity.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleEntity.java @@ -57,6 +57,6 @@ public class ReFramedDoubleEntity extends ReFramedEntity { public void writeNbt(NbtCompound nbt) { super.writeNbt(nbt); - if(second_state != Blocks.AIR.getDefaultState()) nbt.put(BLOCKSTATE_KEY + 2, NbtHelper.fromBlockState(second_state)); + nbt.put(BLOCKSTATE_KEY + 2, NbtHelper.fromBlockState(second_state)); } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedEntity.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedEntity.java index fc70154..73ec631 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedEntity.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedEntity.java @@ -52,16 +52,15 @@ public class ReFramedEntity extends BlockEntity implements ThemeableBlockEntity if (nbt.contains(BITFIELD_KEY)) bit_field = nbt.getByte(BITFIELD_KEY); // Force a chunk remesh on the client if the displayed blockstate has changed - if(world != null && world.isClient && !Objects.equals(rendered_state, first_state)) { + if(world != null && world.isClient && !Objects.equals(rendered_state, first_state)) ReFramed.chunkRerenderProxy.accept(world, pos); - } } @Override public void writeNbt(NbtCompound nbt) { super.writeNbt(nbt); - - if(first_state != Blocks.AIR.getDefaultState()) nbt.put(BLOCKSTATE_KEY + 1, NbtHelper.fromBlockState(first_state)); + + nbt.put(BLOCKSTATE_KEY + 1, NbtHelper.fromBlockState(first_state)); if(bit_field != SOLIDITY_MASK) nbt.putByte(BITFIELD_KEY, bit_field); } @@ -113,7 +112,7 @@ public class ReFramedEntity extends BlockEntity implements ThemeableBlockEntity } public void setTheme(BlockState new_state, int i) { - if(!Objects.equals(first_state, new_state)) { + if(!Objects.equals(first_state, new_state) && i == 1) { first_state = new_state; markDirtyAndDispatch(); } diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintWrittenItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintWrittenItem.java index 0736a50..3ab6714 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintWrittenItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintWrittenItem.java @@ -74,7 +74,14 @@ public class ReFramedBlueprintWrittenItem extends Item { stacks.stream().map(inventory::getSlotWithStack).forEach(index -> inventory.removeStack(index, 1)); player.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.5f, 0.5f); } - frame_entity.readNbt(tag); + for (int i = 1; tag.contains(BLOCKSTATE_KEY + i); i++) { + BlockState state = NbtHelper.toBlockState( + Registries.BLOCK.getReadOnlyWrapper(), + tag.getCompound(BLOCKSTATE_KEY + i) + ); + frame_entity.setTheme(state, i); + } + if (world.isClient) ReFramed.chunkRerenderProxy.accept(world, pos); world.playSound(player, player.getBlockPos(), SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.PLAYERS); return ActionResult.SUCCESS; diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java index b3a1f83..d600755 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java @@ -43,7 +43,7 @@ public class ReFramedHammerItem extends Item { world.playSound(player, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 1f, 1.1f); } frame_entity.setTheme(Blocks.AIR.getDefaultState(), theme_index); - ReFramed.chunkRerenderProxy.accept(world, pos); + if (world.isClient) ReFramed.chunkRerenderProxy.accept(world, pos); return ActionResult.SUCCESS; } } diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java index b39b06c..603b7ac 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java @@ -52,7 +52,7 @@ public class ReFramedScrewdriverItem extends Item { case Z -> Direction.Axis.X; } ), theme_index); - ReFramed.chunkRerenderProxy.accept(world, pos); + if (world.isClient) ReFramed.chunkRerenderProxy.accept(world, pos); return ActionResult.SUCCESS; } } From 12924579a5cd999c2a6f1a6a3cc18451af505342 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 19 Jun 2024 14:26:43 +0200 Subject: [PATCH 09/10] feat: added half slab and half slabs slab --- .../java/fr/adrien1106/reframed/ReFramed.java | 3 + .../reframed/block/ReFramedHalfSlabBlock.java | 86 +++++++++++++++++++ .../block/ReFramedHalfSlabsSlabBlock.java | 77 +++++++++++++++++ .../reframed/client/ReFramedClient.java | 6 ++ .../reframed/generator/GBlockstate.java | 2 + .../reframed/generator/GRecipe.java | 2 + .../reframed/generator/block/HalfSlab.java | 34 ++++++++ .../generator/block/HalfSlabsSlab.java | 34 ++++++++ .../reframed/generator/block/Slab.java | 8 +- .../models/block/half_slab/complement.json | 22 +++++ .../models/block/half_slab/default.json | 22 +++++ 11 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabsSlabBlock.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfSlab.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfSlabsSlab.java create mode 100644 src/main/resources/assets/reframed/models/block/half_slab/complement.json create mode 100644 src/main/resources/assets/reframed/models/block/half_slab/default.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 60fefd8..1d42145 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -42,6 +42,7 @@ public class ReFramed implements ModInitializer { STAIR, STAIRS_CUBE, 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, SLABS_HALF_LAYER, + HALF_SLAB, HALF_SLABS_SLAB, STEP, STEPS_SLAB, STEPS_CROSS, STEPS_HALF_LAYER, LAYER, HALF_LAYER, PILLAR, PILLARS_WALL, WALL, @@ -79,6 +80,8 @@ public class ReFramed implements ModInitializer { 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))); SLABS_HALF_LAYER = registerBlock("slabs_half_layer" , new ReFramedSlabsHalfLayerBlock(cp(Blocks.OAK_SLAB))); + HALF_SLAB = registerBlock("half_slab" , new ReFramedHalfSlabBlock(cp(Blocks.OAK_SLAB))); + HALF_SLABS_SLAB = registerBlock("half_slabs_slab" , new ReFramedHalfSlabsSlabBlock(cp(Blocks.OAK_SLAB))); 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))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabBlock.java new file mode 100644 index 0000000..7ed0afa --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabBlock.java @@ -0,0 +1,86 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.util.VoxelHelper; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +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 java.util.Map; + +import static net.minecraft.state.property.Properties.*; + +public class ReFramedHalfSlabBlock extends ReFramedSlabBlock { + + public static VoxelShape[] HALF_SLAB_SHAPES; + + public ReFramedHalfSlabBlock(Settings settings) { + super(settings); + } + + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + 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(); + if (block != this) return false; + + // check if the player is clicking on the inner part of the block + return ReFramed.HALF_SLABS_SLAB + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.HALF_SLABS_SLAB.getDefaultState().with(FACING, state.get(FACING)), + 2 + ); + } + + @Nullable + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); + + if (current_state.isOf(this)) + return ReFramed.HALF_SLABS_SLAB.getDefaultState() + .with(FACING, current_state.get(FACING)) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + + return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite()); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getHalfSlabShape(state.get(FACING)); + } + + public static VoxelShape getHalfSlabShape(Direction direction) { + return HALF_SLAB_SHAPES[direction.getId()]; + } + + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.HALF_SLABS_SLAB)) return Map.of(1, 1); + return super.getThemeMap(state, new_state); + } + + static { + HALF_SLAB_SHAPES = VoxelHelper.VoxelListBuilder.create(createCuboidShape(0, 0, 0, 16, 4, 16),6) + .add(createCuboidShape(0, 12, 0, 16, 16, 16)) + .add(createCuboidShape(0, 0, 0, 16, 16, 4)) + .add(createCuboidShape(0, 0, 12, 16, 16, 16)) + .add(createCuboidShape(0, 0, 0, 4, 16, 16)) + .add(createCuboidShape(12, 0, 0, 16, 16, 16)) + .build(); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabsSlabBlock.java new file mode 100644 index 0000000..35ba851 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfSlabsSlabBlock.java @@ -0,0 +1,77 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.util.VoxelHelper; +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.BlockMirror; +import net.minecraft.util.BlockRotation; +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.ReFramedHalfSlabBlock.getHalfSlabShape; +import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; +import static net.minecraft.state.property.Properties.FACING; + +public class ReFramedHalfSlabsSlabBlock extends WaterloggableReFramedDoubleBlock { + + public static VoxelShape[] HALF_SLAB_COMP_SHAPES; + + public ReFramedHalfSlabsSlabBlock(Settings settings) { + super(settings); + setDefaultState(getDefaultState().with(FACING, Direction.DOWN)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add(FACING)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + return super.getPlacementState(ctx) + .with(FACING, ctx.getSide().getOpposite()); + } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getSlabShape(state.get(FACING)); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state + .with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + @SuppressWarnings("deprecation") + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.with(FACING, mirror.apply(state.get(FACING))); + } + + @Override + public VoxelShape getShape(BlockState state, int i) { + Direction face = state.get(FACING); + return i == 2 + ? HALF_SLAB_COMP_SHAPES[face.getId()] + : getHalfSlabShape(face); + } + + static { + HALF_SLAB_COMP_SHAPES = VoxelHelper.VoxelListBuilder.create(createCuboidShape(0, 4, 0, 16, 8, 16),6) + .add(createCuboidShape(0, 8, 0, 16, 12, 16)) + .add(createCuboidShape(0, 0, 4, 16, 16, 8)) + .add(createCuboidShape(0, 0, 8, 16, 16, 12)) + .add(createCuboidShape(4, 0, 0, 8, 16, 16)) + .add(createCuboidShape(8, 0, 0, 12, 16, 16)) + .build(); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index b7d237e..0a4b99f 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -204,6 +204,10 @@ public class ReFramedClient implements ClientModInitializer { HELPER.addReFramedModel("second_half_layer_side_12" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_12")).setThemeIndex(2)); HELPER.addReFramedModel("second_half_layer_side_14" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_14")).setThemeIndex(2)); HELPER.addReFramedModel("second_half_layer_side_16" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_16")).setThemeIndex(2)); + // HALF SLAB + HELPER.addReFramedModel("half_slab" , HELPER.auto(ReFramed.id("block/half_slab/default"))); + // HALF SLABS SLAB + HELPER.addReFramedModel("half_slabs_slab" , HELPER.autoDouble(ReFramed.id("block/half_slab/default"), ReFramed.id("block/half_slab/complement"))); // item model assignments (in lieu of models/item/___.json) @@ -239,6 +243,8 @@ public class ReFramedClient implements ClientModInitializer { HELPER.assignItemModel("half_layer_2" , ReFramed.HALF_LAYER); HELPER.assignItemModel("slabs_half_inventory" , ReFramed.SLABS_HALF_LAYER); HELPER.assignItemModel("steps_half_inventory" , ReFramed.STEPS_HALF_LAYER); + HELPER.assignItemModel("half_slab" , ReFramed.HALF_SLAB); + HELPER.assignItemModel("half_slabs_slab" , ReFramed.HALF_SLABS_SLAB); } 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 8e251a6..63a2790 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -33,6 +33,8 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer()); + providers.put(ReFramedHalfSlabBlock.class, new HalfSlab()); + providers.put(ReFramedHalfSlabsSlabBlock.class, new HalfSlabsSlab()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index f898727..5cb9e8c 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -35,6 +35,8 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer()); + providers.put(ReFramedHalfSlabBlock.class, new HalfSlab()); + providers.put(ReFramedHalfSlabsSlabBlock.class, new HalfSlabsSlab()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlab.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlab.java new file mode 100644 index 0000000..cec246c --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlab.java @@ -0,0 +1,34 @@ +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 HalfSlab implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 2) + .input(ReFramed.SLAB) + .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 Slab.getMultipart(block, "half_slab"); + } + + +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlabsSlab.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlabsSlab.java new file mode 100644 index 0000000..5b1484a --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfSlabsSlab.java @@ -0,0 +1,34 @@ +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 HalfSlabsSlab implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 1) + .input(ReFramed.HALF_SLAB, 2) + .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 Slab.getMultipart(block, "half_slabs_slab"); + } + + +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java b/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java index 4f8bcdb..e4fffb4 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java @@ -34,7 +34,11 @@ public class Slab implements RecipeSetter, BlockStateProvider { @Override public MultipartBlockStateSupplier getMultipart(Block block) { - Identifier model_id = ReFramed.id("slab_special"); + return getMultipart(block, "slab"); + } + + public static MultipartBlockStateSupplier getMultipart(Block block, String model_name) { + Identifier model_id = ReFramed.id(model_name + "_special"); return MultipartBlockStateSupplier.create(block) .with(GBlockstate.when(FACING, Direction.DOWN), GBlockstate.variant(model_id, true, R0, R0)) @@ -49,4 +53,6 @@ public class Slab implements RecipeSetter, BlockStateProvider { .with(GBlockstate.when(FACING, Direction.EAST), GBlockstate.variant(model_id, true, R90, R270)); } + + } diff --git a/src/main/resources/assets/reframed/models/block/half_slab/complement.json b/src/main/resources/assets/reframed/models/block/half_slab/complement.json new file mode 100644 index 0000000..b1c12b4 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_slab/complement.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 4, 0], + "to": [16, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 12, 0]}, + "faces": { + "north": {"uv": [0, 8, 16, 12], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 8, 16, 12], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 8, 16, 12], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 8, 16, 12], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/half_slab/default.json b/src/main/resources/assets/reframed/models/block/half_slab/default.json new file mode 100644 index 0000000..fcf0358 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/half_slab/default.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 4, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]}, + "faces": { + "north": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "east"}, + "south": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file From eac948bf5d62a1a930c00ada552af270adcc6b23 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 19 Jun 2024 14:36:00 +0200 Subject: [PATCH 10/10] feat: updated version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 84f676d..d82d92c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.15.11 # Mod Properties modrinth_id = jCpoCBpn -mod_version = 1.6.4 +mod_version = 1.6.5 maven_group = fr.adrien1106 archives_base_name = ReFramed mod_id = reframed