feat: added StepCross
This commit is contained in:
parent
5812812bd9
commit
3bf9fc2268
@ -43,7 +43,7 @@ public class ReFramed implements ModInitializer {
|
||||
STAIR, STAIRS_CUBE,
|
||||
HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR,
|
||||
SLAB, SLABS_CUBE, SLABS_STAIR, SLABS_OUTER_STAIR, SLABS_INNER_STAIR,
|
||||
STEP, STEPS_SLAB,
|
||||
STEP, STEPS_SLAB, STEPS_CROSS,
|
||||
LAYER,
|
||||
PILLAR, PILLARS_WALL, WALL,
|
||||
PANE, TRAPDOOR, DOOR,
|
||||
@ -78,6 +78,7 @@ public class ReFramed implements ModInitializer {
|
||||
SLABS_INNER_STAIR = registerBlock("slabs_inner_stair" , new ReFramedSlabsInnerStairBlock(cp(Blocks.OAK_STAIRS)));
|
||||
STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB)));
|
||||
STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB)));
|
||||
STEPS_CROSS = registerBlock("steps_cross" , new ReFramedStepsCrossBlock(cp(Blocks.OAK_SLAB)));
|
||||
PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE)));
|
||||
PILLARS_WALL = registerBlock("pillars_wall" , new ReFramedPillarsWallBlock(cp(Blocks.OAK_FENCE)));
|
||||
WALL = registerBlock("wall" , new ReFramedWallBlock(cp(Blocks.OAK_FENCE)));
|
||||
|
@ -102,7 +102,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock {
|
||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
||||
|
||||
// Steps Cross
|
||||
return null; // TODO STEP cross
|
||||
return ReFramed.STEPS_CROSS.getDefaultState()
|
||||
.with(EDGE, edge)
|
||||
.with(WATERLOGGED, current_state.get(WATERLOGGED));
|
||||
} else if (current_state.isOf(ReFramed.SLAB)) {
|
||||
Direction facing = current_state.get(FACING);
|
||||
Edge edge;
|
||||
@ -145,6 +147,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock {
|
||||
|
||||
@Override
|
||||
public Map<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.STAIRS_CUBE)) return Map.of(1, 2);
|
||||
if (new_state.isOf(ReFramed.STEPS_SLAB))
|
||||
return Map.of(
|
||||
|
@ -0,0 +1,87 @@
|
||||
package fr.adrien1106.reframed.block;
|
||||
|
||||
import fr.adrien1106.reframed.util.VoxelHelper;
|
||||
import fr.adrien1106.reframed.util.blocks.BlockHelper;
|
||||
import fr.adrien1106.reframed.util.blocks.Edge;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.function.BooleanBiFunction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape;
|
||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
||||
|
||||
public class ReFramedStepsCrossBlock extends WaterloggableReFramedDoubleBlock {
|
||||
|
||||
public static VoxelShape[] STEP_CROSS_VOXELS;
|
||||
|
||||
public ReFramedStepsCrossBlock(Settings settings) {
|
||||
super(settings);
|
||||
setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
super.appendProperties(builder.add(EDGE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
Edge edge = BlockHelper.getPlacementCorner(ctx).getEdge(ctx.getSide().getOpposite());
|
||||
return super.getPlacementState(ctx).with(EDGE, edge);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return STEP_CROSS_VOXELS[state.get(EDGE).ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||
return state.with(EDGE, state.get(EDGE).rotate(rotation));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState mirror(BlockState state, BlockMirror mirror) {
|
||||
return state.with(EDGE, state.get(EDGE).mirror(mirror));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, int i) {
|
||||
// return getStepShape(i == 1 ? state.get(EDGE): state.get(EDGE).opposite());
|
||||
return getOutlineShape(state, null, null, null);
|
||||
}
|
||||
|
||||
static {
|
||||
VoxelShape STEP_CROSS = VoxelShapes.combineAndSimplify(
|
||||
getStepShape(Edge.NORTH_DOWN),
|
||||
getStepShape(Edge.SOUTH_UP),
|
||||
BooleanBiFunction.OR
|
||||
);
|
||||
STEP_CROSS_VOXELS = VoxelHelper.VoxelListBuilder.create(STEP_CROSS, 12)
|
||||
.add(VoxelHelper::rotateX)
|
||||
.add(VoxelHelper::rotateX)
|
||||
.add(VoxelHelper::rotateX)
|
||||
.add(0, VoxelHelper::rotateCY)
|
||||
.add(VoxelHelper::rotateZ)
|
||||
.add(VoxelHelper::rotateZ)
|
||||
.add(VoxelHelper::rotateZ)
|
||||
.add(0, VoxelHelper::rotateCZ)
|
||||
.add(VoxelHelper::rotateY)
|
||||
.add(VoxelHelper::rotateY)
|
||||
.add(VoxelHelper::rotateY)
|
||||
.build();
|
||||
}
|
||||
}
|
@ -153,6 +153,8 @@ public class ReFramedClient implements ClientModInitializer {
|
||||
// SLABS OUTER STAIR
|
||||
HELPER.addReFramedModel("slabs_inner_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/slab"), ReFramed.id("block/slabs_stair/inner/half_stair")));
|
||||
HELPER.addReFramedModel("slabs_inner_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/inner/side/slab"), ReFramed.id("block/slabs_stair/inner/side/half_stair")));
|
||||
// SLABS OUTER STAIR
|
||||
HELPER.addReFramedModel("steps_cross" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/cross")));
|
||||
|
||||
|
||||
//item model assignments (in lieu of models/item/___.json)
|
||||
@ -182,6 +184,7 @@ public class ReFramedClient implements ClientModInitializer {
|
||||
HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR);
|
||||
HELPER.assignItemModel("slabs_outer_stair" , ReFramed.SLABS_OUTER_STAIR);
|
||||
HELPER.assignItemModel("slabs_inner_stair" , ReFramed.SLABS_INNER_STAIR);
|
||||
HELPER.assignItemModel("steps_cross" , ReFramed.STEPS_CROSS);
|
||||
}
|
||||
|
||||
private void privateInit() {
|
||||
|
@ -35,6 +35,7 @@ public class GBlockstate extends FabricModelProvider {
|
||||
providers.put(ReFramedStairsCubeBlock.class, new StairsCube());
|
||||
providers.put(ReFramedStepBlock.class, new Step());
|
||||
providers.put(ReFramedStepsSlabBlock.class, new StepsSlab());
|
||||
providers.put(ReFramedStepsCrossBlock.class, new StepsCross());
|
||||
providers.put(ReFramedPillarsWallBlock.class, new PillarsWall());
|
||||
providers.put(ReFramedWallBlock.class, new Wall());
|
||||
providers.put(ReFramedPaneBlock.class, new Pane());
|
||||
|
@ -37,6 +37,7 @@ public class GRecipe extends FabricRecipeProvider {
|
||||
providers.put(ReFramedStairsCubeBlock.class, new StairsCube());
|
||||
providers.put(ReFramedStepBlock.class, new Step());
|
||||
providers.put(ReFramedStepsSlabBlock.class, new StepsSlab());
|
||||
providers.put(ReFramedStepsCrossBlock.class, new StepsCross());
|
||||
providers.put(ReFramedPillarsWallBlock.class, new PillarsWall());
|
||||
providers.put(ReFramedWallBlock.class, new Wall());
|
||||
providers.put(ReFramedPaneBlock.class, new Pane());
|
||||
|
@ -2,23 +2,15 @@ package fr.adrien1106.reframed.generator.block;
|
||||
|
||||
import fr.adrien1106.reframed.ReFramed;
|
||||
import fr.adrien1106.reframed.generator.BlockStateProvider;
|
||||
import fr.adrien1106.reframed.generator.GBlockstate;
|
||||
import fr.adrien1106.reframed.generator.RecipeSetter;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.client.BlockStateSupplier;
|
||||
import net.minecraft.data.client.MultipartBlockStateSupplier;
|
||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.recipe.book.RecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
||||
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
||||
import static fr.adrien1106.reframed.util.blocks.Edge.SOUTH_UP;
|
||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||
|
||||
public class SmallCubesStep implements RecipeSetter, BlockStateProvider {
|
||||
|
||||
@ -35,35 +27,6 @@ public class SmallCubesStep implements RecipeSetter, BlockStateProvider {
|
||||
|
||||
@Override
|
||||
public BlockStateSupplier getMultipart(Block block) {
|
||||
Identifier model_id = ReFramed.id("small_cubes_step_special");
|
||||
Identifier reverse_model_id = ReFramed.id("small_cubes_step_reverse_special");
|
||||
return MultipartBlockStateSupplier.create(block)
|
||||
/* X AXIS */
|
||||
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
||||
GBlockstate.variant(model_id, true, R0, R0))
|
||||
.with(GBlockstate.when(EDGE, EAST_UP),
|
||||
GBlockstate.variant(reverse_model_id, true, R180, R0))
|
||||
.with(GBlockstate.when(EDGE, UP_WEST),
|
||||
GBlockstate.variant(model_id, true, R180, R180))
|
||||
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
||||
GBlockstate.variant(reverse_model_id, true, R0, R180))
|
||||
/* Y AXIS */
|
||||
.with(GBlockstate.when(EDGE, EAST_SOUTH),
|
||||
GBlockstate.variant(model_id, true, R90, R0))
|
||||
.with(GBlockstate.when(EDGE, SOUTH_WEST),
|
||||
GBlockstate.variant(model_id, true, R90, R90))
|
||||
.with(GBlockstate.when(EDGE, WEST_NORTH),
|
||||
GBlockstate.variant(model_id, true, R90, R180))
|
||||
.with(GBlockstate.when(EDGE, NORTH_EAST),
|
||||
GBlockstate.variant(model_id, true, R90, R270))
|
||||
/* Z AXIS */
|
||||
.with(GBlockstate.when(EDGE, DOWN_SOUTH),
|
||||
GBlockstate.variant(reverse_model_id, true, R0, R90))
|
||||
.with(GBlockstate.when(EDGE, NORTH_DOWN),
|
||||
GBlockstate.variant(model_id, true, R0, R270))
|
||||
.with(GBlockstate.when(EDGE, UP_NORTH),
|
||||
GBlockstate.variant(reverse_model_id, true, R180, R270))
|
||||
.with(GBlockstate.when(EDGE, SOUTH_UP),
|
||||
GBlockstate.variant(model_id, true, R180, R90));
|
||||
return Step.getMultipart(block, "small_cubes_step", "small_cubes_step_reverse");
|
||||
}
|
||||
}
|
||||
|
@ -36,17 +36,26 @@ public class Step implements RecipeSetter, BlockStateProvider {
|
||||
|
||||
@Override
|
||||
public BlockStateSupplier getMultipart(Block block) {
|
||||
Identifier model_id = ReFramed.id("step_special");
|
||||
return getMultipart(block, "step");
|
||||
}
|
||||
|
||||
public static BlockStateSupplier getMultipart(Block block, String model_name) {
|
||||
return getMultipart(block, model_name, model_name);
|
||||
}
|
||||
|
||||
public static BlockStateSupplier getMultipart(Block block, String model_name, String reverse_model_name) {
|
||||
Identifier model_id = ReFramed.id(model_name + "_special");
|
||||
Identifier reverse_model_id = ReFramed.id(reverse_model_name + "_special");
|
||||
return MultipartBlockStateSupplier.create(block)
|
||||
/* X AXIS */
|
||||
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
||||
GBlockstate.variant(model_id, true, R0, R0))
|
||||
.with(GBlockstate.when(EDGE, EAST_UP),
|
||||
GBlockstate.variant(model_id, true, R180, R0))
|
||||
GBlockstate.variant(reverse_model_id, true, R180, R0))
|
||||
.with(GBlockstate.when(EDGE, UP_WEST),
|
||||
GBlockstate.variant(model_id, true, R180, R180))
|
||||
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
||||
GBlockstate.variant(model_id, true, R0, R180))
|
||||
GBlockstate.variant(reverse_model_id, true, R0, R180))
|
||||
/* Y AXIS */
|
||||
.with(GBlockstate.when(EDGE, EAST_SOUTH),
|
||||
GBlockstate.variant(model_id, true, R90, R0))
|
||||
@ -58,11 +67,11 @@ public class Step implements RecipeSetter, BlockStateProvider {
|
||||
GBlockstate.variant(model_id, true, R90, R270))
|
||||
/* Z AXIS */
|
||||
.with(GBlockstate.when(EDGE, DOWN_SOUTH),
|
||||
GBlockstate.variant(model_id, true, R0, R90))
|
||||
GBlockstate.variant(reverse_model_id, true, R0, R90))
|
||||
.with(GBlockstate.when(EDGE, NORTH_DOWN),
|
||||
GBlockstate.variant(model_id, true, R0, R270))
|
||||
.with(GBlockstate.when(EDGE, UP_NORTH),
|
||||
GBlockstate.variant(model_id, true, R180, R270))
|
||||
GBlockstate.variant(reverse_model_id, true, R180, R270))
|
||||
.with(GBlockstate.when(EDGE, SOUTH_UP),
|
||||
GBlockstate.variant(model_id, true, R180, R90));
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package fr.adrien1106.reframed.generator.block;
|
||||
|
||||
import fr.adrien1106.reframed.ReFramed;
|
||||
import fr.adrien1106.reframed.generator.BlockStateProvider;
|
||||
import fr.adrien1106.reframed.generator.RecipeSetter;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.client.BlockStateSupplier;
|
||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.recipe.book.RecipeCategory;
|
||||
|
||||
public class StepsCross implements RecipeSetter, BlockStateProvider {
|
||||
|
||||
@Override
|
||||
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
|
||||
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2);
|
||||
ShapedRecipeJsonBuilder
|
||||
.create(RecipeCategory.BUILDING_BLOCKS, convertible, 8)
|
||||
.pattern(" I")
|
||||
.pattern("I ")
|
||||
.input('I', ReFramed.STEP)
|
||||
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
|
||||
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
|
||||
.offerTo(exporter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateSupplier getMultipart(Block block) {
|
||||
return Step.getMultipart(block, "steps_cross");
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.data.client.MultipartBlockStateSupplier;
|
||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
|
||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.recipe.book.RecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -25,9 +25,10 @@ public class StepsSlab implements RecipeSetter, BlockStateProvider {
|
||||
@Override
|
||||
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
|
||||
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2);
|
||||
ShapelessRecipeJsonBuilder
|
||||
ShapedRecipeJsonBuilder
|
||||
.create(RecipeCategory.BUILDING_BLOCKS, convertible)
|
||||
.input(ReFramed.STEP, 2)
|
||||
.pattern("II")
|
||||
.input('I', ReFramed.STEP)
|
||||
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
|
||||
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
|
||||
.offerTo(exporter);
|
||||
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"particle": "#side"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 8, 0],
|
||||
"to": [8, 16, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 8, 0]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
|
||||
"east": {"uv": [0, 0, 16, 8], "texture": "#side"},
|
||||
"south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"},
|
||||
"west": {"uv": [0, 0, 16, 8], "texture": "#side", "cullface": "west"},
|
||||
"up": {"uv": [0, 0, 8, 16], "texture": "#top", "cullface": "up"},
|
||||
"down": {"uv": [0, 0, 8, 16], "texture": "#bottom"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [75, -135, 0],
|
||||
"translation": [0, 2.5, 0],
|
||||
"scale": [0.375, 0.375, 0.375]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [30, 135, 0],
|
||||
"scale": [0.625, 0.625, 0.625]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [0, -90, 0]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user