diff --git a/README.md b/README.md index 2aa9500..613c41e 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ or based on preferences add the person(s) to the project ### 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: - 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) Any Ideas feel free to make a suggestion [here](https://github.com/DriHut/ReFramed/issues). diff --git a/gradle.properties b/gradle.properties index 12b6a5b..84f676d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.15.11 # Mod Properties modrinth_id = jCpoCBpn -mod_version = 1.6.3 +mod_version = 1.6.4 maven_group = fr.adrien1106 archives_base_name = ReFramed mod_id = reframed diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 211cf8a..098f8dd 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -28,10 +28,10 @@ import java.util.stream.Stream; import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT; /** - * TODO Dynamic Ambient Occlusion -> for v1.6 - * TODO add minecraft models like wall fence etc -> for v1.6 - * TODO better connected textures -> maybe v1.6 ? + * TODO Dynamic Ambient Occlusion -> not scheduled + * TODO better connected textures -> not scheduled * TODO support continuity overlays -> not scheduled + * TODO slopes -> thinking about it */ public class ReFramed implements ModInitializer { public static final String MODID = "reframed"; @@ -42,7 +42,7 @@ public class ReFramed implements ModInitializer { SMALL_CUBE, SMALL_CUBES_STEP, STAIR, STAIRS_CUBE, HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR, - SLAB, SLABS_CUBE, + SLAB, SLABS_CUBE, SLABS_STAIR, STEP, STEPS_SLAB, LAYER, PILLAR, PILLARS_WALL, WALL, @@ -73,6 +73,7 @@ public class ReFramed implements ModInitializer { LAYER = registerBlock("layer" , new ReFramedLayerBlock(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_STAIR = registerBlock("slabs_stair" , new ReFramedSlabsStairBlock(cp(Blocks.OAK_STAIRS))); STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB))); STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB))); PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index 473a975..dcfff14 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -101,7 +101,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { @Override 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 @@ -131,6 +131,10 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { return super.getThemeMap(state, new_state); } + public static VoxelShape getHalfStairShape(Corner corner, int face) { + return HALF_STAIR_VOXELS[face + corner.getID() * 3]; + } + static { final VoxelShape HALF_STAIR = VoxelShapes.combineAndSimplify( createCuboidShape(8, 0, 0, 16, 16, 8), diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java index 18fbb1d..de1d8dc 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java @@ -15,9 +15,9 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; 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.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_FACE; import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN; @@ -45,7 +45,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc @Override 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 @@ -72,7 +72,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc Corner corner = state.get(CORNER); int face = state.get(CORNER_FACE); return i == 2 - ? SMALL_CUBE_VOXELS[corner.getOpposite(face).getID()] - : HALF_STAIR_VOXELS[face + corner.getID() * 3]; + ? getSmallCubeShape(corner.getOpposite(face)) + : getHalfStairShape(corner, face); } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java index 6f84264..2817427 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java @@ -17,7 +17,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; 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.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.Edge.*; @@ -72,7 +72,7 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo side ); - return HALF_STAIR_VOXELS[corner.getID() * 3 + corner.getDirectionIndex(side)]; + return getHalfStairShape(corner, corner.getDirectionIndex(side)); } @Override diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java new file mode 100644 index 0000000..ab8f8ba --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsStairBlock.java @@ -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 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); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index 36d208d..e824c62 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -125,7 +125,7 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { @Override 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 @@ -151,6 +151,10 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { return super.getThemeMap(state, new_state); } + public static VoxelShape getSmallCubeShape(Corner corner) { + return SMALL_CUBE_VOXELS[corner.getID()]; + } + static { final VoxelShape SMALL_CUBE = VoxelShapes.cuboid(.5f, 0f, 0f, 1f, .5f, .5f); diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 4bb9123..92f1430 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -144,6 +144,9 @@ public class ReFramedClient implements ClientModInitializer { // POST FENCE 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"))); + // 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) @@ -170,6 +173,7 @@ public class ReFramedClient implements ClientModInitializer { HELPER.assignItemModel("post" , ReFramed.POST); HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE); HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE); + HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR); } private void privateInit() { diff --git a/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java b/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java index 4c1ad02..8edad70 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java @@ -85,7 +85,7 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel { appearance_manager.getDefaultAppearance(theme_index), 0 ), - state + state == null ? item_state : state ) ); } diff --git a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java index 84b5862..56085fe 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -26,6 +26,7 @@ public class GBlockstate extends FabricModelProvider { providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); + providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index 650fe86..65ef86d 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -28,6 +28,7 @@ public class GRecipe extends FabricRecipeProvider { providers.put(ReFramedPillarBlock.class, new Pillar()); providers.put(ReFramedSlabBlock.class, new Slab()); providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); + providers.put(ReFramedSlabsStairBlock.class, new SlabsStair()); providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); providers.put(ReFramedStairBlock.class, new Stair()); diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SlabsStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsStair.java new file mode 100644 index 0000000..bb86d98 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsStair.java @@ -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)) + ; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java index a53ea94..789ffda 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockProperties.java @@ -7,6 +7,7 @@ import net.minecraft.state.property.IntProperty; public class BlockProperties { public static final BooleanProperty LIGHT = BooleanProperty.of("emits_light"); public static final EnumProperty EDGE = EnumProperty.of("edge", Edge.class); + public static final IntProperty EDGE_FACE = IntProperty.of("face", 0, 1); public static final EnumProperty CORNER = EnumProperty.of("corner", Corner.class); public static final IntProperty CORNER_FACE = IntProperty.of("face", 0, 2); public static final EnumProperty STAIR_SHAPE = EnumProperty.of("shape", StairShape.class); diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java b/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java index 1642f56..a53f926 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java @@ -106,6 +106,22 @@ public enum Edge implements StringIdentifiable { .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) { return getByDirections( rotation.rotate(first_direction), diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/side/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/side/slab.json new file mode 100644 index 0000000..3c03fc4 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/side/slab.json @@ -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] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/side/step.json b/src/main/resources/assets/reframed/models/block/slabs_stair/side/step.json new file mode 100644 index 0000000..8636e67 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/side/step.json @@ -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] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/slab.json b/src/main/resources/assets/reframed/models/block/slabs_stair/slab.json new file mode 100644 index 0000000..398d47e --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/slab.json @@ -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] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/slabs_stair/step.json b/src/main/resources/assets/reframed/models/block/slabs_stair/step.json new file mode 100644 index 0000000..d9a4c8b --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/slabs_stair/step.json @@ -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] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/step/slab/down.json b/src/main/resources/assets/reframed/models/block/step/slab/down.json index 807f6ea..bb068e0 100644 --- a/src/main/resources/assets/reframed/models/block/step/slab/down.json +++ b/src/main/resources/assets/reframed/models/block/step/slab/down.json @@ -10,7 +10,7 @@ "to": [8, 8, 16], "faces": { "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"}, "west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"}, "up": {"uv": [0, 0, 8, 16], "texture": "#top"},