feat: added SlabsInnerStair and SlabsOuterStair with additive logic + depreciation warning suppressing on AbstractBlock Methods
This commit is contained in:
parent
d7ad6ed0c1
commit
1e6cab04cc
@ -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)));
|
||||
|
@ -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) {
|
||||
|
@ -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<Block, BlockState> 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);
|
||||
}
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<ItemStack, BlockPos> 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);
|
||||
}
|
||||
|
@ -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<ItemStack, BlockPos> 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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
|
||||
List<ItemStack> 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))
|
||||
|
@ -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)))
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<Integer, Integer> 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);
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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)));
|
||||
|
@ -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<ItemStack, BlockPos> 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)));
|
||||
}
|
||||
|
@ -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)))
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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))
|
||||
;
|
||||
}
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user