Compare commits
No commits in common. "74a290fd16ac39c4949ca2bdb613413727f0a243" and "3afee9e501c1891a5968410dbd831ae7743c4477" have entirely different histories.
74a290fd16
...
3afee9e501
@ -37,7 +37,7 @@ public class ReFramed implements ModInitializer {
|
|||||||
public static final String MODID = "reframed";
|
public static final String MODID = "reframed";
|
||||||
|
|
||||||
public static final ArrayList<Block> BLOCKS = new ArrayList<>();
|
public static final ArrayList<Block> BLOCKS = new ArrayList<>();
|
||||||
public static Block CUBE, SMALL_CUBE, SMALL_CUBES_STEP, STAIR, HALF_STAIR, STAIRS_CUBE, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, SLAB, SLABS_CUBE, STEP, STEPS_SLAB, LAYER, PILLAR;
|
public static Block CUBE, SMALL_CUBE, SMALL_CUBES_STEP, STAIR, HALF_STAIR, STAIRS_CUBE, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, SLAB, SLABS_CUBE, STEP, STEPS_SLAB, LAYER;
|
||||||
|
|
||||||
public static final ArrayList<Item> ITEMS = new ArrayList<>();
|
public static final ArrayList<Item> ITEMS = new ArrayList<>();
|
||||||
public static Item HAMMER, SCREWDRIVER, BLUEPRINT, BLUEPRINT_WRITTEN;
|
public static Item HAMMER, SCREWDRIVER, BLUEPRINT, BLUEPRINT_WRITTEN;
|
||||||
@ -64,7 +64,6 @@ public class ReFramed implements ModInitializer {
|
|||||||
SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(cp(Blocks.OAK_SLAB)));
|
SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(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)));
|
||||||
PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE)));
|
|
||||||
|
|
||||||
HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1)));
|
HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1)));
|
||||||
SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1)));
|
SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1)));
|
||||||
|
@ -7,6 +7,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.state.property.Property;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
@ -49,7 +50,22 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) {
|
@SafeVarargs
|
||||||
|
public final <T extends Comparable<T>> boolean matchesAnyOutline(Vec3d hit, BlockPos pos, Property<T> property, T... values) {
|
||||||
|
for (T value : values)
|
||||||
|
if (matchesOutline(hit, pos, property, value)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Comparable<T>> boolean matchesOutline(Vec3d hit, BlockPos pos, Property<T> property, T value) {
|
||||||
|
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
|
||||||
|
return BlockHelper.cursorMatchesFace(
|
||||||
|
getOutlineShape(getDefaultState().with(property, value), null, null, null),
|
||||||
|
rel
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Comparable<T>> boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) {
|
||||||
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
|
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
|
||||||
return BlockHelper.cursorMatchesFace(
|
return BlockHelper.cursorMatchesFace(
|
||||||
getShape(state, i),
|
getShape(state, i),
|
||||||
|
@ -34,7 +34,6 @@ import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
|||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
import static net.minecraft.state.property.Properties.WATERLOGGED;
|
|
||||||
|
|
||||||
public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
||||||
|
|
||||||
@ -64,35 +63,12 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
||||||
Direction dir = state.get(CORNER).getDirection(state.get(CORNER_FACE));
|
|
||||||
return !(
|
return !(
|
||||||
context.getPlayer().isSneaking()
|
context.getPlayer().isSneaking()
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
||||||
|| (
|
|| (
|
||||||
!(
|
block_item.getBlock() != this
|
||||||
block_item.getBlock() == this
|
&& block_item.getBlock() != ReFramed.SMALL_CUBE
|
||||||
&& ((ReFramedHalfStairsStairBlock) ReFramed.HALF_STAIRS_STAIR)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.HALF_STAIRS_STAIR.getDefaultState()
|
|
||||||
.with(EDGE, state.get(CORNER).getEdge(dir)),
|
|
||||||
dir.getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
)
|
|
||||||
&& !(
|
|
||||||
block_item.getBlock() == ReFramed.SMALL_CUBE
|
|
||||||
&& BlockHelper.cursorMatchesFace(
|
|
||||||
ReFramed.SMALL_CUBE.getOutlineShape(
|
|
||||||
ReFramed.SMALL_CUBE.getDefaultState()
|
|
||||||
.with(CORNER, state.get(CORNER).getOpposite(state.get(CORNER_FACE))),
|
|
||||||
context.getWorld(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ShapeContext.absent()
|
|
||||||
),
|
|
||||||
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -104,14 +80,12 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement
|
|||||||
Corner corner = current_state.get(CORNER).getOpposite(ctx.getSide().getOpposite());
|
Corner corner = current_state.get(CORNER).getOpposite(ctx.getSide().getOpposite());
|
||||||
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
||||||
.with(CORNER, corner)
|
.with(CORNER, corner)
|
||||||
.with(CORNER_FACE, corner.getDirectionIndex(ctx.getSide().getOpposite()))
|
.with(CORNER_FACE, corner.getDirectionIndex(ctx.getSide().getOpposite()));
|
||||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_state.isOf(this))
|
if (current_state.isOf(this))
|
||||||
return ReFramed.HALF_STAIRS_STAIR.getDefaultState()
|
return ReFramed.HALF_STAIRS_STAIR.getDefaultState()
|
||||||
.with(EDGE, current_state.get(CORNER).getEdge(current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE))))
|
.with(EDGE, current_state.get(CORNER).getEdge(current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE))));
|
||||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
|
||||||
|
|
||||||
Corner corner = BlockHelper.getPlacementCorner(ctx);
|
Corner corner = BlockHelper.getPlacementCorner(ctx);
|
||||||
return super.getPlacementState(ctx)
|
return super.getPlacementState(ctx)
|
||||||
|
@ -7,7 +7,6 @@ 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.data.client.MultipartBlockStateSupplier;
|
import net.minecraft.data.client.MultipartBlockStateSupplier;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
@ -53,12 +52,8 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
public boolean canReplace(BlockState state, ItemPlacementContext ctx) {
|
||||||
return !(
|
return !(!state.isOf(this) || ctx.getPlayer().isSneaking() || state.get(LAYERS) == 8);
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| !(block_item.getBlock() == this && state.get(LAYERS) < 8)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
package fr.adrien1106.reframed.block;
|
|
||||||
|
|
||||||
import fr.adrien1106.reframed.ReFramed;
|
|
||||||
import fr.adrien1106.reframed.generator.BlockStateProvider;
|
|
||||||
import fr.adrien1106.reframed.generator.GBlockstate;
|
|
||||||
import fr.adrien1106.reframed.util.VoxelHelper;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.ShapeContext;
|
|
||||||
import net.minecraft.data.client.BlockStateSupplier;
|
|
||||||
import net.minecraft.data.client.MultipartBlockStateSupplier;
|
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
|
||||||
import net.minecraft.state.StateManager;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
|
||||||
import net.minecraft.world.BlockView;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
|
||||||
import static net.minecraft.state.property.Properties.AXIS;
|
|
||||||
|
|
||||||
public class ReFramedPillarBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
|
||||||
|
|
||||||
public static final VoxelShape[] PILLAR_VOXELS;
|
|
||||||
|
|
||||||
public ReFramedPillarBlock(Settings settings) {
|
|
||||||
super(settings);
|
|
||||||
setDefaultState(getDefaultState().with(AXIS, Direction.Axis.Y));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getModelCacheKey(BlockState state) {
|
|
||||||
return state.get(AXIS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getModelStateCount() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
|
||||||
super.appendProperties(builder.add(AXIS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
return !(context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| !(
|
|
||||||
block_item.getBlock() == this
|
|
||||||
&& state.get(AXIS) != context.getSide().getAxis()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
|
||||||
// TODO: PILLARS WALL
|
|
||||||
return super.getPlacementState(ctx).with(AXIS, ctx.getSide().getAxis());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
|
||||||
return getPillarShape(state.get(AXIS));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static VoxelShape getPillarShape(Direction.Axis axis) {
|
|
||||||
return PILLAR_VOXELS[axis.ordinal()];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
// if (new_state.getBlock() == ReFramed.PILLARS_WALL) return Map.of(1, 1); // TODO: PILLARS WALL
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockStateSupplier getMultipart() {
|
|
||||||
Identifier model_id = ReFramed.id("pillar_special");
|
|
||||||
return MultipartBlockStateSupplier.create(this)
|
|
||||||
.with(GBlockstate.when(AXIS, Direction.Axis.X),
|
|
||||||
GBlockstate.variant(model_id, true, R90, R90))
|
|
||||||
.with(GBlockstate.when(AXIS, Direction.Axis.Y),
|
|
||||||
GBlockstate.variant(model_id, true, R0, R0))
|
|
||||||
.with(GBlockstate.when(AXIS, Direction.Axis.Z),
|
|
||||||
GBlockstate.variant(model_id, true, R90, R0));
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
final VoxelShape PILLAR = createCuboidShape(0, 4, 4, 16, 12, 12);
|
|
||||||
PILLAR_VOXELS = VoxelHelper.VoxelListBuilder.create(PILLAR, 3)
|
|
||||||
.add(VoxelHelper::rotateZ)
|
|
||||||
.add(VoxelHelper::rotateX)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -63,16 +63,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
return !(
|
return !(
|
||||||
context.getPlayer().isSneaking()
|
context.getPlayer().isSneaking()
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
||||||
|| !(
|
|| block_item.getBlock() != this
|
||||||
block_item.getBlock() == this
|
|
||||||
&& ((ReFramedSlabsCubeBlock) ReFramed.SLABS_CUBE)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.SLABS_CUBE.getDefaultState().with(AXIS, state.get(FACING).getAxis()),
|
|
||||||
state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
|||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
import static net.minecraft.state.property.Properties.WATERLOGGED;
|
|
||||||
|
|
||||||
public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
||||||
|
|
||||||
@ -80,28 +79,21 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement
|
|||||||
)
|
)
|
||||||
&& !(
|
&& !(
|
||||||
block_item.getBlock() == this
|
block_item.getBlock() == this
|
||||||
&& (
|
&& !(
|
||||||
((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP)
|
corner.hasDirection(context.getSide())
|
||||||
.matchesShape(
|
&& BlockHelper.cursorMatchesFace(
|
||||||
|
getOutlineShape(state, context.getWorld(), context.getBlockPos(), null),
|
||||||
|
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP)
|
||||||
|
.matchesAnyOutline(
|
||||||
context.getHitPos(),
|
context.getHitPos(),
|
||||||
context.getBlockPos(),
|
context.getBlockPos(),
|
||||||
ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection())),
|
EDGE,
|
||||||
corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
corner.getEdge(corner.getFirstDirection()),
|
||||||
)
|
corner.getEdge(corner.getSecondDirection()),
|
||||||
|| ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP)
|
corner.getEdge(corner.getThirdDirection())
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getSecondDirection())),
|
|
||||||
corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
|| ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getThirdDirection())),
|
|
||||||
corner.getThirdDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -115,27 +107,23 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement
|
|||||||
if (current_state.isOf(ReFramed.HALF_STAIR))
|
if (current_state.isOf(ReFramed.HALF_STAIR))
|
||||||
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
||||||
.with(CORNER, current_state.get(CORNER))
|
.with(CORNER, current_state.get(CORNER))
|
||||||
.with(CORNER_FACE, current_state.get(CORNER_FACE))
|
.with(CORNER_FACE, current_state.get(CORNER_FACE));
|
||||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
|
||||||
|
|
||||||
|
|
||||||
if (current_state.isOf(this)) {
|
if (current_state.isOf(this)) {
|
||||||
Vec3d hit = ctx.getHitPos();
|
Vec3d hit = ctx.getHitPos();
|
||||||
Corner corner = current_state.get(CORNER);
|
Corner corner = current_state.get(CORNER);
|
||||||
ReFramedSmallCubesStepBlock block = ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP);
|
ReFramedSmallCubesStepBlock block = ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP);
|
||||||
BlockState state = block.getDefaultState()
|
BlockState state = block.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection()));
|
||||||
.with(EDGE, corner.getEdge(corner.getFirstDirection()))
|
if (!block.matchesShape(
|
||||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
|
||||||
if (block.matchesShape(
|
|
||||||
hit, pos, state,
|
hit, pos, state,
|
||||||
corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
||||||
)) return state;
|
)) state = state.with(EDGE, corner.getEdge(corner.getSecondDirection()));
|
||||||
state = state.with(EDGE, corner.getEdge(corner.getSecondDirection()));
|
if (!block.matchesShape(
|
||||||
if (block.matchesShape(
|
|
||||||
hit, pos, state,
|
hit, pos, state,
|
||||||
corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
||||||
)) return state;
|
)) state = state.with(EDGE, corner.getEdge(corner.getThirdDirection()));
|
||||||
return state.with(EDGE, corner.getEdge(corner.getThirdDirection()));
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx));
|
return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx));
|
||||||
|
@ -70,16 +70,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
return !(
|
return !(
|
||||||
context.getPlayer().isSneaking()
|
context.getPlayer().isSneaking()
|
||||||
|| !(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)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
state,
|
|
||||||
2
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
|||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
import static net.minecraft.state.property.Properties.*;
|
import static net.minecraft.state.property.Properties.AXIS;
|
||||||
import static net.minecraft.state.property.Properties.WATERLOGGED;
|
import static net.minecraft.state.property.Properties.FACING;
|
||||||
|
|
||||||
public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
||||||
|
|
||||||
@ -68,38 +68,23 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
context.getPlayer().isSneaking()
|
context.getPlayer().isSneaking()
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
||||||
|| (
|
|| (
|
||||||
!(
|
block_item.getBlock() != ReFramed.STAIR
|
||||||
block_item.getBlock() == ReFramed.STAIR
|
|
||||||
&& ((ReFramedStairsCubeBlock) ReFramed.STAIRS_CUBE)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.STAIRS_CUBE.getDefaultState().with(EDGE, edge.opposite()),
|
|
||||||
1
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
&& !(
|
&& !(
|
||||||
block_item.getBlock() == this
|
block_item.getBlock() == this
|
||||||
&& (
|
&& !(
|
||||||
((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB)
|
(edge.isSide(context.getSide()) || edge.hasDirection(context.getSide()))
|
||||||
.matchesShape(
|
&& BlockHelper.cursorMatchesFace(
|
||||||
|
getOutlineShape(state, context.getWorld(), context.getBlockPos(), null),
|
||||||
|
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB)
|
||||||
|
.matchesAnyOutline(
|
||||||
context.getHitPos(),
|
context.getHitPos(),
|
||||||
context.getBlockPos(),
|
context.getBlockPos(),
|
||||||
ReFramed.STEPS_SLAB.getDefaultState()
|
FACING,
|
||||||
.with(FACING, edge.getFirstDirection())
|
edge.getFirstDirection(),
|
||||||
.with(AXIS, edge.getSecondDirection().getAxis()),
|
edge.getSecondDirection()
|
||||||
edge.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
|| ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB)
|
|
||||||
.matchesShape(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
ReFramed.STEPS_SLAB.getDefaultState()
|
|
||||||
.with(FACING, edge.getSecondDirection())
|
|
||||||
.with(AXIS, edge.getFirstDirection().getAxis()),
|
|
||||||
edge.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -124,8 +109,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB);
|
ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB);
|
||||||
BlockState state = block.getDefaultState()
|
BlockState state = block.getDefaultState()
|
||||||
.with(FACING, dir)
|
.with(FACING, dir)
|
||||||
.with(AXIS, edge.getOtherDirection(dir).getAxis())
|
.with(AXIS, edge.getOtherDirection(dir).getAxis());
|
||||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
|
||||||
if (!block.matchesShape(
|
if (!block.matchesShape(
|
||||||
hit, pos,
|
hit, pos,
|
||||||
state,
|
state,
|
||||||
|
@ -73,8 +73,6 @@ public class ReFramedClient implements ClientModInitializer {
|
|||||||
HELPER.addReFramedModel("layer_6_special" , HELPER.auto(new Identifier("block/snow_height12")));
|
HELPER.addReFramedModel("layer_6_special" , HELPER.auto(new Identifier("block/snow_height12")));
|
||||||
HELPER.addReFramedModel("layer_7_special" , HELPER.auto(new Identifier("block/snow_height14")));
|
HELPER.addReFramedModel("layer_7_special" , HELPER.auto(new Identifier("block/snow_height14")));
|
||||||
HELPER.addReFramedModel("layer_8_special" , HELPER.auto(new Identifier("block/cube")));
|
HELPER.addReFramedModel("layer_8_special" , HELPER.auto(new Identifier("block/cube")));
|
||||||
// PILLAR
|
|
||||||
HELPER.addReFramedModel("pillar_special" , HELPER.auto(ReFramed.id("block/pillar")));
|
|
||||||
|
|
||||||
//item model assignments (in lieu of models/item/___.json)
|
//item model assignments (in lieu of models/item/___.json)
|
||||||
HELPER.assignItemModel("cube_special" , ReFramed.CUBE);
|
HELPER.assignItemModel("cube_special" , ReFramed.CUBE);
|
||||||
@ -90,7 +88,6 @@ public class ReFramedClient implements ClientModInitializer {
|
|||||||
HELPER.assignItemModel("step_special" , ReFramed.STEP);
|
HELPER.assignItemModel("step_special" , ReFramed.STEP);
|
||||||
HELPER.assignItemModel("steps_slab_special" , ReFramed.STEPS_SLAB);
|
HELPER.assignItemModel("steps_slab_special" , ReFramed.STEPS_SLAB);
|
||||||
HELPER.assignItemModel("layer_1_special" , ReFramed.LAYER);
|
HELPER.assignItemModel("layer_1_special" , ReFramed.LAYER);
|
||||||
HELPER.assignItemModel("pillar_special" , ReFramed.PILLAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void privateInit() {
|
private void privateInit() {
|
||||||
|
@ -43,7 +43,7 @@ public class ReFramedBlueprintItem extends Item implements RecipeSetter {
|
|||||||
@Override
|
@Override
|
||||||
public void setRecipe(RecipeExporter exporter) {
|
public void setRecipe(RecipeExporter exporter) {
|
||||||
ShapedRecipeJsonBuilder
|
ShapedRecipeJsonBuilder
|
||||||
.create(RecipeCategory.TOOLS, this, 3)
|
.create(RecipeCategory.BUILDING_BLOCKS, this, 3)
|
||||||
.pattern("PI")
|
.pattern("PI")
|
||||||
.pattern("PP")
|
.pattern("PP")
|
||||||
.input('P', Items.PAPER)
|
.input('P', Items.PAPER)
|
||||||
|
@ -56,7 +56,7 @@ public class ReFramedHammerItem extends Item implements RecipeSetter {
|
|||||||
@Override
|
@Override
|
||||||
public void setRecipe(RecipeExporter exporter) {
|
public void setRecipe(RecipeExporter exporter) {
|
||||||
ShapedRecipeJsonBuilder
|
ShapedRecipeJsonBuilder
|
||||||
.create(RecipeCategory.TOOLS, this)
|
.create(RecipeCategory.BUILDING_BLOCKS, this)
|
||||||
.pattern(" CI")
|
.pattern(" CI")
|
||||||
.pattern(" ~C")
|
.pattern(" ~C")
|
||||||
.pattern("~ ")
|
.pattern("~ ")
|
||||||
|
@ -65,7 +65,7 @@ public class ReFramedScrewdriverItem extends Item implements RecipeSetter {
|
|||||||
@Override
|
@Override
|
||||||
public void setRecipe(RecipeExporter exporter) {
|
public void setRecipe(RecipeExporter exporter) {
|
||||||
ShapedRecipeJsonBuilder
|
ShapedRecipeJsonBuilder
|
||||||
.create(RecipeCategory.TOOLS, this)
|
.create(RecipeCategory.BUILDING_BLOCKS, this)
|
||||||
.pattern(" I")
|
.pattern(" I")
|
||||||
.pattern(" I ")
|
.pattern(" I ")
|
||||||
.pattern("C ")
|
.pattern("C ")
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"credit": "Made with Blockbench",
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"particle": "#side"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"from": [4, 0, 4],
|
|
||||||
"to": [12, 16, 12],
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [4, 0, 12, 16], "texture": "#side"},
|
|
||||||
"east": {"uv": [4, 0, 12, 16], "texture": "#side"},
|
|
||||||
"south": {"uv": [4, 0, 12, 16], "texture": "#side"},
|
|
||||||
"west": {"uv": [4, 0, 12, 16], "texture": "#side"},
|
|
||||||
"up": {"uv": [4, 4, 12, 12], "texture": "#top", "cullface": "up"},
|
|
||||||
"down": {"uv": [4, 4, 12, 12], "texture": "#bottom", "cullface": "down"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user