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