More merging logic + 11 new block + Fix server / client sync #23

Merged
Adrien1106 merged 10 commits from dev into master 2024-06-19 14:42:55 +02:00
65 changed files with 1790 additions and 136 deletions
Showing only changes of commit d325e3c5a5 - Show all commits

View File

@ -41,9 +41,9 @@ public class ReFramed implements ModInitializer {
SMALL_CUBE, SMALL_CUBES_STEP, SMALL_CUBE, SMALL_CUBES_STEP,
STAIR, STAIRS_CUBE, STAIR, STAIRS_CUBE,
HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, HALF_STAIRS_CUBE_STAIR, HALF_STAIRS_STEP_STAIR, HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, HALF_STAIRS_CUBE_STAIR, HALF_STAIRS_STEP_STAIR,
SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR, SLABS_HALF_LAYER,
STEP, STEPS_SLAB, STEPS_CROSS, STEP, STEPS_SLAB, STEPS_CROSS, STEPS_HALF_LAYER,
LAYER, LAYER, HALF_LAYER,
PILLAR, PILLARS_WALL, WALL, PILLAR, PILLARS_WALL, WALL,
PANE, TRAPDOOR, DOOR, PANE, TRAPDOOR, DOOR,
BUTTON, BUTTON,
@ -72,14 +72,17 @@ public class ReFramed implements ModInitializer {
HALF_STAIRS_CUBE_STAIR = registerBlock("half_stairs_cube_stair" , new ReFramedHalfStairsCubeStairBlock(cp(Blocks.OAK_STAIRS))); HALF_STAIRS_CUBE_STAIR = registerBlock("half_stairs_cube_stair" , new ReFramedHalfStairsCubeStairBlock(cp(Blocks.OAK_STAIRS)));
HALF_STAIRS_STEP_STAIR = registerBlock("half_stairs_step_stair" , new ReFramedHalfStairsStepStairBlock(cp(Blocks.OAK_STAIRS))); HALF_STAIRS_STEP_STAIR = registerBlock("half_stairs_step_stair" , new ReFramedHalfStairsStepStairBlock(cp(Blocks.OAK_STAIRS)));
LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB))); LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB)));
HALF_LAYER = registerBlock("half_layer" , new ReFramedHalfLayerBlock(cp(Blocks.OAK_SLAB)));
SLAB = registerBlock("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB))); SLAB = registerBlock("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB)));
SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(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_STAIR = registerBlock("slabs_stair" , new ReFramedSlabsStairBlock(cp(Blocks.OAK_STAIRS)));
SLABS_OUTER_STAIR = registerBlock("slabs_outer_stair" , new ReFramedSlabsOuterStairBlock(cp(Blocks.OAK_STAIRS))); SLABS_OUTER_STAIR = registerBlock("slabs_outer_stair" , new ReFramedSlabsOuterStairBlock(cp(Blocks.OAK_STAIRS)));
SLABS_INNER_STAIR = registerBlock("slabs_inner_stair" , new ReFramedSlabsInnerStairBlock(cp(Blocks.OAK_STAIRS))); SLABS_INNER_STAIR = registerBlock("slabs_inner_stair" , new ReFramedSlabsInnerStairBlock(cp(Blocks.OAK_STAIRS)));
SLABS_HALF_LAYER = registerBlock("slabs_half_layer" , new ReFramedSlabsHalfLayerBlock(cp(Blocks.OAK_SLAB)));
STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB))); STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB)));
STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB))); STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB)));
STEPS_CROSS = registerBlock("steps_cross" , new ReFramedStepsCrossBlock(cp(Blocks.OAK_SLAB))); STEPS_CROSS = registerBlock("steps_cross" , new ReFramedStepsCrossBlock(cp(Blocks.OAK_SLAB)));
STEPS_HALF_LAYER = registerBlock("steps_half_layer" , new ReFramedStepsHalfLayerBlock(cp(Blocks.OAK_SLAB)));
PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE))); PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE)));
PILLARS_WALL = registerBlock("pillars_wall" , new ReFramedPillarsWallBlock(cp(Blocks.OAK_FENCE))); PILLARS_WALL = registerBlock("pillars_wall" , new ReFramedPillarsWallBlock(cp(Blocks.OAK_FENCE)));
WALL = registerBlock("wall" , new ReFramedWallBlock(cp(Blocks.OAK_FENCE))); WALL = registerBlock("wall" , new ReFramedWallBlock(cp(Blocks.OAK_FENCE)));

View File

@ -54,13 +54,6 @@ public abstract class ConnectingReFramedBlock extends WaterloggableReFramedBlock
return placementState(state, world, pos, this::connectsTo); return placementState(state, world, pos, this::connectsTo);
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, BlockRotation rotation) { public BlockState rotate(BlockState state, BlockRotation rotation) {

View File

@ -0,0 +1,64 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.util.blocks.BlockHelper;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
public abstract class EdgeDoubleReFramedBlock extends WaterloggableReFramedDoubleBlock {
public EdgeDoubleReFramedBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(EDGE, EDGE_FACE));
}
@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
Edge edge = BlockHelper.getPlacementEdge(ctx);
return super.getPlacementState(ctx)
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite()));
}
@Override
@SuppressWarnings("deprecation")
public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context);
@Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, BlockRotation rotation) {
Edge edge = state.get(EDGE).rotate(rotation);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(rotation.rotate(face)));
}
@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, BlockMirror mirror) {
Edge edge = state.get(EDGE).mirror(mirror);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(mirror.apply(face)));
}
@Override
public abstract VoxelShape getShape(BlockState state, int i);
}

View File

@ -0,0 +1,45 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.ReFramed;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet;
import net.minecraft.state.StateManager;
import java.util.List;
import static net.minecraft.state.property.Properties.LAYERS;
public abstract class HalfLayerDoubleReFramedBlock extends EdgeDoubleReFramedBlock {
public HalfLayerDoubleReFramedBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(LAYERS, 1));
}
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
List<ItemStack> drops = super.getDroppedStacks(state, builder);
drops.add(new ItemStack(ReFramed.HALF_LAYER, state.get(LAYERS)-1));
return drops;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(LAYERS));
}
@Override
@SuppressWarnings("deprecation")
public boolean canReplace(BlockState state, ItemPlacementContext context) {
if (context.getPlayer() == null
|| context.getPlayer().isSneaking()
|| !(context.getStack().getItem() instanceof BlockItem block_item)
) return false;
return block_item.getBlock() == ReFramed.HALF_LAYER && state.get(LAYERS) < 8;
}
}

View File

@ -0,0 +1,64 @@
package fr.adrien1106.reframed.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import static net.minecraft.state.property.Properties.LAYERS;
public abstract class LayeredReFramedBlock extends WaterloggableReFramedBlock {
public LayeredReFramedBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(LAYERS, 1));
}
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
List<ItemStack> drops = super.getDroppedStacks(state, builder);
drops.forEach((stack) -> {
if (stack.getItem() instanceof BlockItem bi && bi.getBlock() instanceof LayeredReFramedBlock)
stack.setCount(state.get(LAYERS));
});
return drops;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(LAYERS));
}
@Override
@SuppressWarnings("deprecation")
public abstract VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context);
@Override
@SuppressWarnings("deprecation")
public boolean canReplace(BlockState state, ItemPlacementContext context) {
if (context.getPlayer() == null) return false;
return !(
context.getPlayer().isSneaking()
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|| !(block_item.getBlock() == this && state.get(LAYERS) < 8)
);
}
@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos());
if (!previous.isOf(this)) return super.getPlacementState(ctx);
return previous.with(LAYERS, previous.get(LAYERS) + 1);
}
}

View File

@ -76,6 +76,8 @@ public class ReFramedBlock extends Block implements BlockEntityProvider {
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
if (!new_state.isOf(state.getBlock())) world.removeBlockEntity(pos);
if(!(new_state.getBlock() instanceof ReFramedBlock) && if(!(new_state.getBlock() instanceof ReFramedBlock) &&
world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity && world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity &&
world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)
@ -168,6 +170,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider {
: super.getCullingShape(state, view, pos); : super.getCullingShape(state, view, pos);
} }
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, int i) { public VoxelShape getShape(BlockState state, int i) {
// assuming the shape don't need the world and position // assuming the shape don't need the world and position
return getOutlineShape(state, null, null, null); return getOutlineShape(state, null, null, null);

View File

@ -149,7 +149,6 @@ public class ReFramedButtonBlock extends WaterloggableReFramedBlock {
if(!state.isOf(new_state.getBlock())) { if(!state.isOf(new_state.getBlock())) {
if (!moved && state.get(POWERED)) updateNeighbors(state, world, pos); if (!moved && state.get(POWERED)) updateNeighbors(state, world, pos);
world.removeBlockEntity(pos);
} }
} }

View File

@ -128,13 +128,6 @@ public class ReFramedDoorBlock extends WaterloggableReFramedBlock {
return super.onBreak(world, pos, state, player); return super.onBreak(world, pos, state, player);
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState other, WorldAccess world, BlockPos pos, BlockPos moved) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState other, WorldAccess world, BlockPos pos, BlockPos moved) {
if (direction.getAxis() == Direction.Axis.Y if (direction.getAxis() == Direction.Axis.Y

View File

@ -0,0 +1,188 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.util.VoxelHelper;
import fr.adrien1106.reframed.util.blocks.BlockHelper;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.state.property.Properties.*;
public class ReFramedHalfLayerBlock extends LayeredReFramedBlock {
public static final VoxelShape[] HALF_LAYER_VOXELS;
public ReFramedHalfLayerBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(EDGE, EDGE_FACE));
}
@Override
public boolean canReplace(BlockState state, ItemPlacementContext context) {
if (super.canReplace(state, context)) return true;
if (context.getPlayer() == null
|| context.getPlayer().isSneaking()
|| !(context.getStack().getItem() instanceof BlockItem block_item)
) return false;
Edge edge = state.get(EDGE);
Direction face = edge.getDirection(state.get(EDGE_FACE));
if (block_item.getBlock() == ReFramed.SLAB)
return ReFramed.SLAB
.matchesShape(
context.getHitPos(),
context.getBlockPos(),
ReFramed.SLAB.getDefaultState().with(FACING, edge.getOtherDirection(face).getOpposite())
);
if (block_item.getBlock() == ReFramed.STEP)
return ReFramed.STEP
.matchesShape(
context.getHitPos(),
context.getBlockPos(),
ReFramed.STEP.getDefaultState().with(EDGE, edge.getOpposite(face))
);
return false;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getHalfLayerShape(
state.get(EDGE),
state.get(EDGE_FACE),
state.get(LAYERS)
);
}
@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos());
BlockState state = super.getPlacementState(ctx);
if (previous.isOf(this))
return state;
if (previous.isOf(ReFramed.SLABS_HALF_LAYER) || previous.isOf(ReFramed.STEPS_HALF_LAYER))
return previous.with(LAYERS, Math.min(8, previous.get(LAYERS) + 1));
if (previous.isOf(ReFramed.SLAB)) {
Direction face = previous.get(FACING);
Edge edge;
if (face.getAxis() == ctx.getSide().getAxis()) {
edge = BlockHelper.getPlacementEdge(ctx);
if (face == ctx.getSide()) edge = edge.getOpposite(edge.getOtherDirection(ctx.getSide()));
} else edge = Edge.getByDirections(face, ctx.getSide().getOpposite());
return ReFramed.SLABS_HALF_LAYER.getDefaultState()
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(face))
.with(WATERLOGGED, previous.get(WATERLOGGED));
}
if (previous.isOf(ReFramed.STEP)) {
int face_index = 0;
Edge edge = previous.get(EDGE);
if (!ReFramed.STEP.matchesShape(
ctx.getHitPos(),
ctx.getBlockPos(),
ReFramed.STEP.getDefaultState().with(EDGE, edge.getOpposite(1))
)) face_index = 1;
return ReFramed.STEPS_HALF_LAYER.getDefaultState()
.with(EDGE, edge)
.with(EDGE_FACE, face_index)
.with(WATERLOGGED, previous.get(WATERLOGGED));
}
Edge edge = BlockHelper.getPlacementEdge(ctx);
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite()));
}
@Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, BlockRotation rotation) {
Edge edge = state.get(EDGE);
Direction face = rotation.rotate(edge.getDirection(state.get(EDGE_FACE)));
edge = edge.rotate(rotation);
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(face));
}
@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, BlockMirror mirror) {
Edge edge = state.get(EDGE);
Direction face = mirror.apply(edge.getDirection(state.get(EDGE_FACE)));
edge = edge.mirror(mirror);
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(face));
}
@Override
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
if (new_state.isOf(ReFramed.SLABS_HALF_LAYER)
|| new_state.isOf(ReFramed.STEPS_HALF_LAYER)
) return Map.of(1, 2);
return super.getThemeMap(state, new_state);
}
public static VoxelShape getHalfLayerShape(Edge edge, int face, int layer) {
return HALF_LAYER_VOXELS[edge.ordinal() * 16 + face * 8 + layer - 1];
}
static {
VoxelListBuilder builder = VoxelListBuilder.create(createCuboidShape(0, 0, 0, 16, 8, 2), 192)
.add(createCuboidShape(0, 0, 0, 16, 8, 4))
.add(createCuboidShape(0, 0, 0, 16, 8, 6))
.add(createCuboidShape(0, 0, 0, 16, 8, 8))
.add(createCuboidShape(0, 0, 0, 16, 8, 10))
.add(createCuboidShape(0, 0, 0, 16, 8, 12))
.add(createCuboidShape(0, 0, 0, 16, 8, 14))
.add(createCuboidShape(0, 0, 0, 16, 8, 16));
for (int i = 0; i < 8; i++) {
builder.add(i, VoxelHelper::rotateCX, VoxelHelper::mirrorZ);
}
for (int i = 0; i < 48; i++) {
builder.add(i, VoxelHelper::rotateCX);
}
for (int i = 0; i < 64; i++) {
builder.add(i, VoxelHelper::rotateCY);
}
for (int i = 64; i < 80; i++) {
builder.add(i, VoxelHelper::rotateX);
}
for (int i = 80; i < 96; i++) {
builder.add(i, VoxelHelper::rotateX);
}
for (int i = 96; i < 112; i++) {
builder.add(i, VoxelHelper::rotateX);
}
for (int i = 112; i < 128; i++) {
builder.add(i, VoxelHelper::rotateX);
}
HALF_LAYER_VOXELS = builder.build();
}
}

View File

@ -4,45 +4,32 @@ import fr.adrien1106.reframed.util.VoxelHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet;
import net.minecraft.state.StateManager; 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.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.state.property.Properties.FACING;
import static net.minecraft.state.property.Properties.LAYERS; import static net.minecraft.state.property.Properties.LAYERS;
public class ReFramedLayerBlock extends ReFramedSlabBlock { public class ReFramedLayerBlock extends LayeredReFramedBlock {
public static final VoxelShape[] LAYER_VOXELS; public static final VoxelShape[] LAYER_VOXELS;
public ReFramedLayerBlock(Settings settings) { public ReFramedLayerBlock(Settings settings) {
super(settings); super(settings);
setDefaultState(getDefaultState().with(LAYERS, 1)); setDefaultState(getDefaultState().with(FACING, Direction.DOWN));
}
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
List<ItemStack> drops = super.getDroppedStacks(state, builder);
drops.forEach((stack) -> {
if (stack.getItem() instanceof BlockItem bi && bi.getBlock() instanceof ReFramedLayerBlock)
stack.setCount(state.get(LAYERS));
});
return drops;
} }
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(LAYERS)); super.appendProperties(builder.add(FACING));
} }
@Override @Override
@ -51,20 +38,23 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock {
} }
@Override @Override
public boolean canReplace(BlockState state, ItemPlacementContext context) { public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
if (context.getPlayer() == null) return false; BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos());
return !( BlockState state = super.getPlacementState(ctx);
context.getPlayer().isSneaking() if (previous.isOf(this)) return state;
|| !(context.getStack().getItem() instanceof BlockItem block_item) return state.with(FACING, ctx.getSide().getOpposite());
|| !(block_item.getBlock() == this && state.get(LAYERS) < 8)
);
} }
@Override @Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { @SuppressWarnings("deprecation")
BlockState previous = ctx.getWorld().getBlockState(ctx.getBlockPos()); public BlockState rotate(BlockState state, BlockRotation rotation) {
if (!previous.isOf(this)) return super.getPlacementState(ctx); return state.with(FACING, rotation.rotate(state.get(FACING)));
return previous.with(LAYERS, previous.get(LAYERS) + 1); }
@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, BlockMirror mirror) {
return state.with(FACING, mirror.apply(state.get(FACING)));
} }
static { static {

View File

@ -71,13 +71,6 @@ public class ReFramedPillarsWallBlock extends WaterloggableReFramedDoubleBlock {
return getWallState(state, top_state, neighbors, top_shape, fs, world, pos); return getWallState(state, top_state, neighbors, top_shape, fs, world, pos);
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
if (isGhost(view, pos)) return empty(); if (isGhost(view, pos)) return empty();

View File

@ -49,13 +49,6 @@ public class ReFramedPostFenceBlock extends WaterloggableReFramedDoubleBlock {
super.appendProperties(builder.add(EAST, NORTH, SOUTH, WEST)); super.appendProperties(builder.add(EAST, NORTH, SOUTH, WEST));
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction dir, BlockState other_state, WorldAccess world, BlockPos pos, BlockPos moved) { public BlockState getStateForNeighborUpdate(BlockState state, Direction dir, BlockState other_state, WorldAccess world, BlockPos pos, BlockPos moved) {
BlockState new_state = super.getStateForNeighborUpdate(state, dir, other_state, world, pos, moved); BlockState new_state = super.getStateForNeighborUpdate(state, dir, other_state, world, pos, moved);

View File

@ -1,6 +1,7 @@
package fr.adrien1106.reframed.block; package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
@ -18,8 +19,9 @@ import org.jetbrains.annotations.Nullable;
import java.util.Map; import java.util.Map;
import static net.minecraft.state.property.Properties.AXIS; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static net.minecraft.state.property.Properties.FACING; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.state.property.Properties.*;
public class ReFramedSlabBlock extends WaterloggableReFramedBlock { public class ReFramedSlabBlock extends WaterloggableReFramedBlock {
@ -54,6 +56,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock {
&& block != ReFramed.STEP && block != ReFramed.STEP
&& block != ReFramed.SMALL_CUBE && block != ReFramed.SMALL_CUBE
&& block != ReFramed.HALF_STAIR && block != ReFramed.HALF_STAIR
&& block != ReFramed.HALF_LAYER
) return false; ) return false;
// check if the player is clicking on the inner part of the block // check if the player is clicking on the inner part of the block
@ -70,10 +73,22 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock {
@Override @Override
public BlockState getPlacementState(ItemPlacementContext ctx) { public BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos());
if (current_state.isOf(this)) if (current_state.isOf(this))
return ReFramed.SLABS_CUBE.getDefaultState() return ReFramed.SLABS_CUBE.getDefaultState()
.with(AXIS, current_state.get(FACING).getAxis()); .with(AXIS, current_state.get(FACING).getAxis());
if (current_state.isOf(ReFramed.HALF_LAYER)) {
Edge edge = current_state.get(EDGE);
Direction face = edge.getDirection(current_state.get(EDGE_FACE));
edge = edge.getOpposite(face);
return ReFramed.SLABS_HALF_LAYER.getDefaultState()
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(edge.getOtherDirection(face)))
.with(LAYERS, current_state.get(LAYERS))
.with(WATERLOGGED, current_state.get(WATERLOGGED));
}
return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite()); return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite());
} }
@ -111,6 +126,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock {
if (new_state.isOf(ReFramed.SLABS_STAIR) if (new_state.isOf(ReFramed.SLABS_STAIR)
|| new_state.isOf(ReFramed.SLABS_OUTER_STAIR) || new_state.isOf(ReFramed.SLABS_OUTER_STAIR)
|| new_state.isOf(ReFramed.SLABS_INNER_STAIR) || new_state.isOf(ReFramed.SLABS_INNER_STAIR)
|| new_state.isOf(ReFramed.SLABS_HALF_LAYER)
) return Map.of(1, 1); ) 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); 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); return super.getThemeMap(state, new_state);

View File

@ -0,0 +1,62 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.function.BooleanBiFunction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import static fr.adrien1106.reframed.block.ReFramedHalfLayerBlock.getHalfLayerShape;
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.state.property.Properties.LAYERS;
public class ReFramedSlabsHalfLayerBlock extends HalfLayerDoubleReFramedBlock {
private static final VoxelShape[] SLABS_HALF_LAYER_VOXELS = new VoxelShape[196];
public ReFramedSlabsHalfLayerBlock(Settings settings) {
super(settings);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getSlabsHalfLayerShape(state.get(EDGE), state.get(EDGE_FACE), state.get(LAYERS));
}
public static VoxelShape getSlabsHalfLayerShape(Edge edge, int face, int layers) {
int i = edge.ordinal() * 16 + face * 8 + layers - 1;
VoxelShape shape = SLABS_HALF_LAYER_VOXELS[i];
if (shape == null) {
shape = VoxelShapes.combineAndSimplify(
getShape(edge, edge.getDirection(face), layers, 1),
getShape(edge, edge.getDirection(face), layers, 2),
BooleanBiFunction.OR
);
SLABS_HALF_LAYER_VOXELS[i] = shape;
}
return shape;
}
@Override
public VoxelShape getShape(BlockState state, int i) {
Edge edge = state.get(EDGE);
Direction face = edge.getDirection(state.get(EDGE_FACE));
return getShape(edge, face, state.get(LAYERS), i);
}
private static VoxelShape getShape(Edge edge, Direction face, int layers, int i) {
if (i == 2) {
face = edge.getOtherDirection(face);
edge = edge.getOpposite(face);
}
return i == 2
? getHalfLayerShape(edge, edge.getDirectionIndex(face), layers)
: getSlabShape(face);
}
}

View File

@ -1,20 +1,13 @@
package fr.adrien1106.reframed.block; package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.util.blocks.BlockHelper;
import fr.adrien1106.reframed.util.blocks.Edge; import fr.adrien1106.reframed.util.blocks.Edge;
import fr.adrien1106.reframed.util.blocks.StairShape; import fr.adrien1106.reframed.util.blocks.StairShape;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext; 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.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape; import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
@ -22,48 +15,17 @@ import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock { public class ReFramedSlabsStairBlock extends EdgeDoubleReFramedBlock {
public ReFramedSlabsStairBlock(Settings settings) { public ReFramedSlabsStairBlock(Settings settings) {
super(settings); super(settings);
setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0));
} }
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(EDGE, EDGE_FACE));
}
@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
Edge edge = BlockHelper.getPlacementEdge(ctx);
return super.getPlacementState(ctx)
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite()));
}
@Override
@SuppressWarnings("deprecation")
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getStairShape(state.get(EDGE), StairShape.STRAIGHT); return getStairShape(state.get(EDGE), StairShape.STRAIGHT);
} }
@Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, BlockRotation rotation) {
Edge edge = state.get(EDGE).rotate(rotation);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(rotation.rotate(face)));
}
@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, BlockMirror mirror) {
Edge edge = state.get(EDGE).mirror(mirror);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(mirror.apply(face)));
}
@Override @Override
public VoxelShape getShape(BlockState state, int i) { public VoxelShape getShape(BlockState state, int i) {
Edge edge = state.get(EDGE); Edge edge = state.get(EDGE);

View File

@ -19,7 +19,6 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -53,7 +52,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock {
|| !(context.getStack().getItem() instanceof BlockItem block_item) || !(context.getStack().getItem() instanceof BlockItem block_item)
|| !( || !(
block_item.getBlock() == ReFramed.STEP block_item.getBlock() == ReFramed.STEP
&& ((ReFramedStairsCubeBlock) ReFramed.STAIRS_CUBE) && ReFramed.STAIRS_CUBE
.matchesShape( .matchesShape(
context.getHitPos(), context.getHitPos(),
context.getBlockPos(), context.getBlockPos(),
@ -87,13 +86,6 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock {
return super.getPlacementState(ctx).with(EDGE, edge).with(STAIR_SHAPE, shape); return super.getPlacementState(ctx).with(EDGE, edge).with(STAIR_SHAPE, shape);
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {

View File

@ -12,7 +12,6 @@ import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -79,13 +78,6 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock {
.with(EDGE, edge); .with(EDGE, edge);
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
public VoxelShape getShape(BlockState state, int i) { public VoxelShape getShape(BlockState state, int i) {
Edge edge = state.get(EDGE); Edge edge = state.get(EDGE);

View File

@ -50,10 +50,21 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock {
) return false; ) return false;
Block block = block_item.getBlock(); Block block = block_item.getBlock();
Edge edge = state.get(EDGE);
if (block == ReFramed.HALF_LAYER)
return matchesShape(
context.getHitPos(),
context.getBlockPos(),
getDefaultState().with(EDGE, edge.getOpposite(edge.getFirstDirection()))
) || matchesShape(
context.getHitPos(),
context.getBlockPos(),
getDefaultState().with(EDGE, edge.getOpposite(edge.getSecondDirection()))
);
// allow replacing with stair // allow replacing with stair
if (block != this && block != ReFramed.STAIR) return false; if (block != this && block != ReFramed.STAIR) return false;
Edge edge = state.get(EDGE);
return ReFramed.STAIR return ReFramed.STAIR
.matchesShape( .matchesShape(
context.getHitPos(), context.getHitPos(),
@ -134,6 +145,17 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock {
.with(WATERLOGGED, current_state.get(WATERLOGGED)); .with(WATERLOGGED, current_state.get(WATERLOGGED));
} }
if (current_state.isOf(ReFramed.HALF_LAYER)) {
Edge edge = current_state.get(EDGE);
Direction face = edge.getDirection(current_state.get(EDGE_FACE));
edge = edge.getOpposite(face);
return ReFramed.STEPS_HALF_LAYER.getDefaultState()
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(edge.getOtherDirection(face)))
.with(LAYERS, current_state.get(LAYERS))
.with(WATERLOGGED, current_state.get(WATERLOGGED));
}
return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx)); return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx));
} }
@ -161,7 +183,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock {
@Override @Override
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) { public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
if (new_state.isOf(ReFramed.STEPS_CROSS)) return Map.of(1, 1); if (new_state.isOf(ReFramed.STEPS_CROSS)
|| new_state.isOf(ReFramed.STEPS_HALF_LAYER)
) return Map.of(1, 1);
if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2); if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2);
if (new_state.isOf(ReFramed.STEPS_SLAB)) if (new_state.isOf(ReFramed.STEPS_SLAB))
return Map.of( return Map.of(

View File

@ -0,0 +1,62 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.function.BooleanBiFunction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import static fr.adrien1106.reframed.block.ReFramedHalfLayerBlock.getHalfLayerShape;
import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.state.property.Properties.LAYERS;
public class ReFramedStepsHalfLayerBlock extends HalfLayerDoubleReFramedBlock {
private static final VoxelShape[] SLABS_HALF_LAYER_VOXELS = new VoxelShape[196];
public ReFramedStepsHalfLayerBlock(Settings settings) {
super(settings);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getStepsHalfLayerShape(state.get(EDGE), state.get(EDGE_FACE), state.get(LAYERS));
}
public static VoxelShape getStepsHalfLayerShape(Edge edge, int face, int layers) {
int i = edge.ordinal() * 16 + face * 8 + layers - 1;
VoxelShape shape = SLABS_HALF_LAYER_VOXELS[i];
if (shape == null) {
shape = VoxelShapes.combineAndSimplify(
getShape(edge, edge.getDirection(face), layers, 1),
getShape(edge, edge.getDirection(face), layers, 2),
BooleanBiFunction.OR
);
SLABS_HALF_LAYER_VOXELS[i] = shape;
}
return shape;
}
@Override
public VoxelShape getShape(BlockState state, int i) {
Edge edge = state.get(EDGE);
Direction face = edge.getDirection(state.get(EDGE_FACE));
return getShape(edge, face, state.get(LAYERS), i);
}
private static VoxelShape getShape(Edge edge, Direction face, int layers, int i) {
if (i == 2) {
face = edge.getOtherDirection(face);
edge = edge.getOpposite(face);
}
return i == 2
? getHalfLayerShape(edge, edge.getDirectionIndex(face), layers)
: getStepShape(edge);
}
}

View File

@ -84,13 +84,6 @@ public class ReFramedTrapdoorBlock extends WaterloggableReFramedBlock {
return state; return state;
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { 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); ActionResult result = super.onUse(state, world, pos, player, hand, hit);

View File

@ -79,13 +79,6 @@ public class ReFramedWallBlock extends WaterloggableReFramedBlock {
return state.with(UP, shouldHavePost(state, top_state, top_shape)); return state.with(UP, shouldHavePost(state, top_state, top_shape));
} }
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) {
super.onStateReplaced(state, world, pos, new_state, moved);
if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {

View File

@ -163,6 +163,47 @@ public class ReFramedClient implements ClientModInitializer {
HELPER.addReFramedModel("half_stairs_step_stair_side_1", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_1"))); HELPER.addReFramedModel("half_stairs_step_stair_side_1", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_1")));
HELPER.addReFramedModel("half_stairs_step_stair_2" , HELPER.autoDouble(ReFramed.id("block/half_stair/base"), ReFramed.id("block/half_stair/stair/step_2"))); HELPER.addReFramedModel("half_stairs_step_stair_2" , HELPER.autoDouble(ReFramed.id("block/half_stair/base"), ReFramed.id("block/half_stair/stair/step_2")));
HELPER.addReFramedModel("half_stairs_step_stair_side_2", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_2"))); HELPER.addReFramedModel("half_stairs_step_stair_side_2", HELPER.autoDouble(ReFramed.id("block/half_stair/base_side"), ReFramed.id("block/half_stair/stair/step_side_2")));
// HALF LAYER
// --------------------- east
HELPER.addReFramedModel("half_layer_2" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_2")));
HELPER.addReFramedModel("half_layer_4" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_4")));
HELPER.addReFramedModel("half_layer_6" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_6")));
HELPER.addReFramedModel("half_layer_8" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_8")));
HELPER.addReFramedModel("half_layer_10" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_10")));
HELPER.addReFramedModel("half_layer_12" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_12")));
HELPER.addReFramedModel("half_layer_14" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_14")));
HELPER.addReFramedModel("half_layer_16" , HELPER.auto(ReFramed.id("block/half_layer/east/layer_16")));
// --------------------- side
HELPER.addReFramedModel("half_layer_side_2" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_2")));
HELPER.addReFramedModel("half_layer_side_4" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_4")));
HELPER.addReFramedModel("half_layer_side_6" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_6")));
HELPER.addReFramedModel("half_layer_side_8" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_8")));
HELPER.addReFramedModel("half_layer_side_10" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_10")));
HELPER.addReFramedModel("half_layer_side_12" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_12")));
HELPER.addReFramedModel("half_layer_side_14" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_14")));
HELPER.addReFramedModel("half_layer_side_16" , HELPER.auto(ReFramed.id("block/half_layer/side/layer_16")));
// SLAB HALF LAYER
HELPER.addReFramedModel("slabs_half_inventory" , HELPER.autoDouble(new Identifier("block/slab"), ReFramed.id("block/half_layer/slab/east/layer_4")));
// STEP HALF LAYER
HELPER.addReFramedModel("steps_half_inventory" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/half_layer/slab/east/layer_4")));
// --------------------- east
HELPER.addReFramedModel("second_half_layer_2" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_2")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_4" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_4")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_6" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_6")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_8" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_8")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_10" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_10")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_12" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_12")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_14" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_14")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_16" , HELPER.auto(ReFramed.id("block/half_layer/slab/east/layer_16")).setThemeIndex(2));
// --------------------- side
HELPER.addReFramedModel("second_half_layer_side_2" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_2")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_4" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_4")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_6" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_6")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_8" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_8")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_10" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_10")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_12" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_12")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_14" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_14")).setThemeIndex(2));
HELPER.addReFramedModel("second_half_layer_side_16" , HELPER.auto(ReFramed.id("block/half_layer/slab/side/layer_16")).setThemeIndex(2));
// item model assignments (in lieu of models/item/___.json) // item model assignments (in lieu of models/item/___.json)
@ -195,6 +236,9 @@ public class ReFramedClient implements ClientModInitializer {
HELPER.assignItemModel("steps_cross" , ReFramed.STEPS_CROSS); HELPER.assignItemModel("steps_cross" , ReFramed.STEPS_CROSS);
HELPER.assignItemModel("half_stairs_cube_stair" , ReFramed.HALF_STAIRS_CUBE_STAIR); HELPER.assignItemModel("half_stairs_cube_stair" , ReFramed.HALF_STAIRS_CUBE_STAIR);
HELPER.assignItemModel("half_stairs_step_stair_1", ReFramed.HALF_STAIRS_STEP_STAIR); HELPER.assignItemModel("half_stairs_step_stair_1", ReFramed.HALF_STAIRS_STEP_STAIR);
HELPER.assignItemModel("half_layer_2" , ReFramed.HALF_LAYER);
HELPER.assignItemModel("slabs_half_inventory" , ReFramed.SLABS_HALF_LAYER);
HELPER.assignItemModel("steps_half_inventory" , ReFramed.STEPS_HALF_LAYER);
} }
private void privateInit() { private void privateInit() {

View File

@ -25,12 +25,14 @@ public class GBlockstate extends FabricModelProvider {
providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair());
providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair());
providers.put(ReFramedLayerBlock.class, new Layer()); providers.put(ReFramedLayerBlock.class, new Layer());
providers.put(ReFramedHalfLayerBlock.class, new HalfLayer());
providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedPillarBlock.class, new Pillar());
providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabBlock.class, new Slab());
providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube());
providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair());
providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair());
providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair());
providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer());
providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube());
providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep());
providers.put(ReFramedStairBlock.class, new Stair()); providers.put(ReFramedStairBlock.class, new Stair());
@ -38,6 +40,7 @@ public class GBlockstate extends FabricModelProvider {
providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepBlock.class, new Step());
providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab());
providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); providers.put(ReFramedStepsCrossBlock.class, new StepsCross());
providers.put(ReFramedStepsHalfLayerBlock.class, new StepsHalfLayer());
providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall());
providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedWallBlock.class, new Wall());
providers.put(ReFramedPaneBlock.class, new Pane()); providers.put(ReFramedPaneBlock.class, new Pane());

View File

@ -27,12 +27,14 @@ public class GRecipe extends FabricRecipeProvider {
providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair()); providers.put(ReFramedHalfStairsCubeStairBlock.class, new HalfStairsCubeStair());
providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair()); providers.put(ReFramedHalfStairsStepStairBlock.class, new HalfStairsStepStair());
providers.put(ReFramedLayerBlock.class, new Layer()); providers.put(ReFramedLayerBlock.class, new Layer());
providers.put(ReFramedHalfLayerBlock.class, new HalfLayer());
providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedPillarBlock.class, new Pillar());
providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabBlock.class, new Slab());
providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube());
providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSlabsStairBlock.class, new SlabsStair());
providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair()); providers.put(ReFramedSlabsOuterStairBlock.class, new SlabsOuterStair());
providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair()); providers.put(ReFramedSlabsInnerStairBlock.class, new SlabsInnerStair());
providers.put(ReFramedSlabsHalfLayerBlock.class, new SlabsHalfLayer());
providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube());
providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep());
providers.put(ReFramedStairBlock.class, new Stair()); providers.put(ReFramedStairBlock.class, new Stair());
@ -40,6 +42,7 @@ public class GRecipe extends FabricRecipeProvider {
providers.put(ReFramedStepBlock.class, new Step()); providers.put(ReFramedStepBlock.class, new Step());
providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); providers.put(ReFramedStepsSlabBlock.class, new StepsSlab());
providers.put(ReFramedStepsCrossBlock.class, new StepsCross()); providers.put(ReFramedStepsCrossBlock.class, new StepsCross());
providers.put(ReFramedStepsHalfLayerBlock.class, new StepsHalfLayer());
providers.put(ReFramedPillarsWallBlock.class, new PillarsWall()); providers.put(ReFramedPillarsWallBlock.class, new PillarsWall());
providers.put(ReFramedWallBlock.class, new Wall()); providers.put(ReFramedWallBlock.class, new Wall());
providers.put(ReFramedPaneBlock.class, new Pane()); providers.put(ReFramedPaneBlock.class, new Pane());

View File

@ -0,0 +1,171 @@
package fr.adrien1106.reframed.generator.block;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.generator.BlockStateProvider;
import fr.adrien1106.reframed.generator.RecipeSetter;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Block;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.client.MultipartBlockStateSupplier;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.RecipeProvider;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;
import java.util.Map;
import static fr.adrien1106.reframed.generator.GBlockstate.variant;
import static fr.adrien1106.reframed.generator.GBlockstate.when;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static fr.adrien1106.reframed.util.blocks.Edge.*;
import static net.minecraft.data.client.VariantSettings.Rotation.*;
import static net.minecraft.state.property.Properties.LAYERS;
public class HalfLayer implements RecipeSetter, BlockStateProvider {
@Override
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 16);
ShapelessRecipeJsonBuilder
.create(RecipeCategory.BUILDING_BLOCKS, convertible, 2)
.input(ReFramed.LAYER)
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
.offerTo(exporter);
}
@Override
public BlockStateSupplier getMultipart(Block block) {
return getMultipart(block, "half_layer");
}
public static MultipartBlockStateSupplier getMultipart(Block block, String layer) {
Map<Integer, Identifier> layer_model = Map.of(
1, ReFramed.id(layer + "_2_special"),
2, ReFramed.id(layer + "_4_special"),
3, ReFramed.id(layer + "_6_special"),
4, ReFramed.id(layer + "_8_special"),
5, ReFramed.id(layer + "_10_special"),
6, ReFramed.id(layer + "_12_special"),
7, ReFramed.id(layer + "_14_special"),
8, ReFramed.id(layer + "_16_special")
);
Map<Integer, Identifier> layer_side = Map.of(
1, ReFramed.id(layer + "_side_2_special"),
2, ReFramed.id(layer + "_side_4_special"),
3, ReFramed.id(layer + "_side_6_special"),
4, ReFramed.id(layer + "_side_8_special"),
5, ReFramed.id(layer + "_side_10_special"),
6, ReFramed.id(layer + "_side_12_special"),
7, ReFramed.id(layer + "_side_14_special"),
8, ReFramed.id(layer + "_side_16_special")
);
MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(block);
// DOWN
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, DOWN_EAST, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R0))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, DOWN_SOUTH, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R90))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, WEST_DOWN, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R0, R180))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, NORTH_DOWN, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R0, R270))
);
// UP
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, EAST_UP, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R0))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, SOUTH_UP, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R90))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, UP_WEST, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R180, R180))
);
layer_model.forEach((i, model) ->
supplier.with(when(EDGE, UP_NORTH, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R180, R270))
);
// EAST
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, EAST_SOUTH, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R0))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, EAST_UP, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R90, R0))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, NORTH_EAST, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R0))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, DOWN_EAST, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R270, R0))
);
// SOUTH
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, SOUTH_WEST, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R90))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, SOUTH_UP, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R90, R90))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, EAST_SOUTH, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R90))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, DOWN_SOUTH, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R270, R90))
);
// WEST
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, WEST_NORTH, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R180))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, UP_WEST, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R90, R180))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, SOUTH_WEST, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R180))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, WEST_DOWN, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R270, R180))
);
// NORTH
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, NORTH_EAST, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R0, R270))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, UP_NORTH, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R90, R270))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, WEST_NORTH, EDGE_FACE, 1, LAYERS, i),
variant(model, true, R180, R270))
);
layer_side.forEach((i, model) ->
supplier.with(when(EDGE, NORTH_DOWN, EDGE_FACE, 0, LAYERS, i),
variant(model, true, R270, R270))
);
return supplier;
}
}

View File

@ -0,0 +1,93 @@
package fr.adrien1106.reframed.generator.block;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.generator.BlockStateProvider;
import fr.adrien1106.reframed.generator.RecipeSetter;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Block;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.RecipeProvider;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;
import static fr.adrien1106.reframed.generator.GBlockstate.variant;
import static fr.adrien1106.reframed.generator.GBlockstate.when;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static fr.adrien1106.reframed.util.blocks.Edge.*;
import static net.minecraft.data.client.VariantSettings.Rotation.*;
import static net.minecraft.data.client.When.anyOf;
public class SlabsHalfLayer implements RecipeSetter, BlockStateProvider {
@Override
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2);
ShapelessRecipeJsonBuilder
.create(RecipeCategory.BUILDING_BLOCKS, convertible)
.input(ReFramed.HALF_LAYER)
.input(ReFramed.SLAB)
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
.offerTo(exporter);
}
@Override
public BlockStateSupplier getMultipart(Block block) {
Identifier slab_model = ReFramed.id("slab_special");
return HalfLayer.getMultipart(block, "second_half_layer")
.with(
anyOf(
when(EDGE, DOWN_EAST, EDGE_FACE, 0),
when(EDGE, DOWN_SOUTH, EDGE_FACE, 0),
when(EDGE, WEST_DOWN, EDGE_FACE, 1),
when(EDGE, NORTH_DOWN, EDGE_FACE, 1)
),
variant(slab_model, true, R0, R0))
.with(
anyOf(
when(EDGE, EAST_SOUTH, EDGE_FACE, 1),
when(EDGE, DOWN_SOUTH, EDGE_FACE, 1),
when(EDGE, SOUTH_WEST, EDGE_FACE, 0),
when(EDGE, SOUTH_UP, EDGE_FACE, 0)
),
variant(slab_model, true, R90, R0))
.with(
anyOf(
when(EDGE, UP_WEST, EDGE_FACE, 0),
when(EDGE, UP_NORTH, EDGE_FACE, 0),
when(EDGE, EAST_UP, EDGE_FACE, 1),
when(EDGE, SOUTH_UP, EDGE_FACE, 1)
),
variant(slab_model, true, R180, R0))
.with(
anyOf(
when(EDGE, WEST_NORTH, EDGE_FACE, 1),
when(EDGE, UP_NORTH, EDGE_FACE, 1),
when(EDGE, NORTH_EAST, EDGE_FACE, 0),
when(EDGE, NORTH_DOWN, EDGE_FACE, 0)
),
variant(slab_model, true, R270, R0))
.with(
anyOf(
when(EDGE, SOUTH_WEST, EDGE_FACE, 1),
when(EDGE, UP_WEST, EDGE_FACE, 1),
when(EDGE, WEST_NORTH, EDGE_FACE, 0),
when(EDGE, WEST_DOWN, EDGE_FACE, 0)
),
variant(slab_model, true, R90, R90))
.with(
anyOf(
when(EDGE, NORTH_EAST, EDGE_FACE, 1),
when(EDGE, DOWN_EAST, EDGE_FACE, 1),
when(EDGE, EAST_SOUTH, EDGE_FACE, 0),
when(EDGE, EAST_UP, EDGE_FACE, 0)
),
variant(slab_model, true, R90, R270))
;
}
}

View File

@ -0,0 +1,69 @@
package fr.adrien1106.reframed.generator.block;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.generator.BlockStateProvider;
import fr.adrien1106.reframed.generator.GBlockstate;
import fr.adrien1106.reframed.generator.RecipeSetter;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Block;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.RecipeProvider;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.Edge.*;
import static net.minecraft.data.client.VariantSettings.Rotation.*;
public class StepsHalfLayer implements RecipeSetter, BlockStateProvider {
@Override
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4);
ShapelessRecipeJsonBuilder
.create(RecipeCategory.BUILDING_BLOCKS, convertible)
.input(ReFramed.HALF_LAYER)
.input(ReFramed.STEP)
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
.offerTo(exporter);
}
@Override
public BlockStateSupplier getMultipart(Block block) {
Identifier step_model = ReFramed.id("step_special");
return HalfLayer.getMultipart(block, "second_half_layer")
/* X AXIS */
.with(GBlockstate.when(EDGE, DOWN_EAST),
GBlockstate.variant(step_model, true, R0, R0))
.with(GBlockstate.when(EDGE, EAST_UP),
GBlockstate.variant(step_model, true, R180, R0))
.with(GBlockstate.when(EDGE, UP_WEST),
GBlockstate.variant(step_model, true, R180, R180))
.with(GBlockstate.when(EDGE, WEST_DOWN),
GBlockstate.variant(step_model, true, R0, R180))
/* Y AXIS */
.with(GBlockstate.when(EDGE, EAST_SOUTH),
GBlockstate.variant(step_model, true, R90, R0))
.with(GBlockstate.when(EDGE, SOUTH_WEST),
GBlockstate.variant(step_model, true, R90, R90))
.with(GBlockstate.when(EDGE, WEST_NORTH),
GBlockstate.variant(step_model, true, R90, R180))
.with(GBlockstate.when(EDGE, NORTH_EAST),
GBlockstate.variant(step_model, true, R90, R270))
/* Z AXIS */
.with(GBlockstate.when(EDGE, DOWN_SOUTH),
GBlockstate.variant(step_model, true, R0, R90))
.with(GBlockstate.when(EDGE, NORTH_DOWN),
GBlockstate.variant(step_model, true, R0, R270))
.with(GBlockstate.when(EDGE, UP_NORTH),
GBlockstate.variant(step_model, true, R180, R270))
.with(GBlockstate.when(EDGE, SOUTH_UP),
GBlockstate.variant(step_model, true, R180, R90))
;
}
}

View File

@ -201,5 +201,24 @@ public class VoxelHelper {
} }
return shapes; return shapes;
} }
/**
* build a new set of voxels based on the combination of two sets of voxels
* @param long_voxels - the first set of voxels
* @param short_voxels - the second set of voxels
* @param mapping_function - the function to map the index of the first set to the index of the second set
* @return the array of added voxels
*/
public static VoxelShape[] buildFrom(VoxelShape[] long_voxels, VoxelShape[] short_voxels, Function<Integer, Integer> mapping_function) {
VoxelShape[] shapes = new VoxelShape[long_voxels.length];
for (int i = 0; i < shapes.length; i++) {
shapes[i] = VoxelShapes.combineAndSimplify(
long_voxels[i],
short_voxels[mapping_function.apply(i)],
BooleanBiFunction.OR
);
}
return shapes;
}
} }
} }

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 6, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 6, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 6, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 6, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 12, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 4, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 4, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 4, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 4, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 14, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 2, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 2, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 2, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 2, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 2, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 14, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 14, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 14, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 14, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 4, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 12, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 12, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 12, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 12, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 6, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 10, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 10, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 10, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 10, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 0],
"to": [16, 8, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 8, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [6, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 10, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [6, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [6, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [6, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [4, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 12, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [4, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [4, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [4, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [2, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 14, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [2, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [2, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [2, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [14, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 2, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [14, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [14, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [14, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [12, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 4, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [12, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [12, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [12, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [10, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 6, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [10, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [10, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [10, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 0, 8],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 8, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side"},
"up": {"uv": [8, 8, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [6, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 10, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [6, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [6, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [6, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [4, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 12, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [4, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [4, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [4, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [2, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 14, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [2, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [2, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [2, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [14, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 2, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [14, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [14, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [14, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [12, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 4, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [12, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [12, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [12, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [10, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 6, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [10, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [10, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [10, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 16, 0]},
"faces": {
"north": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 6],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 10, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [6, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 6, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 10], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 4],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 12, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [4, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 4, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 12], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 2],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 14, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [2, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 2, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 14], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 0],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 0, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 16], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 14],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 2, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [14, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 14, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 2], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 12],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 4, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [12, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 12, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 4], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 10],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 6, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [10, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 10, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 6], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 0, 8],
"to": [8, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
"faces": {
"north": {"uv": [8, 0, 16, 16], "texture": "#side"},
"east": {"uv": [0, 0, 8, 16], "texture": "#side"},
"south": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "east"},
"up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [16, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 6, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [16, 12, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 4, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [16, 14, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 2, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 16, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,36 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 8, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 8, 0]},
"faces": {
"north": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 8, 16, 16], "texture": "#side"},
"up": {"uv": [8, 0, 16, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom"}
}
}
],
"display": {
"thirdperson_lefthand": {
"rotation": [75, -135, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"gui": {
"rotation": [30, 135, 0],
"scale": [0.625, 0.625, 0.625]
},
"head": {
"rotation": [0, -90, 0]
}
}
}