Merge pull request 'fix and new block' (#22) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m32s
All checks were successful
deploy / deploy (push) Successful in 5m32s
Reviewed-on: #22
This commit is contained in:
commit
ef76408b80
@ -22,8 +22,6 @@ or based on preferences add the person(s) to the project
|
|||||||
### What Shapes are planed to be added
|
### What Shapes are planed to be added
|
||||||
Currently, the list of shapes to be added is pretty simple as the mod is still under development:
|
Currently, the list of shapes to be added is pretty simple as the mod is still under development:
|
||||||
- Pressure Plate
|
- Pressure Plate
|
||||||
- Carpet (maybe redundant with Layer)
|
|
||||||
- Half Slab (maybe redundant with Layer)
|
|
||||||
- Slabs Stair (a stair with one end being of a second theme, might be done in multiple blocks)
|
- Slabs Stair (a stair with one end being of a second theme, might be done in multiple blocks)
|
||||||
|
|
||||||
Any Ideas feel free to make a suggestion [here](https://github.com/DriHut/ReFramed/issues).
|
Any Ideas feel free to make a suggestion [here](https://github.com/DriHut/ReFramed/issues).
|
||||||
|
@ -9,7 +9,7 @@ loader_version=0.15.11
|
|||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
modrinth_id = jCpoCBpn
|
modrinth_id = jCpoCBpn
|
||||||
mod_version = 1.6.3
|
mod_version = 1.6.4
|
||||||
maven_group = fr.adrien1106
|
maven_group = fr.adrien1106
|
||||||
archives_base_name = ReFramed
|
archives_base_name = ReFramed
|
||||||
mod_id = reframed
|
mod_id = reframed
|
||||||
|
@ -28,10 +28,10 @@ import java.util.stream.Stream;
|
|||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Dynamic Ambient Occlusion -> for v1.6
|
* TODO Dynamic Ambient Occlusion -> not scheduled
|
||||||
* TODO add minecraft models like wall fence etc -> for v1.6
|
* TODO better connected textures -> not scheduled
|
||||||
* TODO better connected textures -> maybe v1.6 ?
|
|
||||||
* TODO support continuity overlays -> not scheduled
|
* TODO support continuity overlays -> not scheduled
|
||||||
|
* TODO slopes -> thinking about it
|
||||||
*/
|
*/
|
||||||
public class ReFramed implements ModInitializer {
|
public class ReFramed implements ModInitializer {
|
||||||
public static final String MODID = "reframed";
|
public static final String MODID = "reframed";
|
||||||
@ -42,7 +42,7 @@ 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_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR,
|
||||||
SLAB, SLABS_CUBE,
|
SLAB, SLABS_CUBE, SLABS_STAIR,
|
||||||
STEP, STEPS_SLAB,
|
STEP, STEPS_SLAB,
|
||||||
LAYER,
|
LAYER,
|
||||||
PILLAR, PILLARS_WALL, WALL,
|
PILLAR, PILLARS_WALL, WALL,
|
||||||
@ -73,6 +73,7 @@ public class ReFramed implements ModInitializer {
|
|||||||
LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB)));
|
LAYER = registerBlock("layer" , new ReFramedLayerBlock(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)));
|
||||||
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)));
|
PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE)));
|
||||||
|
@ -101,7 +101,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
return HALF_STAIR_VOXELS[state.get(CORNER_FACE) + state.get(CORNER).getID() * 3];
|
return getHalfStairShape(state.get(CORNER), state.get(CORNER_FACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,6 +131,10 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock {
|
|||||||
return super.getThemeMap(state, new_state);
|
return super.getThemeMap(state, new_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VoxelShape getHalfStairShape(Corner corner, int face) {
|
||||||
|
return HALF_STAIR_VOXELS[face + corner.getID() * 3];
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final VoxelShape HALF_STAIR = VoxelShapes.combineAndSimplify(
|
final VoxelShape HALF_STAIR = VoxelShapes.combineAndSimplify(
|
||||||
createCuboidShape(8, 0, 0, 16, 16, 8),
|
createCuboidShape(8, 0, 0, 16, 16, 8),
|
||||||
|
@ -15,9 +15,9 @@ 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 static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.HALF_STAIR_VOXELS;
|
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape;
|
||||||
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
|
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
|
||||||
import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.SMALL_CUBE_VOXELS;
|
import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.getSmallCubeShape;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN;
|
import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN;
|
||||||
@ -45,7 +45,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
|
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
|
||||||
return isGhost(view, pos) ? empty(): getSlabShape(state.get(CORNER).getDirection(state.get(CORNER_FACE)));
|
return isGhost(view, pos) ? empty(): getOutlineShape(state, view, pos, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,7 +72,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc
|
|||||||
Corner corner = state.get(CORNER);
|
Corner corner = state.get(CORNER);
|
||||||
int face = state.get(CORNER_FACE);
|
int face = state.get(CORNER_FACE);
|
||||||
return i == 2
|
return i == 2
|
||||||
? SMALL_CUBE_VOXELS[corner.getOpposite(face).getID()]
|
? getSmallCubeShape(corner.getOpposite(face))
|
||||||
: HALF_STAIR_VOXELS[face + corner.getID() * 3];
|
: getHalfStairShape(corner, face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ 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 static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.HALF_STAIR_VOXELS;
|
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape;
|
||||||
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
|
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
|
||||||
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.Edge.*;
|
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
||||||
@ -72,7 +72,7 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo
|
|||||||
side
|
side
|
||||||
|
|
||||||
);
|
);
|
||||||
return HALF_STAIR_VOXELS[corner.getID() * 3 + corner.getDirectionIndex(side)];
|
return getHalfStairShape(corner, corner.getDirectionIndex(side));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
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.StairShape;
|
||||||
|
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.block.ReFramedSlabBlock.getSlabShape;
|
||||||
|
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
|
||||||
|
import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape;
|
||||||
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
||||||
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
|
||||||
|
import static net.minecraft.util.shape.VoxelShapes.empty;
|
||||||
|
|
||||||
|
public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock {
|
||||||
|
|
||||||
|
public ReFramedSlabsStairBlock(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
|
||||||
|
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
|
||||||
|
return isGhost(view, pos) ? empty() : getOutlineShape(state, view, pos, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
|
return getStairShape(state.get(EDGE), StairShape.STRAIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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
|
||||||
|
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 VoxelShape getShape(BlockState state, int i) {
|
||||||
|
Edge edge = state.get(EDGE);
|
||||||
|
Direction face = edge.getDirection(state.get(EDGE_FACE));
|
||||||
|
return i == 2
|
||||||
|
? getStepShape(edge.getOpposite(edge.getOtherDirection(face)))
|
||||||
|
: getSlabShape(face);
|
||||||
|
}
|
||||||
|
}
|
@ -125,7 +125,7 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
return SMALL_CUBE_VOXELS[state.get(CORNER).getID()];
|
return getSmallCubeShape(state.get(CORNER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,6 +151,10 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock {
|
|||||||
return super.getThemeMap(state, new_state);
|
return super.getThemeMap(state, new_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VoxelShape getSmallCubeShape(Corner corner) {
|
||||||
|
return SMALL_CUBE_VOXELS[corner.getID()];
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final VoxelShape SMALL_CUBE = VoxelShapes.cuboid(.5f, 0f, 0f, 1f, .5f, .5f);
|
final VoxelShape SMALL_CUBE = VoxelShapes.cuboid(.5f, 0f, 0f, 1f, .5f, .5f);
|
||||||
|
|
||||||
|
@ -144,6 +144,9 @@ public class ReFramedClient implements ClientModInitializer {
|
|||||||
// POST FENCE
|
// POST FENCE
|
||||||
HELPER.addReFramedModel("post_fence_inventory" , HELPER.autoDouble(ReFramed.id("block/post"), ReFramed.id("block/fence/full/inventory")));
|
HELPER.addReFramedModel("post_fence_inventory" , HELPER.autoDouble(ReFramed.id("block/post"), ReFramed.id("block/fence/full/inventory")));
|
||||||
HELPER.addReFramedModel("post_fence_side" , HELPER.autoDouble(ReFramed.id("block/fence/full/side_core"), ReFramed.id("block/fence/full/side_bars")));
|
HELPER.addReFramedModel("post_fence_side" , HELPER.autoDouble(ReFramed.id("block/fence/full/side_core"), ReFramed.id("block/fence/full/side_bars")));
|
||||||
|
// SLABS STAIR
|
||||||
|
HELPER.addReFramedModel("slabs_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/slab"), ReFramed.id("block/slabs_stair/step")));
|
||||||
|
HELPER.addReFramedModel("slabs_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/side/slab"), ReFramed.id("block/slabs_stair/side/step")));
|
||||||
|
|
||||||
|
|
||||||
//item model assignments (in lieu of models/item/___.json)
|
//item model assignments (in lieu of models/item/___.json)
|
||||||
@ -170,6 +173,7 @@ public class ReFramedClient implements ClientModInitializer {
|
|||||||
HELPER.assignItemModel("post" , ReFramed.POST);
|
HELPER.assignItemModel("post" , ReFramed.POST);
|
||||||
HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE);
|
HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE);
|
||||||
HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE);
|
HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE);
|
||||||
|
HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void privateInit() {
|
private void privateInit() {
|
||||||
|
@ -85,7 +85,7 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel {
|
|||||||
appearance_manager.getDefaultAppearance(theme_index),
|
appearance_manager.getDefaultAppearance(theme_index),
|
||||||
0
|
0
|
||||||
),
|
),
|
||||||
state
|
state == null ? item_state : state
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class GBlockstate extends FabricModelProvider {
|
|||||||
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(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());
|
||||||
|
@ -28,6 +28,7 @@ public class GRecipe extends FabricRecipeProvider {
|
|||||||
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(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());
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
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 fr.adrien1106.reframed.util.blocks.Edge;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.data.client.MultipartBlockStateSupplier;
|
||||||
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
|
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
|
||||||
|
import net.minecraft.item.ItemConvertible;
|
||||||
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
||||||
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
|
||||||
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
|
|
||||||
|
public class SlabsStair implements RecipeSetter, BlockStateProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
|
||||||
|
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE);
|
||||||
|
ShapelessRecipeJsonBuilder
|
||||||
|
.create(RecipeCategory.BUILDING_BLOCKS, convertible)
|
||||||
|
.input(ReFramed.STEP)
|
||||||
|
.input(ReFramed.SLAB)
|
||||||
|
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
|
||||||
|
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
|
||||||
|
.offerTo(exporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MultipartBlockStateSupplier getMultipart(Block block) {
|
||||||
|
Identifier model_id = ReFramed.id("slabs_stair_special");
|
||||||
|
Identifier side_id = ReFramed.id("slabs_stair_side_special");
|
||||||
|
return MultipartBlockStateSupplier.create(block)
|
||||||
|
// BOTTOM
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.DOWN_EAST, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(model_id, true, R0, R0))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.DOWN_SOUTH, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(model_id, true, R0, R90))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.WEST_DOWN, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(model_id, true, R0, R180))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.NORTH_DOWN, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(model_id, true, R0, R270))
|
||||||
|
// TOP
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.EAST_UP, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(model_id, true, R180, R0))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.SOUTH_UP, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(model_id, true, R180, R90))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.UP_WEST, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(model_id, true, R180, R180))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.UP_NORTH, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(model_id, true, R180, R270))
|
||||||
|
// EAST
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.EAST_SOUTH, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R0, R0))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.EAST_UP, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R90, R0))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.NORTH_EAST, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R180, R0))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.DOWN_EAST, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R270, R0))
|
||||||
|
// SOUTH
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.SOUTH_WEST, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R0, R90))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.SOUTH_UP, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R90, R90))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.EAST_SOUTH, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R180, R90))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.DOWN_SOUTH, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R270, R90))
|
||||||
|
// WEST
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.WEST_NORTH, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R0, R180))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.UP_WEST, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R90, R180))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.SOUTH_WEST, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R180, R180))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.WEST_DOWN, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R270, R180))
|
||||||
|
// NORTH
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.NORTH_EAST, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R0, R270))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.UP_NORTH, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R90, R270))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.WEST_NORTH, EDGE_FACE, 1),
|
||||||
|
GBlockstate.variant(side_id, true, R180, R270))
|
||||||
|
.with(GBlockstate.when(EDGE, Edge.NORTH_DOWN, EDGE_FACE, 0),
|
||||||
|
GBlockstate.variant(side_id, true, R270, R270))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import net.minecraft.state.property.IntProperty;
|
|||||||
public class BlockProperties {
|
public class BlockProperties {
|
||||||
public static final BooleanProperty LIGHT = BooleanProperty.of("emits_light");
|
public static final BooleanProperty LIGHT = BooleanProperty.of("emits_light");
|
||||||
public static final EnumProperty<Edge> EDGE = EnumProperty.of("edge", Edge.class);
|
public static final EnumProperty<Edge> EDGE = EnumProperty.of("edge", Edge.class);
|
||||||
|
public static final IntProperty EDGE_FACE = IntProperty.of("face", 0, 1);
|
||||||
public static final EnumProperty<Corner> CORNER = EnumProperty.of("corner", Corner.class);
|
public static final EnumProperty<Corner> CORNER = EnumProperty.of("corner", Corner.class);
|
||||||
public static final IntProperty CORNER_FACE = IntProperty.of("face", 0, 2);
|
public static final IntProperty CORNER_FACE = IntProperty.of("face", 0, 2);
|
||||||
public static final EnumProperty<StairShape> STAIR_SHAPE = EnumProperty.of("shape", StairShape.class);
|
public static final EnumProperty<StairShape> STAIR_SHAPE = EnumProperty.of("shape", StairShape.class);
|
||||||
|
@ -106,6 +106,22 @@ public enum Edge implements StringIdentifiable {
|
|||||||
.findFirst().orElse(Edge.NORTH_DOWN);
|
.findFirst().orElse(Edge.NORTH_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Direction getDirection(int side) {
|
||||||
|
return side == 1 ? second_direction : first_direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDirectionIndex(Direction direction) {
|
||||||
|
return direction == first_direction ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Edge getOpposite(int index) {
|
||||||
|
return getOpposite(getDirection(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Edge getOpposite(Direction direction) {
|
||||||
|
return getByDirections(direction, getOtherDirection(direction).getOpposite());
|
||||||
|
}
|
||||||
|
|
||||||
public Edge rotate(BlockRotation rotation) {
|
public Edge rotate(BlockRotation rotation) {
|
||||||
return getByDirections(
|
return getByDirections(
|
||||||
rotation.rotate(first_direction),
|
rotation.rotate(first_direction),
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"credit": "Made with Blockbench",
|
||||||
|
"parent": "block/block",
|
||||||
|
"textures": {
|
||||||
|
"particle": "#side"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [8, 0, 8],
|
||||||
|
"to": [16, 16, 16],
|
||||||
|
"faces": {
|
||||||
|
"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"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [8, 0, 0],
|
||||||
|
"to": [16, 16, 8],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [0, 0, -8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 8, 16], "texture": "#side", "cullface": "north"},
|
||||||
|
"east": {"uv": [8, 0, 16, 16], "texture": "#side", "cullface": "east"},
|
||||||
|
"west": {"uv": [0, 0, 8, 16], "texture": "#side"},
|
||||||
|
"up": {"uv": [8, 0, 16, 8], "texture": "#top", "cullface": "up"},
|
||||||
|
"down": {"uv": [8, 8, 16, 16], "texture": "#bottom", "cullface": "down"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [75, -135, 0],
|
||||||
|
"translation": [0, 2.5, 0],
|
||||||
|
"scale": [0.375, 0.375, 0.375]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [30, 135, 0],
|
||||||
|
"scale": [0.625, 0.625, 0.625]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"rotation": [0, -90, 0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"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, 0, 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": "west"},
|
||||||
|
"up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"},
|
||||||
|
"down": {"uv": [0, 0, 8, 8], "texture": "#bottom", "cullface": "down"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [75, -135, 0],
|
||||||
|
"translation": [0, 2.5, 0],
|
||||||
|
"scale": [0.375, 0.375, 0.375]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [30, 135, 0],
|
||||||
|
"scale": [0.625, 0.625, 0.625]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"rotation": [0, -90, 0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"credit": "Made with Blockbench",
|
||||||
|
"parent": "block/block",
|
||||||
|
"textures": {
|
||||||
|
"particle": "#side"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [8, 0, 0],
|
||||||
|
"to": [16, 8, 16],
|
||||||
|
"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"},
|
||||||
|
"up": {"uv": [8, 0, 16, 16], "texture": "#top"},
|
||||||
|
"down": {"uv": [8, 0, 16, 16], "texture": "#bottom", "cullface": "down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [0, 0, 0],
|
||||||
|
"to": [8, 8, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
|
||||||
|
"south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"},
|
||||||
|
"west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"},
|
||||||
|
"up": {"uv": [0, 0, 8, 16], "texture": "#top"},
|
||||||
|
"down": {"uv": [0, 0, 8, 16], "texture": "#bottom", "cullface": "down"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"display": {
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [75, -135, 0],
|
||||||
|
"translation": [0, 2.5, 0],
|
||||||
|
"scale": [0.375, 0.375, 0.375]
|
||||||
|
},
|
||||||
|
"gui": {
|
||||||
|
"rotation": [30, 135, 0],
|
||||||
|
"scale": [0.625, 0.625, 0.625]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"rotation": [0, -90, 0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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, 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"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"to": [8, 8, 16],
|
"to": [8, 8, 16],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
|
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
|
||||||
"east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"},
|
"east": {"uv": [0, 8, 16, 16], "texture": "#side"},
|
||||||
"south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"},
|
"south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"},
|
||||||
"west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"},
|
"west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"},
|
||||||
"up": {"uv": [0, 0, 8, 16], "texture": "#top"},
|
"up": {"uv": [0, 0, 8, 16], "texture": "#top"},
|
||||||
|
Loading…
Reference in New Issue
Block a user