From 319d247e4cbbadaa2636f81d95c1ad2bb52bb4e6 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 25 Mar 2024 17:12:05 +0100 Subject: [PATCH 01/10] added continuity to optional modrinth dependencies --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index d9637fb..a9e5d38 100755 --- a/build.gradle +++ b/build.gradle @@ -210,6 +210,7 @@ modrinth { required.project "fabric-api" optional.version "b1ZV3DIJ", "${project.athena_version}" optional.version "Orvt0mRa", "${project.indium_version}+mc${project.minecraft_version}" + optional.version "1IjD5062", "${project.continuity_version}" } } From 3afee9e501c1891a5968410dbd831ae7743c4477 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 27 Mar 2024 23:14:24 +0100 Subject: [PATCH 02/10] added continuity to optional modrinth dependencies + made blocks addition possible by placing correct shape on existing frame --- .../java/fr/adrien1106/reframed/ReFramed.java | 1 - .../reframed/block/ReFramedBlock.java | 73 ++++++++-- .../reframed/block/ReFramedDoubleBlock.java | 24 ++++ .../block/ReFramedHalfStairBlock.java | 44 +++++- .../block/ReFramedHalfStairsStairBlock.java | 8 +- .../reframed/block/ReFramedSlabBlock.java | 26 +++- .../block/ReFramedSlabsCubeBlock.java | 10 +- .../block/ReFramedSmallCubeBlock.java | 86 +++++++++++- .../block/ReFramedSmallCubesStepBlock.java | 8 +- .../reframed/block/ReFramedStairBlock.java | 132 +++++++++++------- .../reframed/block/ReFramedStepBlock.java | 80 +++++++++++ .../block/ReFramedStepsSlabBlock.java | 10 +- .../WaterloggableReFramedDoubleBlock.java | 1 + .../reframed/mixin/logic/BlockItemMixin.java | 57 ++++++++ .../reframed/util/blocks/BlockHelper.java | 6 +- .../reframed/util/blocks/Corner.java | 25 ++++ .../adrien1106/reframed/util/blocks/Edge.java | 28 ++-- src/main/resources/reframed.mixins.json | 1 + 18 files changed, 522 insertions(+), 98 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/mixin/logic/BlockItemMixin.java diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 691fe87..5e6fe38 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -28,7 +28,6 @@ import java.util.stream.Stream; import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT; /** - * TODO make block pairable by right click -> for v1.6 * 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 ? diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java index 05e7aef..49d2596 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java @@ -15,7 +15,9 @@ import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtHelper; import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.registry.Registries; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -31,8 +33,12 @@ import net.minecraft.world.GameRules; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.stream.IntStream; +import static fr.adrien1106.reframed.block.ReFramedEntity.BLOCKSTATE_KEY; import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT; public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeSetter { @@ -97,7 +103,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS @Override public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { - if(!state.isOf(newState.getBlock()) && + if(!(newState.getBlock() instanceof ReFramedBlock) && world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) ) { @@ -122,14 +128,52 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS } super.onStateReplaced(state, world, pos, newState, moved); } - - @Override - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - if(world.isClient && world.getBlockEntity(pos) instanceof ReFramedEntity be) { - NbtCompound tag = BlockItem.getBlockEntityNbt(stack); - if(tag != null) be.readNbt(tag); + + public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack, BlockState old_state, BlockEntity old_entity) { + if (!(world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity)) { + onPlaced(world, pos, state, placer, stack); + return; } - super.onPlaced(world, pos, state, placer, stack); + + // apply state change keeping the old information + if (old_state.getBlock() instanceof ReFramedBlock old_frame_block + && old_entity instanceof ReFramedEntity old_frame_entity) { + Map theme_map = old_frame_block.getThemeMap(old_state, state); + theme_map.forEach((self, other) -> + frame_entity.setTheme(old_frame_entity.getTheme(self), other) + ); + + // apply any changes needed to keep previous properties + if (old_frame_entity.emitsLight() && !frame_entity.emitsLight()) { + frame_entity.toggleLight(); + world.setBlockState(pos, state.with(LIGHT, true)); + } + if (old_frame_entity.emitsRedstone() && !frame_entity.emitsRedstone()) { + frame_entity.toggleRedstone(); + world.updateNeighbors(pos, this); + } + if (old_frame_entity.isSolid() && !frame_entity.isSolid()) frame_entity.toggleSolidity(); + + // apply themes from item + NbtCompound tag = BlockItem.getBlockEntityNbt(stack); + if(tag != null) { + // determine a list of themes than can be used + Iterator free_themes = IntStream + .rangeClosed(1, frame_entity.getThemes().size()) + .filter(value -> !theme_map.containsValue(value)) + .iterator(); + // apply all the themes possible from item + for (int i = 1; tag.contains(BLOCKSTATE_KEY + i) && free_themes.hasNext(); i++) { + BlockState theme = NbtHelper.toBlockState(Registries.BLOCK.getReadOnlyWrapper(), tag.getCompound(BLOCKSTATE_KEY + i)); + if (theme == null || theme.getBlock() == Blocks.AIR) continue; + frame_entity.setTheme(theme, free_themes.next()); + } + } + } else if(world.isClient) { // prevents flashing with default texture before server sends the update + NbtCompound tag = BlockItem.getBlockEntityNbt(stack); + if(tag != null) frame_entity.readNbt(tag); + } + onPlaced(world, pos, state, placer, stack); } @Override @@ -165,10 +209,23 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS return getWeakRedstonePower(state, view, pos, dir); } + /** + * @param state - the block state to get the top theme index from + * @return the index of the top theme to use for the block + */ public int getTopThemeIndex(BlockState state) { return 1; } + /** + * @param state - the block state of the block that is being replaced + * @param new_state - the block state of the block that is replacing the block + * @return a map of the theme indexes to map when changing state so that the themes are preserved + */ + public Map getThemeMap(BlockState state, BlockState new_state) { + return Map.of(); + } + @Override public void setRecipe(RecipeExporter exporter) { ShapedRecipeJsonBuilder diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java index 143b48c..1b76a5e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java @@ -7,6 +7,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.property.Property; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -49,6 +50,29 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock { return 0; } + @SafeVarargs + public final > boolean matchesAnyOutline(Vec3d hit, BlockPos pos, Property property, T... values) { + for (T value : values) + if (matchesOutline(hit, pos, property, value)) return true; + return false; + } + + public > boolean matchesOutline(Vec3d hit, BlockPos pos, Property property, T value) { + Vec3d rel = BlockHelper.getRelativePos(hit, pos); + return BlockHelper.cursorMatchesFace( + getOutlineShape(getDefaultState().with(property, value), null, null, null), + rel + ); + } + + public > boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) { + Vec3d rel = BlockHelper.getRelativePos(hit, pos); + return BlockHelper.cursorMatchesFace( + getShape(state, i), + rel + ); + } + @Override public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) { return world.getBlockEntity(pos) instanceof ThemeableBlockEntity framed_entity diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index cb1ca8a..ee2e6f9 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -15,20 +15,23 @@ 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.ShapedRecipeJsonBuilder; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; import net.minecraft.util.Identifier; import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import org.jetbrains.annotations.Nullable; +import java.util.Map; + import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; -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.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; @@ -58,8 +61,32 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement super.appendProperties(builder.add(CORNER,CORNER_FACE)); } + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || ( + block_item.getBlock() != this + && block_item.getBlock() != ReFramed.SMALL_CUBE + ) + ); + } + @Override public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); + if (current_state.isOf(ReFramed.SMALL_CUBE)) { + Corner corner = current_state.get(CORNER).getOpposite(ctx.getSide().getOpposite()); + return ReFramed.HALF_STAIRS_SLAB.getDefaultState() + .with(CORNER, corner) + .with(CORNER_FACE, corner.getDirectionIndex(ctx.getSide().getOpposite())); + } + + if (current_state.isOf(this)) + return ReFramed.HALF_STAIRS_STAIR.getDefaultState() + .with(EDGE, current_state.get(CORNER).getEdge(current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE)))); + Corner corner = BlockHelper.getPlacementCorner(ctx); return super.getPlacementState(ctx) .with(CORNER, corner) @@ -71,6 +98,19 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement return HALF_STAIR_VOXELS[state.get(CORNER_FACE) + state.get(CORNER).getID() * 3]; } + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB)) return Map.of(1, 1); + if (new_state.isOf(ReFramed.HALF_STAIRS_STAIR)) + return Map.of( + 1, + state.get(CORNER) + .getDirection(state.get(CORNER_FACE)) + .getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1 + ); + return super.getThemeMap(state, new_state); + } + @Override public BlockStateSupplier getMultipart() { return getHalfStairMultipart( diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java index d645df0..b890a40 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java @@ -116,13 +116,13 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo GBlockstate.variant(model_id, true, R0, R270)) /* Z AXIS */ .with(GBlockstate.when(EDGE, DOWN_EAST), - GBlockstate.variant(side_model_id, true, R0, R90)) + GBlockstate.variant(reverse_model_id, true, R0, R90)) .with(GBlockstate.when(EDGE, EAST_UP), - GBlockstate.variant(reverse_model_id, true, R180, R270)) + GBlockstate.variant(side_model_id, true, R180, R270)) .with(GBlockstate.when(EDGE, UP_WEST), - GBlockstate.variant(side_model_id, true, R180, R90)) + GBlockstate.variant(reverse_model_id, true, R180, R90)) .with(GBlockstate.when(EDGE, WEST_DOWN), - GBlockstate.variant(reverse_model_id, true, R0, R270)); + GBlockstate.variant(side_model_id, true, R0, R270)); } @Override diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 751588e..ec309d4 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -11,6 +11,7 @@ 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.ShapedRecipeJsonBuilder; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; @@ -22,7 +23,10 @@ import net.minecraft.util.shape.VoxelShapes; 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; import static net.minecraft.state.property.Properties.FACING; public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements BlockStateProvider { @@ -53,10 +57,24 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo protected void appendProperties(StateManager.Builder builder) { super.appendProperties(builder.add(FACING)); } - + + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || block_item.getBlock() != this + ); + } + @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); + if (current_state.isOf(this)) + return ReFramed.SLABS_CUBE.getDefaultState() + .with(AXIS, current_state.get(FACING).getAxis()); + return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite()); } @@ -76,6 +94,12 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo }; } + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.SLABS_CUBE)) return Map.of(1, state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1); + return super.getThemeMap(state, new_state); + } + @Override public MultipartBlockStateSupplier getMultipart() { Identifier model_id = ReFramed.id("slab_special"); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java index 42aa1c1..9916a3d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java @@ -19,8 +19,7 @@ import net.minecraft.util.shape.VoxelShape; import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*; -import static net.minecraft.data.client.VariantSettings.Rotation.R0; -import static net.minecraft.data.client.VariantSettings.Rotation.R90; +import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.AXIS; public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements BlockStateProvider { @@ -55,15 +54,14 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements Block public VoxelShape getShape(BlockState state, int i) { return switch (state.get(AXIS)) { case Y -> i == 2 ? UP : DOWN; - case Z -> i == 2 ? NORTH : SOUTH; + case Z -> i == 2 ? SOUTH : NORTH; case X -> i == 2 ? EAST : WEST; }; } @Override public int getTopThemeIndex(BlockState state) { - // when the side is shared just return one - return state.get(AXIS) == Direction.Axis.Y ? 2: super.getTopThemeIndex(state); + return 2; } @Override @@ -73,7 +71,7 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements Block .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)) + GBlockstate.variant(model_id, true, R270, R0)) .with(GBlockstate.when(AXIS, Direction.Axis.X), GBlockstate.variant(model_id, true, R90, R90)); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index bce79f6..be280d8 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -5,6 +5,7 @@ import fr.adrien1106.reframed.generator.BlockStateProvider; import fr.adrien1106.reframed.generator.GBlockstate; import fr.adrien1106.reframed.util.VoxelHelper; import fr.adrien1106.reframed.util.blocks.BlockHelper; +import fr.adrien1106.reframed.util.blocks.Corner; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -14,18 +15,23 @@ 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.BlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.recipe.book.RecipeCategory; 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.math.Vec3d; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import org.jetbrains.annotations.Nullable; +import java.util.Map; + import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; -import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; @@ -53,8 +59,73 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement super.appendProperties(builder.add(CORNER)); } + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + Corner corner = state.get(CORNER); + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || ( + !( + block_item.getBlock() == ReFramed.HALF_STAIR + && !(corner.hasDirection(context.getSide()) + || (corner.hasDirection(context.getSide().getOpposite()) + && BlockHelper.cursorMatchesFace( + getOutlineShape(state, context.getWorld(), context.getBlockPos(), null), + BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) + ) + ) + ) + ) + && !( + block_item.getBlock() == this + && !( + corner.hasDirection(context.getSide()) + && BlockHelper.cursorMatchesFace( + getOutlineShape(state, context.getWorld(), context.getBlockPos(), null), + BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) + ) + ) + && ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) + .matchesAnyOutline( + context.getHitPos(), + context.getBlockPos(), + EDGE, + corner.getEdge(corner.getFirstDirection()), + corner.getEdge(corner.getSecondDirection()), + corner.getEdge(corner.getThirdDirection()) + ) + ) + ) + ); + } + @Override public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + BlockPos pos = ctx.getBlockPos(); + BlockState current_state = ctx.getWorld().getBlockState(pos); + if (current_state.isOf(ReFramed.HALF_STAIR)) + return ReFramed.HALF_STAIRS_SLAB.getDefaultState() + .with(CORNER, current_state.get(CORNER)) + .with(CORNER_FACE, current_state.get(CORNER_FACE)); + + + if (current_state.isOf(this)) { + Vec3d hit = ctx.getHitPos(); + Corner corner = current_state.get(CORNER); + ReFramedSmallCubesStepBlock block = ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP); + BlockState state = block.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection())); + if (!block.matchesShape( + hit, pos, state, + corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 + )) state = state.with(EDGE, corner.getEdge(corner.getSecondDirection())); + if (!block.matchesShape( + hit, pos, state, + corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 + )) state = state.with(EDGE, corner.getEdge(corner.getThirdDirection())); + return state; + } + return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx)); } @@ -63,6 +134,19 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement return SMALL_CUBE_VOXELS[state.get(CORNER).getID()]; } + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB)) return Map.of(1, 2); + if (new_state.isOf(ReFramed.SMALL_CUBES_STEP)) + return Map.of( + 1, + state.get(CORNER) + .getOtherDirection(new_state.get(EDGE)) + .getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1 + ); + return super.getThemeMap(state, new_state); + } + @Override public BlockStateSupplier getMultipart() { Identifier small_cube_id = ReFramed.id("small_cube_special"); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java index cf663bd..5e70c83 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java @@ -93,13 +93,13 @@ public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBloc return MultipartBlockStateSupplier.create(this) /* X AXIS */ .with(GBlockstate.when(EDGE, DOWN_EAST), - GBlockstate.variant(reverse_model_id, true, R0, R0)) + 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(reverse_model_id, true, R180, R180)) + 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)) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index 452fe21..b0ef401 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -16,6 +16,7 @@ import net.minecraft.data.client.When; 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.BlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; @@ -30,6 +31,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import org.jetbrains.annotations.Nullable; +import java.util.Map; import java.util.stream.Stream; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; @@ -63,6 +65,15 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl super.appendProperties(builder.add(EDGE, STAIR_SHAPE)); } + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || block_item.getBlock() != ReFramed.STEP + ); + } + @Override public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) { return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved) @@ -70,11 +81,20 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl } @Nullable - @Override // Pretty happy of how clean it is (also got it on first try :) ) + @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - Edge face = BlockHelper.getPlacementEdge(ctx); - StairShape shape = BlockHelper.getStairsShape(face, ctx.getWorld(), ctx.getBlockPos()); - return super.getPlacementState(ctx).with(EDGE, face).with(STAIR_SHAPE, shape); + BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos()); + if (current_state.isOf(ReFramed.STEP)) { + Edge edge = current_state.get(EDGE).opposite(); + StairShape shape = BlockHelper.getStairsShape(edge, ctx.getWorld(), ctx.getBlockPos()); + return ReFramed.STAIRS_CUBE.getDefaultState() + .with(EDGE, edge) + .with(STAIR_SHAPE, shape); + } + + Edge edge = BlockHelper.getPlacementEdge(ctx); + StairShape shape = BlockHelper.getStairsShape(edge, ctx.getWorld(), ctx.getBlockPos()); + return super.getPlacementState(ctx).with(EDGE, edge).with(STAIR_SHAPE, shape); } @Override @@ -93,6 +113,12 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl return STAIR_VOXELS[edge.getID() * 9 + shape.getID()]; } + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 1); + return super.getThemeMap(state, new_state); + } + @Override public MultipartBlockStateSupplier getMultipart() { return getStairMultipart(this, false); @@ -137,94 +163,94 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_RIGHT), GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)), GBlockstate.variant(inner_id, true, R0, R180)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_LEFT), GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)), GBlockstate.variant(inner_id, true, R0, R270)) .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_LEFT), GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)), GBlockstate.variant(inner_id, true, R0, R0)) .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_RIGHT), GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)), GBlockstate.variant(inner_id, true, R0, R90)) /* INNER TOP */ .with(When.anyOf( - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT), GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_LEFT), GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_LEFT)), GBlockstate.variant(inner_id, true, R180, R0)) .with(When.anyOf( - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT), GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_LEFT), GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_LEFT)), GBlockstate.variant(inner_id, true, R180, R90)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_RIGHT), GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)), GBlockstate.variant(inner_id, true, R180, R180)) .with(When.anyOf( GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_RIGHT), GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)), GBlockstate.variant(inner_id, true, R180, R270)) /* OUTER BOTTOM */ .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)), GBlockstate.variant(outer_id, true, R0, R0)) .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)), GBlockstate.variant(outer_id, true, R0, R90)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)), GBlockstate.variant(outer_id, true, R0, R180)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), GBlockstate.variant(outer_id, true, R0, R270)) /* OUTER TOP */ .with(When.anyOf( GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)), GBlockstate.variant(outer_id, true, R180, R0)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)), GBlockstate.variant(outer_id, true, R180, R90)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)), GBlockstate.variant(outer_id, true, R180, R180)) .with(When.anyOf( GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), GBlockstate.variant(outer_id, true, R180, R270)) /* OUTER EAST */ .with(When.anyOf( GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)), GBlockstate.variant(outer_side_id, true, R0, R0)) .with(When.anyOf( GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), GBlockstate.variant(outer_side_id, true, R90, R0)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), GBlockstate.variant(outer_side_id, true, R180, R0)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), GBlockstate.variant(outer_side_id, true, R270, R0)) /* OUTER SOUTH */ .with(When.anyOf( @@ -246,19 +272,19 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl /* OUTER WEST */ .with(When.anyOf( GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), GBlockstate.variant(outer_side_id, true, R0, R180)) .with(When.anyOf( GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), GBlockstate.variant(outer_side_id, true, R90, R180)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)), GBlockstate.variant(outer_side_id, true, R180, R180)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), GBlockstate.variant(outer_side_id, true, R270, R180)) /* OUTER NORTH */ .with(When.anyOf( @@ -280,43 +306,43 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl /* OUTER BOTTOM */ .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT), GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_RIGHT)), GBlockstate.variant(double_outer_id, true, R0, R0)) .with(When.anyOf( GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT), GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_RIGHT)), GBlockstate.variant(double_outer_id, true, R0, R90)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT), GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_RIGHT)), GBlockstate.variant(double_outer_id, true, R0, R180)) .with(When.anyOf( GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT), GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_RIGHT)), GBlockstate.variant(double_outer_id, true, R0, R270)) /* OUTER TOP */ .with(When.anyOf( GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT), GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_LEFT)), GBlockstate.variant(double_outer_id, true, R180, R0)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT), GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_LEFT)), GBlockstate.variant(double_outer_id, true, R180, R90)) .with(When.anyOf( GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT), GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_LEFT)), GBlockstate.variant(double_outer_id, true, R180, R180)) .with(When.anyOf( GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT), GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_LEFT)), GBlockstate.variant(double_outer_id, true, R180, R270)); } @@ -382,51 +408,51 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl .add(25, VoxelHelper::rotateCX).add(26, VoxelHelper::rotateCX) // WEST_DOWN .add(0, VoxelHelper::rotateCY) - .add(10).add(1) - .add(12).add(3) - .add(16).add(5) - .add(7, VoxelHelper::rotateCY).add(8, VoxelHelper::rotateCY) + .add(1).add(10) + .add(3).add(12) + .add(5).add(16) + .add(8, VoxelHelper::rotateCY).add(7, VoxelHelper::rotateCY) // DOWN_EAST .add(36, VoxelHelper::rotateZ) - .add(11).add(2) - .add(13).add(4) + .add(2).add(11) + .add(4).add(13) .add(41, VoxelHelper::rotateZ).add(42, VoxelHelper::rotateZ) - .add(17).add(6) + .add(6).add(17) // EAST_UP .add(45, VoxelHelper::rotateZ) - .add(20).add(29) - .add(22).add(31) - .add(24).add(35) + .add(29).add(20) + .add(31).add(22) + .add(35).add(24) .add(52, VoxelHelper::rotateZ).add(53, VoxelHelper::rotateZ) // UP_WEST .add(54, VoxelHelper::rotateZ) - .add(19).add(28) - .add(21).add(30) + .add(28).add(19) + .add(30).add(21) .add(59, VoxelHelper::rotateZ).add(60, VoxelHelper::rotateZ) - .add(23).add(34) + .add(34).add(23) // WEST_NORTH .add(0, VoxelHelper::rotateCZ) .add(1).add(28) .add(3).add(30) .add(7).add(32) - .add(44).add(69) + .add(43).add(68) // NORTH_EAST .add(72, VoxelHelper::rotateY) .add(2).add(29) .add(4).add(31) - .add(51).add(62) + .add(50).add(61) .add(8).add(33) // EAST_SOUTH .add(81, VoxelHelper::rotateY) .add(11).add(20) .add(13).add(22) .add(15).add(26) - .add(50).add(61) + .add(51).add(62) // SOUTH_WEST .add(90, VoxelHelper::rotateY) .add(10).add(19) .add(12).add(21) - .add(43).add(68) + .add(44).add(69) .add(14).add(25) .build(); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index fa7f969..298d730 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -15,19 +15,27 @@ 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.ShapedRecipeJsonBuilder; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; import net.minecraft.recipe.book.RecipeCategory; 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.math.Vec3d; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import org.jetbrains.annotations.Nullable; +import java.util.Map; + import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; +import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE; import static fr.adrien1106.reframed.util.blocks.Edge.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.AXIS; +import static net.minecraft.state.property.Properties.FACING; public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider { @@ -53,9 +61,68 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo super.appendProperties(builder.add(EDGE)); } + @Override + public boolean canReplace(BlockState state, ItemPlacementContext context) { + Edge edge = state.get(EDGE); + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || ( + block_item.getBlock() != ReFramed.STAIR + && !( + block_item.getBlock() == this + && !( + (edge.isSide(context.getSide()) || edge.hasDirection(context.getSide())) + && BlockHelper.cursorMatchesFace( + getOutlineShape(state, context.getWorld(), context.getBlockPos(), null), + BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) + ) + ) + && ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB) + .matchesAnyOutline( + context.getHitPos(), + context.getBlockPos(), + FACING, + edge.getFirstDirection(), + edge.getSecondDirection() + ) + ) + ) + ); + } + @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { + BlockPos pos = ctx.getBlockPos(); + BlockState current_state = ctx.getWorld().getBlockState(pos); + if (current_state.isOf(ReFramed.STAIR)) + return ReFramed.STAIRS_CUBE.getDefaultState() + .with(EDGE, current_state.get(EDGE)) + .with(STAIR_SHAPE, current_state.get(STAIR_SHAPE)); + + + if (current_state.isOf(this)) { + Vec3d hit = ctx.getHitPos(); + Edge edge = current_state.get(EDGE); + Direction dir = edge.getFirstDirection(); + ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB); + BlockState state = block.getDefaultState() + .with(FACING, dir) + .with(AXIS, edge.getOtherDirection(dir).getAxis()); + if (!block.matchesShape( + hit, pos, + state, + edge.getOtherDirection(dir).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 + )) { + dir = edge.getSecondDirection(); + state = state + .with(FACING, dir) + .with(AXIS, edge.getOtherDirection(dir).getAxis()); + } + return state; + } + return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx)); } @@ -68,6 +135,19 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo return STEP_VOXELS[edge.getID()]; } + @Override + public Map getThemeMap(BlockState state, BlockState new_state) { + if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2); + if (new_state.isOf(ReFramed.STEPS_SLAB)) + return Map.of( + 1, + state.get(EDGE) + .getOtherDirection(new_state.get(FACING)) + .getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1 + ); + return super.getThemeMap(state, new_state); + } + @Override public BlockStateSupplier getMultipart() { Identifier model_id = ReFramed.id("step_special"); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java index c86688e..6198e69 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java @@ -81,7 +81,7 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp switch (axis) { case X -> i == 1 ? Direction.WEST : Direction.EAST; case Y -> i == 1 ? Direction.DOWN : Direction.UP; - case Z -> i == 1 ? Direction.SOUTH : Direction.NORTH; + case Z -> i == 1 ? Direction.NORTH : Direction.SOUTH; } )); } @@ -99,14 +99,14 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.X), GBlockstate.variant(step_id, true, R0, R180)) .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.Z), - GBlockstate.variant(step_id, true, R0, R90)) + GBlockstate.variant(step_id, true, R0, R270)) .with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.X), GBlockstate.variant(step_id, true, R180, R180)) .with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.Z), - GBlockstate.variant(step_id, true, R180, R90)) + GBlockstate.variant(step_id, true, R180, R270)) .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Z), - GBlockstate.variant(step_side_id, true, R180, R0)) + GBlockstate.variant(step_side_id, true, R0, R0)) .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Y), GBlockstate.variant(step_side_id, true, R90, R0)) .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.X), @@ -114,7 +114,7 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.Y), GBlockstate.variant(step_side_id, true, R90, R90)) .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Z), - GBlockstate.variant(step_side_id, true, R0, R180)) + GBlockstate.variant(step_side_id, true, R180, R180)) .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Y), GBlockstate.variant(step_side_id, true, R90, R180)) .with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Axis.X), diff --git a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java index bf71cf3..60e10e9 100644 --- a/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/WaterloggableReFramedDoubleBlock.java @@ -16,6 +16,7 @@ import org.jetbrains.annotations.Nullable; public class WaterloggableReFramedDoubleBlock extends ReFramedDoubleBlock implements Waterloggable { public WaterloggableReFramedDoubleBlock(Settings settings) { super(settings); + setDefaultState(getDefaultState().with(Properties.WATERLOGGED, false)); } @Override diff --git a/src/main/java/fr/adrien1106/reframed/mixin/logic/BlockItemMixin.java b/src/main/java/fr/adrien1106/reframed/mixin/logic/BlockItemMixin.java new file mode 100644 index 0000000..e4a2350 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/mixin/logic/BlockItemMixin.java @@ -0,0 +1,57 @@ +package fr.adrien1106.reframed.mixin.logic; + +import fr.adrien1106.reframed.block.ReFramedBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(BlockItem.class) +public class BlockItemMixin { + + @Unique private final ThreadLocal old_state = new ThreadLocal<>(); + @Unique private final ThreadLocal old_entity = new ThreadLocal<>(); + + @Redirect( + method = "place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/block/Block;onPlaced(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)V" + ) + ) + private void placeMoreInfo(Block block, World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + if (!(block instanceof ReFramedBlock frame_block)) { + block.onPlaced(world, pos, state, placer, itemStack); + return; + } + frame_block.onPlaced(world, pos, state, placer, itemStack, old_state.get(), old_entity.get()); + } + + @Inject( + method = "place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Z", + shift = At.Shift.BEFORE + ) + ) + private void savePreviousInfo(ItemPlacementContext context, CallbackInfoReturnable cir) { + World world = context.getWorld(); + BlockPos pos = context.getBlockPos(); + old_state.set(world.getBlockState(pos)); + old_entity.set(world.getBlockEntity(pos)); + } + +} diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockHelper.java b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockHelper.java index cef30ab..0306a1e 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/BlockHelper.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/BlockHelper.java @@ -130,14 +130,14 @@ public class BlockHelper { return shape; } - public static String getNeighborPos(Edge face, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos) { + public static String getNeighborPos(Edge edge, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos) { BlockState block_state = world.getBlockState( pos.offset(reverse ? direction.getOpposite() : direction) ); if (isStair(block_state) && block_state.get(EDGE).hasDirection(reference)) { - if (block_state.get(EDGE).hasDirection(face.getLeftDirection())) return "left"; - else if (block_state.get(EDGE).hasDirection(face.getRightDirection())) return "right"; + if (block_state.get(EDGE).hasDirection(edge.getLeftDirection())) return "left"; + else if (block_state.get(EDGE).hasDirection(edge.getRightDirection())) return "right"; } return ""; } diff --git a/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java b/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java index 1b16ea4..e1843de 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/Corner.java @@ -37,6 +37,18 @@ public enum Corner implements StringIdentifiable { return asString(); } + public Direction getFirstDirection() { + return first_direction; + } + + public Direction getSecondDirection() { + return second_direction; + } + + public Direction getThirdDirection() { + return third_direction; + } + public boolean hasDirection(Direction direction) { return this.first_direction.equals(direction) || this.second_direction.equals(direction) @@ -94,4 +106,17 @@ public enum Corner implements StringIdentifiable { Direction other_2 = second_direction == direction || first_direction == direction ? third_direction : second_direction; return getByDirections(direction, other_1.getOpposite(), other_2.getOpposite()); } + + public Edge getEdge(Direction direction) { + return Edge.getByDirections( + first_direction == direction ? second_direction : first_direction, + second_direction == direction || first_direction == direction ? third_direction : second_direction + ); + } + + public Direction getOtherDirection(Edge edge) { + if (edge.getFirstDirection() != second_direction && edge.getSecondDirection() != second_direction) return second_direction; + if (edge.getFirstDirection() != third_direction && edge.getSecondDirection() != third_direction) return third_direction; + return first_direction; + } } 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 3b23296..9c8e34d 100644 --- a/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java +++ b/src/main/java/fr/adrien1106/reframed/util/blocks/Edge.java @@ -49,18 +49,10 @@ public enum Edge implements StringIdentifiable { return second_direction; } public Direction getRightDirection() { - return switch (axis) { - case X -> Direction.WEST; - case Y -> Direction.DOWN; - case Z -> Direction.SOUTH; - }; + return Direction.from(axis, Direction.AxisDirection.NEGATIVE); } public Direction getLeftDirection() { - return switch (axis) { - case X -> Direction.EAST; - case Y -> Direction.UP; - case Z -> Direction.NORTH; - }; + return Direction.from(axis, Direction.AxisDirection.POSITIVE); } public boolean hasDirection(Direction direction) { @@ -68,16 +60,32 @@ public enum Edge implements StringIdentifiable { || this.second_direction.equals(direction); } + public Direction.Axis getAxis() { + return this.axis; + } + public int getID() { return this.ID; } + public Edge opposite() { + return getByDirections(first_direction.getOpposite(), second_direction.getOpposite()); + } + public static Edge getByDirections(Direction direction_1, Direction direction_2) { return Arrays.stream(Edge.values()) .filter(value -> value.hasDirection(direction_1) && value.hasDirection(direction_2)) .findFirst().orElse(Edge.NORTH_DOWN); } + public boolean isSide(Direction side) { + return getRightDirection() == side || getLeftDirection() == side; + } + + public Direction getOtherDirection(Direction direction) { + return first_direction == direction ? second_direction : first_direction; + } + public static Edge fromId(int id) { return Arrays.stream(Edge.values()) .filter(value -> value.getID() == id) diff --git a/src/main/resources/reframed.mixins.json b/src/main/resources/reframed.mixins.json index de74135..5ed414c 100644 --- a/src/main/resources/reframed.mixins.json +++ b/src/main/resources/reframed.mixins.json @@ -6,6 +6,7 @@ "mixins": [ "BlockItemMixin", "WallBlockAccessor", + "logic.BlockItemMixin", "particles.MixinEntity", "particles.MixinLivingEntity" ], From a430a8e62b3f1d6cdbb1d3aead32b5f86fd695fe Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Wed, 27 Mar 2024 23:24:33 +0100 Subject: [PATCH 03/10] moved tools to tool crafting tab --- .../java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java | 2 +- .../java/fr/adrien1106/reframed/item/ReFramedHammerItem.java | 2 +- .../fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java index 735f13b..3530eb6 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java @@ -43,7 +43,7 @@ public class ReFramedBlueprintItem extends Item implements RecipeSetter { @Override public void setRecipe(RecipeExporter exporter) { ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 3) + .create(RecipeCategory.TOOLS, this, 3) .pattern("PI") .pattern("PP") .input('P', Items.PAPER) diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java index 9facbd0..06e0bca 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java @@ -56,7 +56,7 @@ public class ReFramedHammerItem extends Item implements RecipeSetter { @Override public void setRecipe(RecipeExporter exporter) { ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) + .create(RecipeCategory.TOOLS, this) .pattern(" CI") .pattern(" ~C") .pattern("~ ") diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java index b820578..9748477 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java @@ -65,7 +65,7 @@ public class ReFramedScrewdriverItem extends Item implements RecipeSetter { @Override public void setRecipe(RecipeExporter exporter) { ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) + .create(RecipeCategory.TOOLS, this) .pattern(" I") .pattern(" I ") .pattern("C ") From 74a290fd16ac39c4949ca2bdb613413727f0a243 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Thu, 28 Mar 2024 19:01:33 +0100 Subject: [PATCH 04/10] improved additivity of blocks and added pillar --- .../java/fr/adrien1106/reframed/ReFramed.java | 3 +- .../reframed/block/ReFramedDoubleBlock.java | 18 +--- .../block/ReFramedHalfStairBlock.java | 34 +++++- .../reframed/block/ReFramedLayerBlock.java | 9 +- .../reframed/block/ReFramedPillarBlock.java | 102 ++++++++++++++++++ .../reframed/block/ReFramedSlabBlock.java | 11 +- .../block/ReFramedSmallCubeBlock.java | 56 ++++++---- .../reframed/block/ReFramedStairBlock.java | 11 +- .../reframed/block/ReFramedStepBlock.java | 52 +++++---- .../reframed/client/ReFramedClient.java | 3 + .../assets/reframed/models/block/pillar.json | 21 ++++ 11 files changed, 254 insertions(+), 66 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java create mode 100644 src/main/resources/assets/reframed/models/block/pillar.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 5e6fe38..8c1e693 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -37,7 +37,7 @@ public class ReFramed implements ModInitializer { public static final String MODID = "reframed"; public static final ArrayList 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; + 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 final ArrayList ITEMS = new ArrayList<>(); public static Item HAMMER, SCREWDRIVER, BLUEPRINT, BLUEPRINT_WRITTEN; @@ -64,6 +64,7 @@ public class ReFramed implements ModInitializer { SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(cp(Blocks.OAK_SLAB))); 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))); HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1))); SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java index 1b76a5e..46bd75a 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedDoubleBlock.java @@ -7,7 +7,6 @@ import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.state.property.Property; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -50,22 +49,7 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock { return 0; } - @SafeVarargs - public final > boolean matchesAnyOutline(Vec3d hit, BlockPos pos, Property property, T... values) { - for (T value : values) - if (matchesOutline(hit, pos, property, value)) return true; - return false; - } - - public > boolean matchesOutline(Vec3d hit, BlockPos pos, Property property, T value) { - Vec3d rel = BlockHelper.getRelativePos(hit, pos); - return BlockHelper.cursorMatchesFace( - getOutlineShape(getDefaultState().with(property, value), null, null, null), - rel - ); - } - - public > boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) { + public boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) { Vec3d rel = BlockHelper.getRelativePos(hit, pos); return BlockHelper.cursorMatchesFace( getShape(state, i), diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index ee2e6f9..3674153 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -34,6 +34,7 @@ import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implements BlockStateProvider { @@ -63,12 +64,35 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + Direction dir = state.get(CORNER).getDirection(state.get(CORNER_FACE)); return !( context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) || ( - block_item.getBlock() != this - && block_item.getBlock() != ReFramed.SMALL_CUBE + !( + block_item.getBlock() == this + && ((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()) + ) + ) ) ); } @@ -80,12 +104,14 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement Corner corner = current_state.get(CORNER).getOpposite(ctx.getSide().getOpposite()); return ReFramed.HALF_STAIRS_SLAB.getDefaultState() .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)) 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); return super.getPlacementState(ctx) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index e7e8be5..d7ab8b7 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -7,6 +7,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; 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; @@ -52,8 +53,12 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { } @Override - public boolean canReplace(BlockState state, ItemPlacementContext ctx) { - return !(!state.isOf(this) || ctx.getPlayer().isSneaking() || state.get(LAYERS) == 8); + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return !( + context.getPlayer().isSneaking() + || !(context.getStack().getItem() instanceof BlockItem block_item) + || !(block_item.getBlock() == this && state.get(LAYERS) < 8) + ); } @Override diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java new file mode 100644 index 0000000..1cb8153 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java @@ -0,0 +1,102 @@ +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 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 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(); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index ec309d4..7ed411f 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -63,7 +63,16 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo return !( context.getPlayer().isSneaking() || !(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 + ) + ) ); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index be280d8..46eb263 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -34,6 +34,7 @@ import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implements BlockStateProvider { @@ -79,22 +80,29 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement ) && !( block_item.getBlock() == this - && !( - corner.hasDirection(context.getSide()) - && BlockHelper.cursorMatchesFace( - getOutlineShape(state, context.getWorld(), context.getBlockPos(), null), - BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) - ) + && ( + ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.SMALL_CUBES_STEP.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection())), + corner.getFirstDirection().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.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 + ) ) - && ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP) - .matchesAnyOutline( - context.getHitPos(), - context.getBlockPos(), - EDGE, - corner.getEdge(corner.getFirstDirection()), - corner.getEdge(corner.getSecondDirection()), - corner.getEdge(corner.getThirdDirection()) - ) ) ) ); @@ -107,23 +115,27 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement if (current_state.isOf(ReFramed.HALF_STAIR)) return ReFramed.HALF_STAIRS_SLAB.getDefaultState() .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)) { Vec3d hit = ctx.getHitPos(); Corner corner = current_state.get(CORNER); ReFramedSmallCubesStepBlock block = ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP); - BlockState state = block.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection())); - if (!block.matchesShape( + BlockState state = block.getDefaultState() + .with(EDGE, corner.getEdge(corner.getFirstDirection())) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); + if (block.matchesShape( hit, pos, state, corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - )) state = state.with(EDGE, corner.getEdge(corner.getSecondDirection())); - if (!block.matchesShape( + )) return state; + state = state.with(EDGE, corner.getEdge(corner.getSecondDirection())); + if (block.matchesShape( hit, pos, state, corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2 - )) state = state.with(EDGE, corner.getEdge(corner.getThirdDirection())); - return state; + )) return state; + return state.with(EDGE, corner.getEdge(corner.getThirdDirection())); } return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx)); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index b0ef401..f9df7f4 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -70,7 +70,16 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl return !( context.getPlayer().isSneaking() || !(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 + ) + ) ); } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 298d730..4843f6f 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -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.Edge.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; -import static net.minecraft.state.property.Properties.AXIS; -import static net.minecraft.state.property.Properties.FACING; +import static net.minecraft.state.property.Properties.*; +import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider { @@ -68,24 +68,39 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) || ( - block_item.getBlock() != ReFramed.STAIR - && !( - block_item.getBlock() == this - && !( - (edge.isSide(context.getSide()) || edge.hasDirection(context.getSide())) - && BlockHelper.cursorMatchesFace( - getOutlineShape(state, context.getWorld(), context.getBlockPos(), null), - BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos()) - ) - ) - && ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB) - .matchesAnyOutline( + !( + block_item.getBlock() == ReFramed.STAIR + && ((ReFramedStairsCubeBlock) ReFramed.STAIRS_CUBE) + .matchesShape( context.getHitPos(), context.getBlockPos(), - FACING, - edge.getFirstDirection(), - edge.getSecondDirection() + ReFramed.STAIRS_CUBE.getDefaultState().with(EDGE, edge.opposite()), + 1 ) + + ) + && !( + block_item.getBlock() == this + && ( + ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB) + .matchesShape( + context.getHitPos(), + context.getBlockPos(), + ReFramed.STEPS_SLAB.getDefaultState() + .with(FACING, edge.getFirstDirection()) + .with(AXIS, edge.getSecondDirection().getAxis()), + 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 + ) + ) ) ) ); @@ -109,7 +124,8 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB); BlockState state = block.getDefaultState() .with(FACING, dir) - .with(AXIS, edge.getOtherDirection(dir).getAxis()); + .with(AXIS, edge.getOtherDirection(dir).getAxis()) + .with(WATERLOGGED, current_state.get(WATERLOGGED)); if (!block.matchesShape( hit, pos, state, diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 355cce5..450267c 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -73,6 +73,8 @@ public class ReFramedClient implements ClientModInitializer { 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_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) HELPER.assignItemModel("cube_special" , ReFramed.CUBE); @@ -88,6 +90,7 @@ public class ReFramedClient implements ClientModInitializer { HELPER.assignItemModel("step_special" , ReFramed.STEP); HELPER.assignItemModel("steps_slab_special" , ReFramed.STEPS_SLAB); HELPER.assignItemModel("layer_1_special" , ReFramed.LAYER); + HELPER.assignItemModel("pillar_special" , ReFramed.PILLAR); } private void privateInit() { diff --git a/src/main/resources/assets/reframed/models/block/pillar.json b/src/main/resources/assets/reframed/models/block/pillar.json new file mode 100644 index 0000000..ec4c188 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/pillar.json @@ -0,0 +1,21 @@ +{ + "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"} + } + } + ] +} \ No newline at end of file From 4309310c0205215e67259e60294d23b8c29610a4 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Thu, 11 Apr 2024 00:05:47 +0200 Subject: [PATCH 05/10] added missing receipe cleaned up model names creating W.I.P. wall + typo --- .../java/fr/adrien1106/reframed/ReFramed.java | 3 +- .../block/ReFramedHalfStairBlock.java | 4 +- .../reframed/block/ReFramedPillarBlock.java | 18 +++ .../reframed/block/ReframedWallBlock.java | 69 +++++++++ .../reframed/client/ReFramedClient.java | 139 ++++++++++++------ .../reframed/client/ReFramedClientHelper.java | 8 +- .../client/ReFramedModelProvider.java | 2 +- .../model/UnbakedAutoRetexturedModel.java | 2 +- .../model/UnbakedJsonRetexturedModel.java | 2 +- .../client/model/UnbakedRetexturedModel.java | 3 +- .../models/block/wall/full/pillar/both.json | 28 ++++ .../models/block/wall/full/pillar/bottom.json | 35 +++++ .../models/block/wall/full/pillar/middle.json | 42 ++++++ .../models/block/wall/full/pillar/top.json | 35 +++++ .../models/block/wall/full/side/both.json | 21 +++ .../models/block/wall/full/side/bottom.json | 21 +++ .../models/block/wall/full/side/middle.json | 21 +++ .../models/block/wall/full/side/top.json | 21 +++ .../models/block/wall/inventory/default.json | 43 ++++++ .../models/block/wall/junction/both.json | 20 +++ .../models/block/wall/junction/both_c.json | 39 +++++ .../models/block/wall/junction/both_i.json | 19 +++ .../models/block/wall/junction/both_t.json | 48 ++++++ .../models/block/wall/junction/both_x.json | 57 +++++++ .../models/block/wall/junction/bottom.json | 20 +++ .../models/block/wall/junction/bottom_c.json | 39 +++++ .../models/block/wall/junction/bottom_i.json | 19 +++ .../models/block/wall/junction/bottom_t.json | 48 ++++++ .../models/block/wall/junction/bottom_x.json | 57 +++++++ .../models/block/wall/junction/middle.json | 20 +++ .../models/block/wall/junction/middle_c.json | 39 +++++ .../models/block/wall/junction/middle_i.json | 19 +++ .../models/block/wall/junction/middle_t.json | 48 ++++++ .../models/block/wall/junction/middle_x.json | 57 +++++++ .../models/block/wall/junction/top.json | 20 +++ .../models/block/wall/junction/top_c.json | 39 +++++ .../models/block/wall/junction/top_i.json | 19 +++ .../models/block/wall/junction/top_t.json | 48 ++++++ .../models/block/wall/junction/top_x.json | 57 +++++++ .../models/block/wall/pillar/both.json | 27 ++++ .../models/block/wall/pillar/bottom.json | 34 +++++ .../models/block/wall/pillar/core.json | 17 +++ .../models/block/wall/pillar/middle.json | 35 +++++ .../models/block/wall/pillar/none.json | 28 ++++ .../models/block/wall/pillar/top.json | 34 +++++ .../reframed/models/block/wall/side/both.json | 20 +++ .../models/block/wall/side/bottom.json | 20 +++ .../models/block/wall/side/middle.json | 20 +++ .../reframed/models/block/wall/side/top.json | 20 +++ 49 files changed, 1444 insertions(+), 60 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/both.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/middle.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/top.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/inventory/default.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/both.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/both_c.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/both_i.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/both_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/both_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/bottom.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_c.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_i.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/both.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/core.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/middle.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/none.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/top.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/side/both.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/side/bottom.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/side/middle.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/side/top.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 8c1e693..46b02ba 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -37,7 +37,7 @@ public class ReFramed implements ModInitializer { public static final String MODID = "reframed"; public static final ArrayList 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, PILLAR, WALL; public static final ArrayList ITEMS = new ArrayList<>(); public static Item HAMMER, SCREWDRIVER, BLUEPRINT, BLUEPRINT_WRITTEN; @@ -65,6 +65,7 @@ public class ReFramed implements ModInitializer { 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))); + WALL = registerBlock("wall" , new ReframedWallBlock(cp(Blocks.OAK_FENCE))); HAMMER = registerItem("hammer" , new ReFramedHammerItem(new Item.Settings().maxCount(1))); SCREWDRIVER = registerItem("screwdriver" , new ReFramedScrewdriverItem(new Item.Settings().maxCount(1))); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index 3674153..bcf3dd1 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -210,8 +210,8 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); ShapedRecipeJsonBuilder .create(RecipeCategory.BUILDING_BLOCKS, this, 4) - .pattern("I ") - .pattern("II ") + .pattern("I ") + .pattern("II") .input('I', ReFramed.CUBE) .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java index 1cb8153..3e391fd 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java @@ -4,13 +4,18 @@ 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.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.RecipeProvider; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; @@ -92,6 +97,19 @@ public class ReFramedPillarBlock extends WaterloggableReFramedBlock implements B GBlockstate.variant(model_id, true, R90, R0)); } + @Override + public void setRecipe(RecipeExporter exporter) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 4); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, this, 8) + .pattern("I") + .pattern("I") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) + .offerTo(exporter); + } + static { final VoxelShape PILLAR = createCuboidShape(0, 4, 4, 16, 12, 12); PILLAR_VOXELS = VoxelHelper.VoxelListBuilder.create(PILLAR, 3) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java new file mode 100644 index 0000000..4fef9a3 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java @@ -0,0 +1,69 @@ +package fr.adrien1106.reframed.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.util.blocks.Corner; +import fr.adrien1106.reframed.util.blocks.WallShape; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +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.ItemPlacementContext; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.Direction; +import org.jetbrains.annotations.Nullable; + +import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; +import static net.minecraft.state.property.Properties.AXIS; + +public class ReframedWallBlock extends WaterloggableReFramedBlock implements BlockStateProvider { + + private record ModelCacheKey() {} + + public ReframedWallBlock(Settings settings) { + super(settings); + } + + @Override + public Object getModelCacheKey(BlockState state) { + return new ModelCacheKey(); + } + + @Override + public int getModelStateCount() { + return 3750; + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder.add()); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + Direction.Axis axis = ctx.getSide().getAxis(); + return super.getPlacementState(ctx); + } + + @Override + public BlockStateSupplier getMultipart() { + return null; // TODO unleash hell + } + + @Override + public void setRecipe(RecipeExporter exporter) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, this, 4) + .pattern("III") + .pattern("III") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) + .offerTo(exporter); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 450267c..9b9b610 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -27,70 +27,111 @@ public class ReFramedClient implements ClientModInitializer { BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), ReFramed.BLOCKS.toArray(new Block[0])); // CUBE - HELPER.addReFramedModel("cube_special" , HELPER.auto(new Identifier("block/cube"))); + HELPER.addReFramedModel("cube" , HELPER.auto(new Identifier("block/cube"))); // SMALL_CUBE - HELPER.addReFramedModel("small_cube_special" , HELPER.auto(ReFramed.id("block/small_cube/base"))); + HELPER.addReFramedModel("small_cube" , HELPER.auto(ReFramed.id("block/small_cube/base"))); // SMALL_CUBES_STEP - HELPER.addReFramedModel("small_cubes_step_special" , HELPER.autoDouble(ReFramed.id("block/small_cube/base"), ReFramed.id("block/small_cube/step/base"))); - HELPER.addReFramedModel("small_cubes_step_reverse_special" , HELPER.autoDouble(ReFramed.id("block/small_cube/step/base"), ReFramed.id("block/small_cube/base"))); + HELPER.addReFramedModel("small_cubes_step" , HELPER.autoDouble(ReFramed.id("block/small_cube/base"), ReFramed.id("block/small_cube/step/base"))); + HELPER.addReFramedModel("small_cubes_step_reverse" , HELPER.autoDouble(ReFramed.id("block/small_cube/step/base"), ReFramed.id("block/small_cube/base"))); // SLAB - HELPER.addReFramedModel("slab_special" , HELPER.auto(new Identifier("block/slab"))); + HELPER.addReFramedModel("slab" , HELPER.auto(new Identifier("block/slab"))); // SLAB_CUBE - HELPER.addReFramedModel("double_slab_special" , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top"))); + HELPER.addReFramedModel("double_slab" , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top"))); // STAIR - HELPER.addReFramedModel("stair_special" , HELPER.auto(ReFramed.id("block/stair/straight"))); - HELPER.addReFramedModel("outers_stair_special" , HELPER.auto(ReFramed.id("block/stair/double_outer"))); - HELPER.addReFramedModel("inner_stair_special" , HELPER.auto(ReFramed.id("block/stair/inner"))); - HELPER.addReFramedModel("outer_stair_special" , HELPER.auto(ReFramed.id("block/stair/outer"))); - HELPER.addReFramedModel("outer_side_stair_special" , HELPER.auto(ReFramed.id("block/stair/outer_side"))); + HELPER.addReFramedModel("stair" , HELPER.auto(ReFramed.id("block/stair/straight"))); + HELPER.addReFramedModel("outers_stair" , HELPER.auto(ReFramed.id("block/stair/double_outer"))); + HELPER.addReFramedModel("inner_stair" , HELPER.auto(ReFramed.id("block/stair/inner"))); + HELPER.addReFramedModel("outer_stair" , HELPER.auto(ReFramed.id("block/stair/outer"))); + HELPER.addReFramedModel("outer_side_stair" , HELPER.auto(ReFramed.id("block/stair/outer_side"))); // STAIRS_CUBE - HELPER.addReFramedModel("stairs_cube_special" , HELPER.autoDouble(ReFramed.id("block/stair/straight"), ReFramed.id("block/stair/cube/straight"))); - HELPER.addReFramedModel("outers_stairs_cube_special" , HELPER.autoDouble(ReFramed.id("block/stair/double_outer"), ReFramed.id("block/stair/cube/double_outer"))); - HELPER.addReFramedModel("inner_stairs_cube_special" , HELPER.autoDouble(ReFramed.id("block/stair/inner"), ReFramed.id("block/stair/cube/inner"))); - HELPER.addReFramedModel("outer_stairs_cube_special" , HELPER.autoDouble(ReFramed.id("block/stair/outer"), ReFramed.id("block/stair/cube/outer"))); - HELPER.addReFramedModel("outer_side_stairs_cube_special" , HELPER.autoDouble(ReFramed.id("block/stair/outer_side"), ReFramed.id("block/stair/cube/outer_side"))); + HELPER.addReFramedModel("stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/straight"), ReFramed.id("block/stair/cube/straight"))); + HELPER.addReFramedModel("outers_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/double_outer"), ReFramed.id("block/stair/cube/double_outer"))); + HELPER.addReFramedModel("inner_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/inner"), ReFramed.id("block/stair/cube/inner"))); + HELPER.addReFramedModel("outer_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer"), ReFramed.id("block/stair/cube/outer"))); + HELPER.addReFramedModel("outer_side_stairs_cube" , HELPER.autoDouble(ReFramed.id("block/stair/outer_side"), ReFramed.id("block/stair/cube/outer_side"))); // HALF_STAIR - HELPER.addReFramedModel("half_stair_down_special" , HELPER.auto(ReFramed.id("block/half_stair/down"))); - HELPER.addReFramedModel("half_stair_side_special" , HELPER.auto(ReFramed.id("block/half_stair/side"))); + HELPER.addReFramedModel("half_stair_down" , HELPER.auto(ReFramed.id("block/half_stair/down"))); + HELPER.addReFramedModel("half_stair_side" , HELPER.auto(ReFramed.id("block/half_stair/side"))); // HALF_STAIRS_SLAB - HELPER.addReFramedModel("half_stairs_slab_down_special" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/slab/down"))); - HELPER.addReFramedModel("half_stairs_slab_side_special" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/slab/side"))); + HELPER.addReFramedModel("half_stairs_slab_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/slab/down"))); + HELPER.addReFramedModel("half_stairs_slab_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/slab/side"))); // HALF_STAIRS_STAIR - HELPER.addReFramedModel("half_stairs_stair_down_special" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/stair/down"))); - HELPER.addReFramedModel("half_stairs_stair_side_special" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/stair/side"))); - HELPER.addReFramedModel("half_stairs_stair_reverse_special" , HELPER.autoDouble(ReFramed.id("block/half_stair/stair/side"), ReFramed.id("block/half_stair/side"))); + HELPER.addReFramedModel("half_stairs_stair_down" , HELPER.autoDouble(ReFramed.id("block/half_stair/down"), ReFramed.id("block/half_stair/stair/down"))); + HELPER.addReFramedModel("half_stairs_stair_side" , HELPER.autoDouble(ReFramed.id("block/half_stair/side"), ReFramed.id("block/half_stair/stair/side"))); + HELPER.addReFramedModel("half_stairs_stair_reverse" , HELPER.autoDouble(ReFramed.id("block/half_stair/stair/side"), ReFramed.id("block/half_stair/side"))); // STEP - HELPER.addReFramedModel("step_special" , HELPER.auto(ReFramed.id("block/step/down"))); + HELPER.addReFramedModel("step" , HELPER.auto(ReFramed.id("block/step/down"))); // STEPS_SLAB - HELPER.addReFramedModel("steps_slab_special" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/slab/down"))); - HELPER.addReFramedModel("steps_slab_side_special" , HELPER.autoDouble(ReFramed.id("block/step/side"), ReFramed.id("block/step/slab/side"))); + HELPER.addReFramedModel("steps_slab" , HELPER.autoDouble(ReFramed.id("block/step/down"), ReFramed.id("block/step/slab/down"))); + HELPER.addReFramedModel("steps_slab_side" , HELPER.autoDouble(ReFramed.id("block/step/side"), ReFramed.id("block/step/slab/side"))); // LAYER - HELPER.addReFramedModel("layer_1_special" , HELPER.auto(new Identifier("block/snow_height2"))); - HELPER.addReFramedModel("layer_2_special" , HELPER.auto(new Identifier("block/snow_height4"))); - HELPER.addReFramedModel("layer_3_special" , HELPER.auto(new Identifier("block/snow_height6"))); - HELPER.addReFramedModel("layer_4_special" , HELPER.auto(new Identifier("block/snow_height8"))); - HELPER.addReFramedModel("layer_5_special" , HELPER.auto(new Identifier("block/snow_height10"))); - 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_8_special" , HELPER.auto(new Identifier("block/cube"))); + HELPER.addReFramedModel("layer_1" , HELPER.auto(new Identifier("block/snow_height2"))); + HELPER.addReFramedModel("layer_2" , HELPER.auto(new Identifier("block/snow_height4"))); + HELPER.addReFramedModel("layer_3" , HELPER.auto(new Identifier("block/snow_height6"))); + HELPER.addReFramedModel("layer_4" , HELPER.auto(new Identifier("block/snow_height8"))); + HELPER.addReFramedModel("layer_5" , HELPER.auto(new Identifier("block/snow_height10"))); + HELPER.addReFramedModel("layer_6" , HELPER.auto(new Identifier("block/snow_height12"))); + HELPER.addReFramedModel("layer_7" , HELPER.auto(new Identifier("block/snow_height14"))); + HELPER.addReFramedModel("layer_8" , HELPER.auto(new Identifier("block/cube"))); // PILLAR - HELPER.addReFramedModel("pillar_special" , HELPER.auto(ReFramed.id("block/pillar"))); + HELPER.addReFramedModel("pillar" , HELPER.auto(ReFramed.id("block/pillar"))); + // WALL + HELPER.addReFramedModel("wall_inventory" , HELPER.auto(ReFramed.id("block/wall/inventory/default"))); + // --------------------- pillar + HELPER.addReFramedModel("wall_core" , HELPER.auto(ReFramed.id("block/wall/pillar/core"))); // shares AXIS only + HELPER.addReFramedModel("wall_pillar_none" , HELPER.auto(ReFramed.id("block/wall/pillar/none"))); // only shape_none (4 * 3 axis) + HELPER.addReFramedModel("wall_pillar_negative" , HELPER.auto(ReFramed.id("block/wall/pillar/bottom"))); + HELPER.addReFramedModel("wall_pillar_both" , HELPER.auto(ReFramed.id("block/wall/pillar/both"))); + HELPER.addReFramedModel("wall_pillar_positive" , HELPER.auto(ReFramed.id("block/wall/pillar/top"))); + HELPER.addReFramedModel("wall_pillar_middle" , HELPER.auto(ReFramed.id("block/wall/pillar/middle"))); + // --------------------- side + HELPER.addReFramedModel("wall_side_negative" , HELPER.auto(ReFramed.id("block/wall/side/bottom"))); + HELPER.addReFramedModel("wall_side_both" , HELPER.auto(ReFramed.id("block/wall/side/both"))); + HELPER.addReFramedModel("wall_side_positive" , HELPER.auto(ReFramed.id("block/wall/side/top"))); + HELPER.addReFramedModel("wall_side_middle" , HELPER.auto(ReFramed.id("block/wall/side/middle"))); + // --------------------- junction + HELPER.addReFramedModel("wall_junction_negative" , HELPER.auto(ReFramed.id("block/wall/junction/bottom"))); // (4 * 3) possible + HELPER.addReFramedModel("wall_junction_both" , HELPER.auto(ReFramed.id("block/wall/junction/both"))); + HELPER.addReFramedModel("wall_junction_positive" , HELPER.auto(ReFramed.id("block/wall/junction/top"))); + HELPER.addReFramedModel("wall_junction_middle" , HELPER.auto(ReFramed.id("block/wall/junction/middle"))); + // --------------------- junction_c + HELPER.addReFramedModel("wall_junction_negative_c" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_c"))); + HELPER.addReFramedModel("wall_junction_both_c" , HELPER.auto(ReFramed.id("block/wall/junction/both_c"))); + HELPER.addReFramedModel("wall_junction_positive_c" , HELPER.auto(ReFramed.id("block/wall/junction/top_c"))); + HELPER.addReFramedModel("wall_junction_middle_c" , HELPER.auto(ReFramed.id("block/wall/junction/middle_c"))); + // --------------------- junction_i + HELPER.addReFramedModel("wall_junction_negative_i" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_i"))); + HELPER.addReFramedModel("wall_junction_both_i" , HELPER.auto(ReFramed.id("block/wall/junction/both_i"))); + HELPER.addReFramedModel("wall_junction_positive_i" , HELPER.auto(ReFramed.id("block/wall/junction/top_i"))); + HELPER.addReFramedModel("wall_junction_middle_i" , HELPER.auto(ReFramed.id("block/wall/junction/middle_i"))); + // --------------------- junction_t + HELPER.addReFramedModel("wall_junction_negative_t" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_t"))); + HELPER.addReFramedModel("wall_junction_both_t" , HELPER.auto(ReFramed.id("block/wall/junction/both_t"))); + HELPER.addReFramedModel("wall_junction_positive_t" , HELPER.auto(ReFramed.id("block/wall/junction/top_t"))); + HELPER.addReFramedModel("wall_junction_middle_t" , HELPER.auto(ReFramed.id("block/wall/junction/middle_t"))); + // --------------------- junction_x + HELPER.addReFramedModel("wall_junction_negative_x" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_x"))); // (Axis only) + HELPER.addReFramedModel("wall_junction_both_x" , HELPER.auto(ReFramed.id("block/wall/junction/both_x"))); + HELPER.addReFramedModel("wall_junction_positive_x" , HELPER.auto(ReFramed.id("block/wall/junction/top_x"))); + HELPER.addReFramedModel("wall_junction_middle_x" , HELPER.auto(ReFramed.id("block/wall/junction/middle_x"))); + //item model assignments (in lieu of models/item/___.json) - HELPER.assignItemModel("cube_special" , ReFramed.CUBE); - HELPER.assignItemModel("small_cube_special" , ReFramed.SMALL_CUBE); - HELPER.assignItemModel("small_cubes_step_special" , ReFramed.SMALL_CUBES_STEP); - HELPER.assignItemModel("slab_special" , ReFramed.SLAB); - HELPER.assignItemModel("double_slab_special" , ReFramed.SLABS_CUBE); - HELPER.assignItemModel("stair_special" , ReFramed.STAIR); - HELPER.assignItemModel("stairs_cube_special" , ReFramed.STAIRS_CUBE); - HELPER.assignItemModel("half_stair_down_special" , ReFramed.HALF_STAIR); - HELPER.assignItemModel("half_stairs_slab_down_special" , ReFramed.HALF_STAIRS_SLAB); - HELPER.assignItemModel("half_stairs_stair_down_special", ReFramed.HALF_STAIRS_STAIR); - HELPER.assignItemModel("step_special" , ReFramed.STEP); - HELPER.assignItemModel("steps_slab_special" , ReFramed.STEPS_SLAB); - HELPER.assignItemModel("layer_1_special" , ReFramed.LAYER); - HELPER.assignItemModel("pillar_special" , ReFramed.PILLAR); + HELPER.assignItemModel("cube" , ReFramed.CUBE); + HELPER.assignItemModel("small_cube" , ReFramed.SMALL_CUBE); + HELPER.assignItemModel("small_cubes_step" , ReFramed.SMALL_CUBES_STEP); + HELPER.assignItemModel("slab" , ReFramed.SLAB); + HELPER.assignItemModel("double_slab" , ReFramed.SLABS_CUBE); + HELPER.assignItemModel("stair" , ReFramed.STAIR); + HELPER.assignItemModel("stairs_cube" , ReFramed.STAIRS_CUBE); + HELPER.assignItemModel("half_stair_down" , ReFramed.HALF_STAIR); + HELPER.assignItemModel("half_stairs_slab_down" , ReFramed.HALF_STAIRS_SLAB); + HELPER.assignItemModel("half_stairs_stair_down", ReFramed.HALF_STAIRS_STAIR); + HELPER.assignItemModel("step" , ReFramed.STEP); + HELPER.assignItemModel("steps_slab" , ReFramed.STEPS_SLAB); + HELPER.assignItemModel("layer_1" , ReFramed.LAYER); + HELPER.assignItemModel("pillar" , ReFramed.PILLAR); + HELPER.assignItemModel("wall_inventory" , ReFramed.WALL); } private void privateInit() { diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClientHelper.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClientHelper.java index caa2c40..7587275 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClientHelper.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClientHelper.java @@ -40,15 +40,15 @@ public class ReFramedClientHelper { } public void addReFramedModel(String id, UnbakedModel unbaked) { - prov.addReFramedModel(ReFramed.id(id), unbaked); + prov.addReFramedModel(ReFramed.id(id + "_special"), unbaked); } public void assignItemModel(String id, ItemConvertible... item_convertibles) { - prov.assignItemModel(ReFramed.id(id), item_convertibles); + prov.assignItemModel(ReFramed.id(id + "_special"), item_convertibles); } - public CamoAppearanceManager getCamoApperanceManager(Function spriteLookup) { - return prov.getCamoApperanceManager(spriteLookup); + public CamoAppearanceManager getCamoAppearanceManager(Function spriteLookup) { + return prov.getCamoAppearanceManager(spriteLookup); } public @NotNull Renderer getFabricRenderer() { diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedModelProvider.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedModelProvider.java index ab6b946..ba78746 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedModelProvider.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedModelProvider.java @@ -44,7 +44,7 @@ public class ReFramedModelProvider implements ModelResourceProvider, ModelVarian /// camo appearance manager cache - public CamoAppearanceManager getCamoApperanceManager(Function spriteLookup) { + public CamoAppearanceManager getCamoAppearanceManager(Function spriteLookup) { //This is kind of needlessly sketchy using the "volatile double checked locking" pattern. //I'd like all frame models to use the same CamoApperanceManager, despite the model //baking process happening concurrently on several threads, but I also don't want to diff --git a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedAutoRetexturedModel.java b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedAutoRetexturedModel.java index b789e9f..522d17a 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedAutoRetexturedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedAutoRetexturedModel.java @@ -33,7 +33,7 @@ public class UnbakedAutoRetexturedModel extends UnbakedRetexturedModel { public BakedModel bake(Baker baker, Function texture_getter, ModelBakeSettings bake_settings, Identifier identifier) { return new RetexturingBakedModel( baker.bake(parent, bake_settings), - ReFramedClient.HELPER.getCamoApperanceManager(texture_getter), + ReFramedClient.HELPER.getCamoAppearanceManager(texture_getter), theme_index, bake_settings, item_state, diff --git a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedJsonRetexturedModel.java b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedJsonRetexturedModel.java index 48e5617..15b2b62 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedJsonRetexturedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedJsonRetexturedModel.java @@ -41,7 +41,7 @@ public class UnbakedJsonRetexturedModel extends UnbakedRetexturedModel { return new RetexturingBakedModel( baker.bake(parent, bake_settings), - ReFramedClient.HELPER.getCamoApperanceManager(spriteLookup), + ReFramedClient.HELPER.getCamoAppearanceManager(spriteLookup), theme_index, bake_settings, item_state, diff --git a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedRetexturedModel.java b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedRetexturedModel.java index 948cd0f..6355a30 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/UnbakedRetexturedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/UnbakedRetexturedModel.java @@ -20,8 +20,9 @@ public abstract class UnbakedRetexturedModel implements UnbakedModel { this.parent = parent; } - public void setThemeIndex(int theme_index) { + public UnbakedRetexturedModel setThemeIndex(int theme_index) { this.theme_index = theme_index; + return this; } @Override diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json new file mode 100644 index 0000000..3b97874 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json @@ -0,0 +1,28 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [5, 16, 5], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 11, 5, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json new file mode 100644 index 0000000..dfa7cb4 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json @@ -0,0 +1,35 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [5, 14, 5], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 5, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "north": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 14, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, + "up": {"uv": [5, 4, 12, 5], "texture": "#top", "cullface": "up"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json new file mode 100644 index 0000000..2b04647 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json @@ -0,0 +1,42 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [5, 14, 5], + "faces": { + "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 14], "texture": "#side"} + } + }, + { + "from": [4, 14, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, + "up": {"uv": [4, 4, 11, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [4, 0, 4], + "to": [11, 2, 5], + "faces": { + "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 2, 4], + "to": [11, 14, 5], + "faces": { + "north": {"uv": [5, 2, 11, 14], "texture": "#side"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json new file mode 100644 index 0000000..14a43c5 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json @@ -0,0 +1,35 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [5, 16, 5], + "faces": { + "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 2, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [4, 0, 4], + "to": [11, 2, 5], + "faces": { + "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/both.json b/src/main/resources/assets/reframed/models/block/wall/full/side/both.json new file mode 100644 index 0000000..e65a9d5 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/side/both.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 16, 4], + "faces": { + "north": {"uv": [5, 0, 11, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 0, 16, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "west": {"uv": [0, 0, 4, 16], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json b/src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json new file mode 100644 index 0000000..8f8e80a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 14, 4], + "faces": { + "north": {"uv": [5, 2, 11, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 16], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json b/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json new file mode 100644 index 0000000..ccc7071 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 0], + "to": [11, 14, 4], + "faces": { + "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/top.json b/src/main/resources/assets/reframed/models/block/wall/full/side/top.json new file mode 100644 index 0000000..3b64a55 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/full/side/top.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 0], + "to": [11, 16, 4], + "faces": { + "north": {"uv": [5, 0, 11, 14], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 0, 16, 14], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "west": {"uv": [0, 0, 4, 14], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/inventory/default.json b/src/main/resources/assets/reframed/models/block/wall/inventory/default.json new file mode 100644 index 0000000..f49e0d9 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/inventory/default.json @@ -0,0 +1,43 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 0], + "to": [11, 14, 4], + "faces": { + "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 12], + "to": [11, 14, 16], + "faces": { + "east": {"uv": [0, 2, 4, 14], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "south"}, + "west": {"uv": [12, 2, 16, 14], "texture": "#side"}, + "up": {"uv": [5, 12, 11, 16], "texture": "#top"}, + "down": {"uv": [5, 0, 11, 4], "texture": "#bottom"} + } + }, + { + "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", "cullface": "south"}, + "west": {"uv": [4, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#top"}, + "down": {"uv": [4, 4, 12, 12], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both.json b/src/main/resources/assets/reframed/models/block/wall/junction/both.json new file mode 100644 index 0000000..5db8cd3 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/both.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 8], + "faces": { + "east": {"uv": [8, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 8, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/both_c.json new file mode 100644 index 0000000..6115e86 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/both_c.json @@ -0,0 +1,39 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "faces": { + "east": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/both_i.json new file mode 100644 index 0000000..d3eb723 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/both_i.json @@ -0,0 +1,19 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/both_t.json new file mode 100644 index 0000000..889a4f3 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/both_t.json @@ -0,0 +1,48 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "faces": { + "east": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/both_x.json new file mode 100644 index 0000000..d1c1fec --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/both_x.json @@ -0,0 +1,57 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "faces": { + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom.json b/src/main/resources/assets/reframed/models/block/wall/junction/bottom.json new file mode 100644 index 0000000..ed36c16 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/bottom.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 8], + "faces": { + "east": {"uv": [8, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 8], "texture": "#top"}, + "down": {"uv": [5, 8, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json new file mode 100644 index 0000000..589682a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json @@ -0,0 +1,39 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "east": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json new file mode 100644 index 0000000..3d841ae --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json @@ -0,0 +1,19 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json new file mode 100644 index 0000000..541b380 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json @@ -0,0 +1,48 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "east": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json new file mode 100644 index 0000000..54ead57 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json @@ -0,0 +1,57 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle.json new file mode 100644 index 0000000..0957db9 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/middle.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 14, 8], + "faces": { + "east": {"uv": [8, 2, 12, 14], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 8, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 8], "texture": "#top"}, + "down": {"uv": [5, 8, 11, 12], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json new file mode 100644 index 0000000..b21b9ad --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json @@ -0,0 +1,39 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 14, 11], + "faces": { + "east": {"uv": [5, 2, 11, 14], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json new file mode 100644 index 0000000..0f177cd --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json @@ -0,0 +1,19 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 12], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json new file mode 100644 index 0000000..7d14491 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json @@ -0,0 +1,48 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 14, 11], + "faces": { + "east": {"uv": [5, 2, 11, 14], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json new file mode 100644 index 0000000..a60bd78 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json @@ -0,0 +1,57 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 14, 11], + "faces": { + "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + }, + { + "from": [11, 2, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 14], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top.json b/src/main/resources/assets/reframed/models/block/wall/junction/top.json new file mode 100644 index 0000000..cd8d46c --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/top.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 16, 8], + "faces": { + "east": {"uv": [8, 0, 12, 14], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 8, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 8, 11, 12], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json new file mode 100644 index 0000000..488b597 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json @@ -0,0 +1,39 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 16, 11], + "faces": { + "east": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json new file mode 100644 index 0000000..ed3446a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json @@ -0,0 +1,19 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 12], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json new file mode 100644 index 0000000..fc4ba02 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json @@ -0,0 +1,48 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 11], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "west": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 16, 11], + "faces": { + "east": {"uv": [5, 0, 11, 14], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json new file mode 100644 index 0000000..6086284 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json @@ -0,0 +1,57 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 11], + "to": [11, 16, 12], + "faces": { + "east": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "west": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} + } + }, + { + "from": [5, 2, 5], + "to": [11, 16, 11], + "faces": { + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} + } + }, + { + "from": [4, 2, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} + } + }, + { + "from": [11, 2, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/both.json b/src/main/resources/assets/reframed/models/block/wall/pillar/both.json new file mode 100644 index 0000000..f135dd4 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/both.json @@ -0,0 +1,27 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [5, 16, 5], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 11, 5, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json b/src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json new file mode 100644 index 0000000..ac57f92 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json @@ -0,0 +1,34 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [5, 14, 5], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 5, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 14, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, + "up": {"uv": [5, 4, 12, 5], "texture": "#top", "cullface": "up"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/core.json b/src/main/resources/assets/reframed/models/block/wall/pillar/core.json new file mode 100644 index 0000000..9f6ed16 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/core.json @@ -0,0 +1,17 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "faces": { + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json b/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json new file mode 100644 index 0000000..1cf2b7a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json @@ -0,0 +1,35 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [5, 14, 5], + "faces": { + "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 14], "texture": "#side"} + } + }, + { + "from": [4, 14, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, + "up": {"uv": [4, 4, 11, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [4, 0, 4], + "to": [11, 2, 5], + "faces": { + "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/none.json b/src/main/resources/assets/reframed/models/block/wall/pillar/none.json new file mode 100644 index 0000000..3b97874 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/none.json @@ -0,0 +1,28 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [5, 16, 5], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 11, 5, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "north": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/top.json b/src/main/resources/assets/reframed/models/block/wall/pillar/top.json new file mode 100644 index 0000000..baca217 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/pillar/top.json @@ -0,0 +1,34 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [5, 16, 5], + "faces": { + "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, + "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 2, 4], + "to": [11, 16, 5], + "faces": { + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [4, 0, 4], + "to": [11, 2, 5], + "faces": { + "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, + "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/both.json b/src/main/resources/assets/reframed/models/block/wall/side/both.json new file mode 100644 index 0000000..7fa56e6 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/side/both.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 16, 4], + "faces": { + "north": {"uv": [5, 0, 11, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 0, 16, 16], "texture": "#side"}, + "west": {"uv": [0, 0, 4, 16], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/bottom.json b/src/main/resources/assets/reframed/models/block/wall/side/bottom.json new file mode 100644 index 0000000..73cfd76 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/side/bottom.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 14, 4], + "faces": { + "north": {"uv": [5, 2, 11, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 16], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 16], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/middle.json b/src/main/resources/assets/reframed/models/block/wall/side/middle.json new file mode 100644 index 0000000..59432d8 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/side/middle.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 0], + "to": [11, 14, 4], + "faces": { + "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/top.json b/src/main/resources/assets/reframed/models/block/wall/side/top.json new file mode 100644 index 0000000..99e3253 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/side/top.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 2, 0], + "to": [11, 16, 4], + "faces": { + "north": {"uv": [5, 0, 11, 14], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 0, 16, 14], "texture": "#side"}, + "west": {"uv": [0, 0, 4, 14], "texture": "#side"}, + "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} + } + } + ] +} \ No newline at end of file From b05c0ebd42197db9c27743677d9b62b42f18bb6f Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Thu, 11 Apr 2024 00:06:22 +0200 Subject: [PATCH 06/10] removed unused imports --- .../java/fr/adrien1106/reframed/block/ReframedWallBlock.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java index 4fef9a3..3a324a3 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java @@ -2,8 +2,6 @@ package fr.adrien1106.reframed.block; import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.generator.BlockStateProvider; -import fr.adrien1106.reframed.util.blocks.Corner; -import fr.adrien1106.reframed.util.blocks.WallShape; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -17,9 +15,6 @@ import net.minecraft.state.StateManager; import net.minecraft.util.math.Direction; import org.jetbrains.annotations.Nullable; -import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; -import static net.minecraft.state.property.Properties.AXIS; - public class ReframedWallBlock extends WaterloggableReFramedBlock implements BlockStateProvider { private record ModelCacheKey() {} From 6f394bbe6feb8889d8e0610d6de19d7d7cad05d8 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Fri, 12 Apr 2024 01:03:47 +0200 Subject: [PATCH 07/10] wip wall logic and models + moved generation for block into separate classes for better readability --- .../java/fr/adrien1106/reframed/ReFramed.java | 9 +- .../reframed/block/ReFramedBlock.java | 21 +- .../block/ReFramedHalfStairBlock.java | 94 +--- .../block/ReFramedHalfStairsSlabBlock.java | 32 +- .../block/ReFramedHalfStairsStairBlock.java | 59 +-- .../reframed/block/ReFramedLayerBlock.java | 27 -- .../reframed/block/ReFramedPillarBlock.java | 38 +- .../reframed/block/ReFramedSlabBlock.java | 41 +- .../block/ReFramedSlabsCubeBlock.java | 35 +- .../block/ReFramedSmallCubeBlock.java | 45 +- .../block/ReFramedSmallCubesStepBlock.java | 58 +-- .../reframed/block/ReFramedStairBlock.java | 254 +--------- .../block/ReFramedStairsCubeBlock.java | 27 +- .../reframed/block/ReFramedStepBlock.java | 57 +-- .../block/ReFramedStepsSlabBlock.java | 55 +-- .../reframed/block/ReframedWallBlock.java | 153 ++++-- .../reframed/client/ReFramedClient.java | 45 +- .../generator/BlockStateProvider.java | 3 +- .../reframed/generator/GBlockTag.java | 15 +- .../reframed/generator/GBlockstate.java | 78 ++- .../reframed/generator/GRecipe.java | 38 +- .../reframed/generator/RecipeSetter.java | 3 +- .../reframed/generator/TagGetter.java | 11 + .../reframed/generator/block/Cube.java | 26 + .../reframed/generator/block/HalfStair.java | 106 +++++ .../generator/block/HalfStairsSlab.java | 37 ++ .../generator/block/HalfStairsStair.java | 70 +++ .../reframed/generator/block/Layer.java | 58 +++ .../reframed/generator/block/Pillar.java | 49 ++ .../reframed/generator/block/Slab.java | 52 ++ .../reframed/generator/block/SlabsCube.java | 46 ++ .../reframed/generator/block/SmallCube.java | 57 +++ .../generator/block/SmallCubesStep.java | 69 +++ .../reframed/generator/block/Stair.java | 267 +++++++++++ .../reframed/generator/block/StairsCube.java | 33 ++ .../reframed/generator/block/Step.java | 69 +++ .../reframed/generator/block/StepsSlab.java | 66 +++ .../reframed/generator/block/Wall.java | 446 ++++++++++++++++++ .../reframed/generator/item/Blueprint.java | 25 + .../reframed/generator/item/Hammer.java | 28 ++ .../reframed/generator/item/Screwdriver.java | 27 ++ .../reframed/item/ReFramedBlueprintItem.java | 21 +- .../reframed/item/ReFramedHammerItem.java | 23 +- .../item/ReFramedScrewdriverItem.java | 22 +- .../full/pillar/{bottom.json => low.json} | 0 .../models/block/wall/full/pillar/middle.json | 42 -- .../wall/full/pillar/{both.json => tall.json} | 0 .../models/block/wall/full/pillar/top.json | 35 -- .../wall/full/side/{bottom.json => low.json} | 0 .../models/block/wall/full/side/middle.json | 21 - .../wall/full/side/{both.json => tall.json} | 0 .../models/block/wall/full/side/top.json | 21 - .../models/block/wall/inventory/default.json | 16 +- .../wall/junction/{bottom.json => low.json} | 0 .../junction/{bottom_c.json => low_c.json} | 30 +- .../junction/{bottom_i.json => low_i.json} | 0 .../junction/{bottom_t.json => low_t.json} | 0 .../block/wall/junction/low_tall_c.json | 65 +++ .../block/wall/junction/low_tall_i.json | 38 ++ .../models/block/wall/junction/middle.json | 20 - .../models/block/wall/junction/middle_c.json | 39 -- .../models/block/wall/junction/middle_i.json | 19 - .../models/block/wall/junction/middle_t.json | 48 -- .../models/block/wall/junction/middle_x.json | 57 --- .../wall/junction/{both.json => tall.json} | 0 .../junction/{both_c.json => tall_c.json} | 30 +- .../junction/{both_i.json => tall_i.json} | 0 .../block/wall/junction/tall_low_c.json | 65 +++ .../junction/{both_t.json => tall_t.json} | 0 .../models/block/wall/junction/top.json | 20 - .../models/block/wall/junction/top_c.json | 39 -- .../models/block/wall/junction/top_i.json | 19 - .../models/block/wall/junction/top_t.json | 48 -- .../models/block/wall/junction/top_x.json | 57 --- .../wall/pillar/{bottom.json => low.json} | 0 .../models/block/wall/pillar/middle.json | 35 -- .../wall/pillar/{both.json => tall.json} | 0 .../models/block/wall/pillar/top.json | 34 -- .../block/wall/side/{bottom.json => low.json} | 0 .../models/block/wall/side/middle.json | 20 - .../block/wall/side/{both.json => tall.json} | 0 .../reframed/models/block/wall/side/top.json | 20 - 82 files changed, 2055 insertions(+), 1578 deletions(-) create mode 100644 src/main/java/fr/adrien1106/reframed/generator/TagGetter.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Cube.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfStair.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsSlab.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStair.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Layer.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Pillar.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Slab.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SlabsCube.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SmallCube.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Stair.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/StairsCube.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Step.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/block/Wall.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/item/Blueprint.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/item/Hammer.java create mode 100644 src/main/java/fr/adrien1106/reframed/generator/item/Screwdriver.java rename src/main/resources/assets/reframed/models/block/wall/full/pillar/{bottom.json => low.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json rename src/main/resources/assets/reframed/models/block/wall/full/pillar/{both.json => tall.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json rename src/main/resources/assets/reframed/models/block/wall/full/side/{bottom.json => low.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/middle.json rename src/main/resources/assets/reframed/models/block/wall/full/side/{both.json => tall.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/full/side/top.json rename src/main/resources/assets/reframed/models/block/wall/junction/{bottom.json => low.json} (100%) rename src/main/resources/assets/reframed/models/block/wall/junction/{bottom_c.json => low_c.json} (51%) rename src/main/resources/assets/reframed/models/block/wall/junction/{bottom_i.json => low_i.json} (100%) rename src/main/resources/assets/reframed/models/block/wall/junction/{bottom_t.json => low_t.json} (100%) create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/low_tall_i.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json rename src/main/resources/assets/reframed/models/block/wall/junction/{both.json => tall.json} (100%) rename src/main/resources/assets/reframed/models/block/wall/junction/{both_c.json => tall_c.json} (51%) rename src/main/resources/assets/reframed/models/block/wall/junction/{both_i.json => tall_i.json} (100%) create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c.json rename src/main/resources/assets/reframed/models/block/wall/junction/{both_t.json => tall_t.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_c.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_i.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_t.json delete mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/top_x.json rename src/main/resources/assets/reframed/models/block/wall/pillar/{bottom.json => low.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/middle.json rename src/main/resources/assets/reframed/models/block/wall/pillar/{both.json => tall.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/pillar/top.json rename src/main/resources/assets/reframed/models/block/wall/side/{bottom.json => low.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/side/middle.json rename src/main/resources/assets/reframed/models/block/wall/side/{both.json => tall.json} (100%) delete mode 100644 src/main/resources/assets/reframed/models/block/wall/side/top.json diff --git a/src/main/java/fr/adrien1106/reframed/ReFramed.java b/src/main/java/fr/adrien1106/reframed/ReFramed.java index 46b02ba..05d6fc3 100644 --- a/src/main/java/fr/adrien1106/reframed/ReFramed.java +++ b/src/main/java/fr/adrien1106/reframed/ReFramed.java @@ -28,10 +28,11 @@ 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 support continuity overlays -> not scheduled + * 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 support continuity overlays -> not scheduled + * TODO better state caching per models (e.g. wall only has 3 max per model) -> not scheduled */ public class ReFramed implements ModInitializer { public static final String MODID = "reframed"; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java index 49d2596..272b930 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedBlock.java @@ -1,13 +1,9 @@ package fr.adrien1106.reframed.block; import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.RecipeSetter; import fr.adrien1106.reframed.util.blocks.BlockHelper; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; @@ -16,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtHelper; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.registry.Registries; import net.minecraft.state.StateManager; import net.minecraft.util.ActionResult; @@ -41,7 +36,7 @@ import java.util.stream.IntStream; import static fr.adrien1106.reframed.block.ReFramedEntity.BLOCKSTATE_KEY; import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT; -public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeSetter { +public class ReFramedBlock extends Block implements BlockEntityProvider { public ReFramedBlock(Settings settings) { super(settings); @@ -225,18 +220,4 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS public Map getThemeMap(BlockState state, BlockState new_state) { return Map.of(); } - - @Override - public void setRecipe(RecipeExporter exporter) { - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .pattern("III") - .pattern("I~I") - .pattern("III") - .input('I', Items.BAMBOO) - .input('~', Items.STRING) - .criterion(FabricRecipeProvider.hasItem(Items.BAMBOO), FabricRecipeProvider.conditionsFromItem(Items.BAMBOO)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index bcf3dd1..f5b36e2 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -1,25 +1,15 @@ 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 fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Corner; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; -import net.minecraft.util.Identifier; import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -33,10 +23,9 @@ import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; -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 { public static final VoxelShape[] HALF_STAIR_VOXELS; @@ -137,87 +126,6 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement return super.getThemeMap(state, new_state); } - @Override - public BlockStateSupplier getMultipart() { - return getHalfStairMultipart( - this, - ReFramed.id("half_stair_down_special"), - ReFramed.id("half_stair_side_special") - ); - } - - public static BlockStateSupplier getHalfStairMultipart(Block block, Identifier model_down, Identifier model_side) { - return MultipartBlockStateSupplier.create(block) - .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R0, R0)) - .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R90, R270)) - .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R0, R0)) - - .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R0, R90)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R90, R0)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R0, R90)) - - .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R0, R180)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R90, R90)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R0, R180)) - - .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R0, R270)) - .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R90, R180)) - .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R0, R270)) - - .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R180, R0)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R270, R90)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R180, R0)) - - .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R180, R90)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R270, R180)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R180, R90)) - - .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R180, R180)) - .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R270, R270)) - .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R180, R180)) - - .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 0), - GBlockstate.variant(model_side, true, R180, R270)) - .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 1), - GBlockstate.variant(model_side, true, R270, R0)) - .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 2), - GBlockstate.variant(model_down, true, R180, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 4) - .pattern("I ") - .pattern("II") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } - 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 e0c6c41..934a8bf 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsSlabBlock.java @@ -1,19 +1,11 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.BlockStateProvider; import fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Corner; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -21,7 +13,6 @@ 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.getHalfStairMultipart; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.SMALL_CUBE_VOXELS; import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER; @@ -29,7 +20,7 @@ import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE; import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN; import static net.minecraft.util.shape.VoxelShapes.empty; -public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBlock { private record ModelCacheKey(Corner corner, int face) {} @@ -79,25 +70,4 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc ? SMALL_CUBE_VOXELS[corner.getOpposite(face).getID()] : HALF_STAIR_VOXELS[face + corner.getID() * 3]; } - - @Override - public BlockStateSupplier getMultipart() { - return getHalfStairMultipart( - this, - ReFramed.id("half_stairs_slab_down_special"), - ReFramed.id("half_stairs_slab_side_special") - ); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.HALF_STAIR) - .input(ReFramed.SMALL_CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java index b890a40..5a40c97 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java @@ -1,25 +1,14 @@ 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.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Corner; import fr.adrien1106.reframed.util.blocks.Edge; import fr.adrien1106.reframed.util.blocks.StairShape; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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; @@ -33,7 +22,7 @@ import static fr.adrien1106.reframed.util.blocks.Edge.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.util.shape.VoxelShapes.empty; -public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlock { public ReFramedHalfStairsStairBlock(Settings settings) { super(settings); setDefaultState(getDefaultState().with(EDGE, NORTH_DOWN)); @@ -89,50 +78,4 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo public int getTopThemeIndex(BlockState state) { return 2; } - - @Override - public BlockStateSupplier getMultipart() { - Identifier model_id = ReFramed.id("half_stairs_stair_down_special"); - Identifier side_model_id = ReFramed.id("half_stairs_stair_side_special"); - Identifier reverse_model_id = ReFramed.id("half_stairs_stair_reverse_special"); - return MultipartBlockStateSupplier.create(this) - /* X AXIS */ - .with(GBlockstate.when(EDGE, NORTH_DOWN), - GBlockstate.variant(side_model_id, true, R90, R180)) - .with(GBlockstate.when(EDGE, DOWN_SOUTH), - GBlockstate.variant(side_model_id, true, R0, R180)) - .with(GBlockstate.when(EDGE, SOUTH_UP), - GBlockstate.variant(side_model_id, true, R270, R180)) - .with(GBlockstate.when(EDGE, UP_NORTH), - GBlockstate.variant(side_model_id, true, R180, R180)) - /* Y AXIS */ - .with(GBlockstate.when(EDGE, NORTH_EAST), - GBlockstate.variant(model_id, true, R0, R0)) - .with(GBlockstate.when(EDGE, EAST_SOUTH), - GBlockstate.variant(model_id, true, R0, R90)) - .with(GBlockstate.when(EDGE, SOUTH_WEST), - GBlockstate.variant(model_id, true, R0, R180)) - .with(GBlockstate.when(EDGE, WEST_NORTH), - GBlockstate.variant(model_id, true, R0, R270)) - /* Z AXIS */ - .with(GBlockstate.when(EDGE, DOWN_EAST), - GBlockstate.variant(reverse_model_id, true, R0, R90)) - .with(GBlockstate.when(EDGE, EAST_UP), - GBlockstate.variant(side_model_id, true, R180, R270)) - .with(GBlockstate.when(EDGE, UP_WEST), - GBlockstate.variant(reverse_model_id, true, R180, R90)) - .with(GBlockstate.when(EDGE, WEST_DOWN), - GBlockstate.variant(side_model_id, true, R0, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.HALF_STAIR, 2) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index d7ab8b7..5561b56 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -1,16 +1,12 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.ReFramed; -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.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; @@ -68,29 +64,6 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { return previous.with(LAYERS, previous.get(LAYERS) + 1); } - @Override - public MultipartBlockStateSupplier getMultipart() { - String model_pattern = "layer_x_special"; - MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(this); - for (int i = 1; i <= 8; i++) { - Identifier model = ReFramed.id(model_pattern.replace("x", i + "")); - supplier - .with(GBlockstate.when(FACING, Direction.DOWN, LAYERS, i), - GBlockstate.variant(model, true, R0, R0)) - .with(GBlockstate.when(FACING, Direction.SOUTH, LAYERS, i), - GBlockstate.variant(model, true, R90, R0)) - .with(GBlockstate.when(FACING, Direction.UP, LAYERS, i), - GBlockstate.variant(model, true, R180, R0)) - .with(GBlockstate.when(FACING, Direction.NORTH, LAYERS, i), - GBlockstate.variant(model, true, R270, R0)) - .with(GBlockstate.when(FACING, Direction.WEST, LAYERS, i), - GBlockstate.variant(model, true, R90, R90)) - .with(GBlockstate.when(FACING, Direction.EAST, LAYERS, i), - GBlockstate.variant(model, true, R90, R270)); - } - return supplier; - } - static { VoxelListBuilder builder = VoxelListBuilder.create(createCuboidShape(0, 0, 0, 16, 2, 16), 48) .add(createCuboidShape(0, 0, 0, 16, 4, 16)) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java index 3e391fd..7f2428a 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java @@ -1,23 +1,12 @@ 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.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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; @@ -29,7 +18,7 @@ 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 class ReFramedPillarBlock extends WaterloggableReFramedBlock { public static final VoxelShape[] PILLAR_VOXELS; @@ -85,31 +74,6 @@ public class ReFramedPillarBlock extends WaterloggableReFramedBlock implements B 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)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 4); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 8) - .pattern("I") - .pattern("I") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } - static { final VoxelShape PILLAR = createCuboidShape(0, 4, 4, 16, 12, 12); PILLAR_VOXELS = VoxelHelper.VoxelListBuilder.create(PILLAR, 3) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 7ed411f..c67b7a5 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -1,21 +1,12 @@ package fr.adrien1106.reframed.block; import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.BlockStateProvider; -import fr.adrien1106.reframed.generator.GBlockstate; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; -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.ShapedRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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; @@ -29,7 +20,7 @@ import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.AXIS; import static net.minecraft.state.property.Properties.FACING; -public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements BlockStateProvider { +public class ReFramedSlabBlock extends WaterloggableReFramedBlock { protected static final VoxelShape DOWN = VoxelShapes.cuboid(0f, 0f, 0f, 1f, 0.5f, 1f); protected static final VoxelShape UP = VoxelShapes.cuboid(0f, 0.5f, 0f, 1f, 1f, 1f); @@ -108,34 +99,4 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo if (new_state.isOf(ReFramed.SLABS_CUBE)) return Map.of(1, state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1); return super.getThemeMap(state, new_state); } - - @Override - public MultipartBlockStateSupplier getMultipart() { - Identifier model_id = ReFramed.id("slab_special"); - return MultipartBlockStateSupplier.create(this) - .with(GBlockstate.when(FACING, Direction.DOWN), - GBlockstate.variant(model_id, true, R0, R0)) - .with(GBlockstate.when(FACING, Direction.SOUTH), - GBlockstate.variant(model_id, true, R90, R0)) - .with(GBlockstate.when(FACING, Direction.UP), - GBlockstate.variant(model_id, true, R180, R0)) - .with(GBlockstate.when(FACING, Direction.NORTH), - GBlockstate.variant(model_id, true, R270, R0)) - .with(GBlockstate.when(FACING, Direction.WEST), - GBlockstate.variant(model_id, true, R90, R90)) - .with(GBlockstate.when(FACING, Direction.EAST), - GBlockstate.variant(model_id, true, R90, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 6) - .pattern("III") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java index 9916a3d..2c30cd8 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java @@ -1,19 +1,9 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.BlockStateProvider; -import fr.adrien1106.reframed.generator.GBlockstate; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -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.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; -import net.minecraft.util.Identifier; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import org.jetbrains.annotations.Nullable; @@ -22,7 +12,7 @@ import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.AXIS; -public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock { public ReFramedSlabsCubeBlock(Settings settings) { super(settings); @@ -63,27 +53,4 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements Block public int getTopThemeIndex(BlockState state) { return 2; } - - @Override - public MultipartBlockStateSupplier getMultipart() { - Identifier model_id = ReFramed.id("double_slab_special"); - return MultipartBlockStateSupplier.create(this) - .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, R270, R0)) - .with(GBlockstate.when(AXIS, Direction.Axis.X), - GBlockstate.variant(model_id, true, R90, R90)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.SLAB, 2) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index 46eb263..c0181c4 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -1,25 +1,15 @@ 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 fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Corner; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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.math.Vec3d; @@ -36,7 +26,7 @@ import static fr.adrien1106.reframed.util.blocks.Corner.*; 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 { public static final VoxelShape[] SMALL_CUBE_VOXELS; @@ -159,39 +149,6 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement return super.getThemeMap(state, new_state); } - @Override - public BlockStateSupplier getMultipart() { - Identifier small_cube_id = ReFramed.id("small_cube_special"); - return MultipartBlockStateSupplier.create(this) - .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN), - GBlockstate.variant(small_cube_id, true, R0, R0)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN), - GBlockstate.variant(small_cube_id, true, R0, R90)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN), - GBlockstate.variant(small_cube_id, true, R0, R180)) - .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN), - GBlockstate.variant(small_cube_id, true, R0, R270)) - .with(GBlockstate.when(CORNER, EAST_SOUTH_UP), - GBlockstate.variant(small_cube_id, true, R180, R0)) - .with(GBlockstate.when(CORNER, SOUTH_WEST_UP), - GBlockstate.variant(small_cube_id, true, R180, R90)) - .with(GBlockstate.when(CORNER, WEST_NORTH_UP), - GBlockstate.variant(small_cube_id, true, R180, R180)) - .with(GBlockstate.when(CORNER, NORTH_EAST_UP), - GBlockstate.variant(small_cube_id, true, R180, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 8); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 8) - .input(ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } - static { final VoxelShape SMALL_CUBE = VoxelShapes.cuboid(.5f, 0f, 0f, 1f, .5f, .5f); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java index 5e70c83..248a6de 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java @@ -1,24 +1,13 @@ 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.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Corner; import fr.adrien1106.reframed.util.blocks.Edge; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; -import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; @@ -31,7 +20,7 @@ import static fr.adrien1106.reframed.util.blocks.Edge.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.util.shape.VoxelShapes.empty; -public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBlock { public ReFramedSmallCubesStepBlock(Settings settings) { super(settings); @@ -85,49 +74,4 @@ public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBloc public int getTopThemeIndex(BlockState state) { return 2; } - - @Override - public BlockStateSupplier getMultipart() { - Identifier model_id = ReFramed.id("small_cubes_step_special"); - Identifier reverse_model_id = ReFramed.id("small_cubes_step_reverse_special"); - return MultipartBlockStateSupplier.create(this) - /* 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)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 4); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.SMALL_CUBE, 2) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index f9df7f4..5f29dfd 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -1,26 +1,16 @@ 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 fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Edge; import fr.adrien1106.reframed.util.blocks.StairShape; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; -import net.minecraft.data.client.MultipartBlockStateSupplier; -import net.minecraft.data.client.When; -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.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; -import net.minecraft.util.Identifier; import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -41,7 +31,7 @@ import static fr.adrien1106.reframed.util.blocks.Edge.*; import static fr.adrien1106.reframed.util.blocks.StairShape.*; import static net.minecraft.data.client.VariantSettings.Rotation.*; -public class ReFramedStairBlock extends WaterloggableReFramedBlock implements BlockStateProvider { +public class ReFramedStairBlock extends WaterloggableReFramedBlock { public static final VoxelShape[] STAIR_VOXELS; private record ModelCacheKey(Edge edge, StairShape shape) {} @@ -128,248 +118,6 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl return super.getThemeMap(state, new_state); } - @Override - public MultipartBlockStateSupplier getMultipart() { - return getStairMultipart(this, false); - } - - public static MultipartBlockStateSupplier getStairMultipart(Block block, boolean is_double) { - String infix = is_double ? "s_cube" : ""; - Identifier straight_id = ReFramed.id("stair" + infix + "_special"); - Identifier double_outer_id = ReFramed.id("outers_stair" + infix + "_special"); - Identifier inner_id = ReFramed.id("inner_stair" + infix + "_special"); - Identifier outer_id = ReFramed.id("outer_stair" + infix + "_special"); - Identifier outer_side_id = ReFramed.id("outer_side_stair" + infix + "_special"); - return MultipartBlockStateSupplier.create(block) - /* STRAIGHT X AXIS */ - .with(GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R0, R0)) - .with(GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R180, R0)) - .with(GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R180, R180)) - .with(GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R0, R180)) - /* STRAIGHT Y AXIS */ - .with(GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R90, R0)) - .with(GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R90, R90)) - .with(GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R90, R180)) - .with(GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R90, R270)) - /* STRAIGHT Z AXIS */ - .with(GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R0, R90)) - .with(GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R0, R270)) - .with(GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R180, R270)) - .with(GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, STRAIGHT), - GBlockstate.variant(straight_id, true, R180, R90)) - /* INNER BOTTOM */ - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)), - GBlockstate.variant(inner_id, true, R0, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)), - GBlockstate.variant(inner_id, true, R0, R270)) - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)), - GBlockstate.variant(inner_id, true, R0, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)), - GBlockstate.variant(inner_id, true, R0, R90)) - /* INNER TOP */ - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_LEFT)), - GBlockstate.variant(inner_id, true, R180, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_LEFT)), - GBlockstate.variant(inner_id, true, R180, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)), - GBlockstate.variant(inner_id, true, R180, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_RIGHT), - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)), - GBlockstate.variant(inner_id, true, R180, R270)) - /* OUTER BOTTOM */ - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_id, true, R0, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_id, true, R0, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_id, true, R0, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_id, true, R0, R270)) - /* OUTER TOP */ - .with(When.anyOf( - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_id, true, R180, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_id, true, R180, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_id, true, R180, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_id, true, R180, R270)) - /* OUTER EAST */ - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R0, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R90, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R180, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R270, R0)) - /* OUTER SOUTH */ - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R0, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R90, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R180, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R270, R90)) - /* OUTER WEST */ - .with(When.anyOf( - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R0, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R90, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R180, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R270, R180)) - /* OUTER NORTH */ - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT), - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R0, R270)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT), - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, FIRST_OUTER_LEFT)), - GBlockstate.variant(outer_side_id, true, R90, R270)) - .with(When.anyOf( - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, FIRST_OUTER_LEFT), - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, FIRST_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R180, R270)) - .with(When.anyOf( - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, FIRST_OUTER_RIGHT), - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), - GBlockstate.variant(outer_side_id, true, R270, R270)) - /* OUTER BOTTOM */ - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_RIGHT)), - GBlockstate.variant(double_outer_id, true, R0, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_RIGHT)), - GBlockstate.variant(double_outer_id, true, R0, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_RIGHT)), - GBlockstate.variant(double_outer_id, true, R0, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_RIGHT)), - GBlockstate.variant(double_outer_id, true, R0, R270)) - /* OUTER TOP */ - .with(When.anyOf( - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_LEFT)), - GBlockstate.variant(double_outer_id, true, R180, R0)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_LEFT)), - GBlockstate.variant(double_outer_id, true, R180, R90)) - .with(When.anyOf( - GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT), - GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_LEFT)), - GBlockstate.variant(double_outer_id, true, R180, R180)) - .with(When.anyOf( - GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT), - GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_LEFT)), - GBlockstate.variant(double_outer_id, true, R180, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 4) - .pattern("I ") - .pattern("II ") - .pattern("III") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } - static { final VoxelShape STRAIGHT = VoxelShapes.combineAndSimplify( createCuboidShape(0, 8, 0, 16, 16, 8), diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java index 60b44f9..9267a39 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairsCubeBlock.java @@ -1,19 +1,11 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.BlockStateProvider; import fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Edge; import fr.adrien1106.reframed.util.blocks.StairShape; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -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.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.state.StateManager; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -27,7 +19,7 @@ import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE; -public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock { private static final VoxelShape[] STAIRS_CUBE_VOXELS = VoxelListBuilder.buildFrom(STAIR_VOXELS); private record ModelCacheKey(Edge edge, StairShape shape) {} @@ -80,21 +72,4 @@ public class ReFramedStairsCubeBlock extends ReFramedDoubleBlock implements Bloc StairShape shape = state.get(STAIR_SHAPE); return i == 2 ? STAIRS_CUBE_VOXELS[edge.getID() * 9 + shape.getID()] : getStairShape(edge, shape); } - - @Override - public MultipartBlockStateSupplier getMultipart() { - return getStairMultipart(this, true); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.STAIR) - .input(ReFramed.STEP) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 4843f6f..99f35a6 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -1,25 +1,15 @@ 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 fr.adrien1106.reframed.util.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Edge; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; 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.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.RecipeProvider; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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.math.Vec3d; @@ -37,7 +27,7 @@ import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.*; import static net.minecraft.state.property.Properties.WATERLOGGED; -public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider { +public class ReFramedStepBlock extends WaterloggableReFramedBlock { public static final VoxelShape[] STEP_VOXELS; @@ -164,51 +154,6 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo return super.getThemeMap(state, new_state); } - @Override - public BlockStateSupplier getMultipart() { - Identifier model_id = ReFramed.id("step_special"); - return MultipartBlockStateSupplier.create(this) - /* 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)) - .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)) - /* 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(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)) - .with(GBlockstate.when(EDGE, SOUTH_UP), - GBlockstate.variant(model_id, true, R180, R90)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 4); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 8) - .pattern("II") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } - static { final VoxelShape STEP = createCuboidShape(0, 0, 0, 16, 8, 8); diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java index 6198e69..f56fb56 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java @@ -1,22 +1,12 @@ 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.blocks.BlockHelper; import fr.adrien1106.reframed.util.blocks.Edge; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; -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.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; 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.math.Direction.Axis; @@ -32,7 +22,7 @@ import static net.minecraft.state.property.Properties.AXIS; import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.util.shape.VoxelShapes.empty; -public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock implements BlockStateProvider { +public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock { private record ModelCacheKey(Direction facing, Axis axis) {} public ReFramedStepsSlabBlock(Settings settings) { @@ -90,47 +80,4 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp public int getTopThemeIndex(BlockState state) { return 2; } - - @Override - public MultipartBlockStateSupplier getMultipart() { - Identifier step_id = ReFramed.id("steps_slab_special"); - Identifier step_side_id = ReFramed.id("steps_slab_side_special"); - return MultipartBlockStateSupplier.create(this) - .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.X), - GBlockstate.variant(step_id, true, R0, R180)) - .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.Z), - GBlockstate.variant(step_id, true, R0, R270)) - .with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.X), - GBlockstate.variant(step_id, true, R180, R180)) - .with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.Z), - GBlockstate.variant(step_id, true, R180, R270)) - - .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Z), - GBlockstate.variant(step_side_id, true, R0, R0)) - .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Y), - GBlockstate.variant(step_side_id, true, R90, R0)) - .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.X), - GBlockstate.variant(step_side_id, true, R180, R90)) - .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.Y), - GBlockstate.variant(step_side_id, true, R90, R90)) - .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Z), - GBlockstate.variant(step_side_id, true, R180, R180)) - .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Y), - GBlockstate.variant(step_side_id, true, R90, R180)) - .with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Axis.X), - GBlockstate.variant(step_side_id, true, R0, R270)) - .with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Axis.Y), - GBlockstate.variant(step_side_id, true, R90, R270)); - } - - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapelessRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this) - .input(ReFramed.STEP, 2) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java index 3a324a3..9191776 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java @@ -1,64 +1,157 @@ package fr.adrien1106.reframed.block; -import fr.adrien1106.reframed.ReFramed; -import fr.adrien1106.reframed.generator.BlockStateProvider; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -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 fr.adrien1106.reframed.util.VoxelHelper; +import net.minecraft.block.*; +import net.minecraft.block.enums.WallShape; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.state.StateManager; +import net.minecraft.state.property.Property; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -public class ReframedWallBlock extends WaterloggableReFramedBlock implements BlockStateProvider { +import java.util.stream.Stream; - private record ModelCacheKey() {} +import static net.minecraft.state.property.Properties.*; + +public class ReframedWallBlock extends WaterloggableReFramedBlock { + + public static final VoxelShape[] WALL_VOXELS; + + private record ModelCacheKey(boolean up, WallShape east, WallShape north, WallShape west, WallShape south) {} public ReframedWallBlock(Settings settings) { super(settings); + setDefaultState(getDefaultState() + .with(UP, true) + .with(EAST_WALL_SHAPE, WallShape.NONE) + .with(NORTH_WALL_SHAPE, WallShape.NONE) + .with(WEST_WALL_SHAPE, WallShape.NONE) + .with(SOUTH_WALL_SHAPE, WallShape.NONE) + ); } @Override public Object getModelCacheKey(BlockState state) { - return new ModelCacheKey(); + return new ModelCacheKey( + state.get(UP), + state.get(EAST_WALL_SHAPE), + state.get(NORTH_WALL_SHAPE), + state.get(WEST_WALL_SHAPE), + state.get(SOUTH_WALL_SHAPE) + ); } @Override public int getModelStateCount() { - return 3750; + return 162; } @Override protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder.add()); + super.appendProperties(builder.add(UP, EAST_WALL_SHAPE, NORTH_WALL_SHAPE, SOUTH_WALL_SHAPE, WEST_WALL_SHAPE)); } @Override public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - Direction.Axis axis = ctx.getSide().getAxis(); - return super.getPlacementState(ctx); + BlockState state = super.getPlacementState(ctx); + World world = ctx.getWorld(); + BlockPos pos = ctx.getBlockPos(); + BlockState top_state = world.getBlockState(pos.up()); + boolean fs = top_state.isSideSolidFullSquare(world, pos.up(), Direction.DOWN); + VoxelShape top_shape = fs ? null : top_state.getCollisionShape(world, pos.up()).getFace(Direction.DOWN); + for (Direction dir : Direction.Type.HORIZONTAL) { + BlockState neighbor = world.getBlockState(pos.offset(dir)); + if (shouldConnectTo(neighbor, fs, dir.getOpposite())) { + state.with( + getWallShape(dir), + fs || shouldUseTall(WALL_VOXELS[dir.ordinal() + 3], top_shape) + ? WallShape.TALL + : WallShape.LOW + ); + } + } + return state.with(UP, shouldHavePost(state, top_state, top_shape)); } @Override - public BlockStateSupplier getMultipart() { - return null; // TODO unleash hell + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + VoxelShape shape = state.get(UP) ? WALL_VOXELS[0]: VoxelShapes.empty(); + for (Direction dir : Direction.Type.HORIZONTAL) { + WallShape wall_shape = state.get(getWallShape(dir)); + if (wall_shape != WallShape.NONE) { +// System.out.println("wall_shape: " + wall_shape + " wall_shape.ordinal-1: " + (wall_shape.ordinal()-1) + " dir.ordinal() - 2: " + (dir.ordinal() - 2)); + shape = VoxelShapes.union(shape, WALL_VOXELS[1 + (wall_shape.ordinal()-1) * 4 + (dir.ordinal() - 2)]); + } + } + return shape; } - @Override - public void setRecipe(RecipeExporter exporter) { - RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, this, ReFramed.CUBE, 2); - ShapedRecipeJsonBuilder - .create(RecipeCategory.BUILDING_BLOCKS, this, 4) - .pattern("III") - .pattern("III") - .input('I', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); + private static boolean shouldHavePost(BlockState state, BlockState top_state, VoxelShape top_shape) { + // above has post + if (top_state.contains(NORTH_WALL_SHAPE) && top_state.get(UP)) return true; + + if (Stream.of(Direction.SOUTH, Direction.EAST) // Opposites are different + .anyMatch(dir -> state.get(getWallShape(dir)) != state.get(getWallShape(dir.getOpposite()))) + ) return true; + + // no sides + if (Direction.Type.HORIZONTAL.stream().allMatch(dir -> state.get(getWallShape(dir)) == WallShape.NONE)) + return true; + + // tall Matching sides + if (Stream.of(Direction.SOUTH, Direction.EAST) + .anyMatch(dir -> + state.get(getWallShape(dir)) == WallShape.TALL + && state.get(getWallShape(dir.getOpposite())) == WallShape.TALL + )) return false; + + return top_state.isIn(BlockTags.WALL_POST_OVERRIDE) || top_shape == null || shouldUseTall(WALL_VOXELS[0], top_shape); + } + + private static boolean shouldConnectTo(BlockState state, boolean faceFullSquare, Direction side) { + Block block = state.getBlock(); + boolean bl = block instanceof FenceGateBlock && FenceGateBlock.canWallConnect(state, side); + return state.isIn(BlockTags.WALLS) || !WallBlock.cannotConnect(state) && faceFullSquare || block instanceof PaneBlock || bl; + } + + private static boolean shouldUseTall(VoxelShape self_shape, VoxelShape other_shape) { + return !VoxelShapes.matchesAnywhere( + self_shape, + other_shape, + BooleanBiFunction.ONLY_FIRST + ); + } + + private static Property getWallShape(Direction dir) { + return switch (dir) { + case EAST -> EAST_WALL_SHAPE; + case NORTH -> NORTH_WALL_SHAPE; + case WEST -> WEST_WALL_SHAPE; + case SOUTH -> SOUTH_WALL_SHAPE; + default -> null; + }; + } + + static { + VoxelShape POST = createCuboidShape(4, 0, 4, 12, 16, 12); + VoxelShape LOW = createCuboidShape(5, 0, 0, 11, 14, 8); + VoxelShape TALL = createCuboidShape(5, 0, 0, 11, 16, 8); + WALL_VOXELS = VoxelHelper.VoxelListBuilder.create(POST, 9) + .add(LOW) + .add(VoxelHelper::mirrorZ) + .add(VoxelHelper::rotateY) + .add(VoxelHelper::mirrorX) + .add(TALL) + .add(VoxelHelper::mirrorZ) + .add(VoxelHelper::rotateY) + .add(VoxelHelper::mirrorX) + .build(); } } diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 9b9b610..9cfd84a 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -78,37 +78,28 @@ public class ReFramedClient implements ClientModInitializer { // WALL HELPER.addReFramedModel("wall_inventory" , HELPER.auto(ReFramed.id("block/wall/inventory/default"))); // --------------------- pillar - HELPER.addReFramedModel("wall_core" , HELPER.auto(ReFramed.id("block/wall/pillar/core"))); // shares AXIS only - HELPER.addReFramedModel("wall_pillar_none" , HELPER.auto(ReFramed.id("block/wall/pillar/none"))); // only shape_none (4 * 3 axis) - HELPER.addReFramedModel("wall_pillar_negative" , HELPER.auto(ReFramed.id("block/wall/pillar/bottom"))); - HELPER.addReFramedModel("wall_pillar_both" , HELPER.auto(ReFramed.id("block/wall/pillar/both"))); - HELPER.addReFramedModel("wall_pillar_positive" , HELPER.auto(ReFramed.id("block/wall/pillar/top"))); - HELPER.addReFramedModel("wall_pillar_middle" , HELPER.auto(ReFramed.id("block/wall/pillar/middle"))); + HELPER.addReFramedModel("wall_core" , HELPER.auto(ReFramed.id("block/wall/pillar/core"))); + HELPER.addReFramedModel("wall_pillar_low" , HELPER.auto(ReFramed.id("block/wall/pillar/low"))); + HELPER.addReFramedModel("wall_pillar_tall" , HELPER.auto(ReFramed.id("block/wall/pillar/tall"))); + HELPER.addReFramedModel("wall_pillar_none" , HELPER.auto(ReFramed.id("block/wall/pillar/none"))); // --------------------- side - HELPER.addReFramedModel("wall_side_negative" , HELPER.auto(ReFramed.id("block/wall/side/bottom"))); - HELPER.addReFramedModel("wall_side_both" , HELPER.auto(ReFramed.id("block/wall/side/both"))); - HELPER.addReFramedModel("wall_side_positive" , HELPER.auto(ReFramed.id("block/wall/side/top"))); - HELPER.addReFramedModel("wall_side_middle" , HELPER.auto(ReFramed.id("block/wall/side/middle"))); + HELPER.addReFramedModel("wall_side_low" , HELPER.auto(ReFramed.id("block/wall/side/low"))); + HELPER.addReFramedModel("wall_side_tall" , HELPER.auto(ReFramed.id("block/wall/side/tall"))); // --------------------- junction - HELPER.addReFramedModel("wall_junction_negative" , HELPER.auto(ReFramed.id("block/wall/junction/bottom"))); // (4 * 3) possible - HELPER.addReFramedModel("wall_junction_both" , HELPER.auto(ReFramed.id("block/wall/junction/both"))); - HELPER.addReFramedModel("wall_junction_positive" , HELPER.auto(ReFramed.id("block/wall/junction/top"))); - HELPER.addReFramedModel("wall_junction_middle" , HELPER.auto(ReFramed.id("block/wall/junction/middle"))); - // --------------------- junction_c - HELPER.addReFramedModel("wall_junction_negative_c" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_c"))); - HELPER.addReFramedModel("wall_junction_both_c" , HELPER.auto(ReFramed.id("block/wall/junction/both_c"))); - HELPER.addReFramedModel("wall_junction_positive_c" , HELPER.auto(ReFramed.id("block/wall/junction/top_c"))); - HELPER.addReFramedModel("wall_junction_middle_c" , HELPER.auto(ReFramed.id("block/wall/junction/middle_c"))); + HELPER.addReFramedModel("wall_low_e" , HELPER.auto(ReFramed.id("block/wall/junction/low"))); + HELPER.addReFramedModel("wall_tall_e" , HELPER.auto(ReFramed.id("block/wall/junction/tall"))); // --------------------- junction_i - HELPER.addReFramedModel("wall_junction_negative_i" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_i"))); - HELPER.addReFramedModel("wall_junction_both_i" , HELPER.auto(ReFramed.id("block/wall/junction/both_i"))); - HELPER.addReFramedModel("wall_junction_positive_i" , HELPER.auto(ReFramed.id("block/wall/junction/top_i"))); - HELPER.addReFramedModel("wall_junction_middle_i" , HELPER.auto(ReFramed.id("block/wall/junction/middle_i"))); + HELPER.addReFramedModel("wall_low_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_i"))); + HELPER.addReFramedModel("wall_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i"))); + HELPER.addReFramedModel("wall_low_tall_i" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_i"))); + // --------------------- junction_c + HELPER.addReFramedModel("wall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_c"))); + HELPER.addReFramedModel("wall_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c"))); + HELPER.addReFramedModel("wall_low_tall_c" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c"))); + HELPER.addReFramedModel("wall_tall_low_c" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c"))); // --------------------- junction_t - HELPER.addReFramedModel("wall_junction_negative_t" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_t"))); - HELPER.addReFramedModel("wall_junction_both_t" , HELPER.auto(ReFramed.id("block/wall/junction/both_t"))); - HELPER.addReFramedModel("wall_junction_positive_t" , HELPER.auto(ReFramed.id("block/wall/junction/top_t"))); - HELPER.addReFramedModel("wall_junction_middle_t" , HELPER.auto(ReFramed.id("block/wall/junction/middle_t"))); + HELPER.addReFramedModel("wall_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_t"))); + HELPER.addReFramedModel("wall_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t"))); // --------------------- junction_x HELPER.addReFramedModel("wall_junction_negative_x" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_x"))); // (Axis only) HELPER.addReFramedModel("wall_junction_both_x" , HELPER.auto(ReFramed.id("block/wall/junction/both_x"))); diff --git a/src/main/java/fr/adrien1106/reframed/generator/BlockStateProvider.java b/src/main/java/fr/adrien1106/reframed/generator/BlockStateProvider.java index 4c4b920..cf69ffe 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/BlockStateProvider.java +++ b/src/main/java/fr/adrien1106/reframed/generator/BlockStateProvider.java @@ -1,7 +1,8 @@ package fr.adrien1106.reframed.generator; +import net.minecraft.block.Block; import net.minecraft.data.client.BlockStateSupplier; public interface BlockStateProvider { - BlockStateSupplier getMultipart(); + BlockStateSupplier getMultipart(Block block); } diff --git a/src/main/java/fr/adrien1106/reframed/generator/GBlockTag.java b/src/main/java/fr/adrien1106/reframed/generator/GBlockTag.java index 9edd858..81aa5ac 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockTag.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockTag.java @@ -1,14 +1,23 @@ package fr.adrien1106.reframed.generator; import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.block.*; +import fr.adrien1106.reframed.generator.block.*; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.BlockTagProvider; +import net.minecraft.block.Block; import net.minecraft.registry.RegistryWrapper.WrapperLookup; import net.minecraft.registry.tag.BlockTags; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.CompletableFuture; public class GBlockTag extends BlockTagProvider { + private static final Map, TagGetter> providers = new HashMap<>(); + static { + providers.put(ReframedWallBlock.class, new Wall()); + } public GBlockTag(FabricDataOutput output, CompletableFuture registries) { super(output, registries); @@ -17,6 +26,10 @@ public class GBlockTag extends BlockTagProvider { @Override protected void configure(WrapperLookup arg) { FabricTagBuilder builder = getOrCreateTagBuilder(BlockTags.AXE_MINEABLE); - ReFramed.BLOCKS.forEach(builder::add); + ReFramed.BLOCKS.forEach((block) -> { + if (providers.containsKey(block.getClass())) + providers.get(block.getClass()).getTags().forEach((tag) -> getOrCreateTagBuilder(tag).add(block)); + builder.add(block); + }); } } diff --git a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java index f3711ed..7fffe04 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GBlockstate.java @@ -1,17 +1,39 @@ package fr.adrien1106.reframed.generator; import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.block.*; +import fr.adrien1106.reframed.generator.block.*; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; +import net.minecraft.block.Block; import net.minecraft.data.client.*; import net.minecraft.state.property.Property; import net.minecraft.util.Identifier; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import static net.minecraft.data.client.VariantSettings.Rotation.R0; public class GBlockstate extends FabricModelProvider { + private static final Map, BlockStateProvider> providers = new HashMap<>(); + static { + providers.put(ReFramedHalfStairBlock.class, new HalfStair()); + providers.put(ReFramedHalfStairsSlabBlock.class, new HalfStairsSlab()); + providers.put(ReFramedHalfStairsStairBlock.class, new HalfStairsStair()); + providers.put(ReFramedLayerBlock.class, new Layer()); + providers.put(ReFramedPillarBlock.class, new Pillar()); + providers.put(ReFramedSlabBlock.class, new Slab()); + providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); + providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); + providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); + providers.put(ReFramedStairBlock.class, new Stair()); + providers.put(ReFramedStairsCubeBlock.class, new StairsCube()); + providers.put(ReFramedStepBlock.class, new Step()); + providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); + providers.put(ReframedWallBlock.class, new Wall()); + } public GBlockstate(FabricDataOutput output) { super(output); @@ -23,7 +45,7 @@ public class GBlockstate extends FabricModelProvider { .forEach(model_generator::excludeFromSimpleItemModelGeneration); ReFramed.BLOCKS.stream() .map(block -> { - if (block instanceof BlockStateProvider multipart_block) return multipart_block.getMultipart(); + if (providers.containsKey(block.getClass())) return providers.get(block.getClass()).getMultipart(block); return VariantsBlockStateSupplier.create( block, GBlockstate.variant( @@ -54,11 +76,57 @@ public class GBlockstate extends FabricModelProvider { return When.create().set(property_1, value_1); } - public static , U extends Comparable> When when(Property property_1, T value_1, Property property_2, U value_2) { - return When.allOf(when(property_1, value_1), when(property_2, value_2)); + public static , + U extends Comparable> When when(Property property_1, T value_1, + Property property_2, U value_2) { + return When.allOf( + when(property_1, value_1), + when(property_2, value_2) + ); } - public static , U extends Comparable, V extends Comparable> When when(Property property_1, T value_1, Property property_2, U value_2, Property property_3, V value_3) { - return When.allOf(when(property_1, value_1), when(property_2, value_2), when(property_3, value_3)); + public static , + U extends Comparable, + V extends Comparable> When when(Property property_1, T value_1, + Property property_2, U value_2, + Property property_3, V value_3) { + return When.allOf( + when(property_1, value_1), + when(property_2, value_2), + when(property_3, value_3) + ); + } + + public static , + U extends Comparable, + V extends Comparable, + W extends Comparable> When when(Property property_1, T value_1, + Property property_2, U value_2, + Property property_3, V value_3, + Property property_4, W value_4) { + return When.allOf( + when(property_1, value_1), + when(property_2, value_2), + when(property_3, value_3), + when(property_4, value_4) + ); + } + + public static , + U extends Comparable, + V extends Comparable, + W extends Comparable, + X extends Comparable> When when(Property property_1, T value_1, + Property property_2, U value_2, + Property property_3, V value_3, + Property property_4, W value_4, + Property property_5, X value_5) { + return When.allOf( + when(property_1, value_1), + when(property_2, value_2), + when(property_3, value_3), + when(property_4, value_4), + when(property_5, value_5) + ); } } \ No newline at end of file diff --git a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java index db5181e..c1fbbd6 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java +++ b/src/main/java/fr/adrien1106/reframed/generator/GRecipe.java @@ -1,11 +1,45 @@ package fr.adrien1106.reframed.generator; import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.block.*; +import fr.adrien1106.reframed.generator.block.*; +import fr.adrien1106.reframed.generator.item.Blueprint; +import fr.adrien1106.reframed.generator.item.Hammer; +import fr.adrien1106.reframed.generator.item.Screwdriver; +import fr.adrien1106.reframed.item.ReFramedBlueprintItem; +import fr.adrien1106.reframed.item.ReFramedHammerItem; +import fr.adrien1106.reframed.item.ReFramedScrewdriverItem; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.item.ItemConvertible; + +import java.util.HashMap; +import java.util.Map; public class GRecipe extends FabricRecipeProvider { + private static final Map, RecipeSetter> providers = new HashMap<>(); + static { + providers.put(ReFramedBlock.class, new Cube()); + providers.put(ReFramedHalfStairBlock.class, new HalfStair()); + providers.put(ReFramedHalfStairsSlabBlock.class, new HalfStairsSlab()); + providers.put(ReFramedHalfStairsStairBlock.class, new HalfStairsStair()); + providers.put(ReFramedLayerBlock.class, new Layer()); + providers.put(ReFramedPillarBlock.class, new Pillar()); + providers.put(ReFramedSlabBlock.class, new Slab()); + providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube()); + providers.put(ReFramedSmallCubeBlock.class, new SmallCube()); + providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep()); + providers.put(ReFramedStairBlock.class, new Stair()); + providers.put(ReFramedStairsCubeBlock.class, new StairsCube()); + providers.put(ReFramedStepBlock.class, new Step()); + providers.put(ReFramedStepsSlabBlock.class, new StepsSlab()); + providers.put(ReframedWallBlock.class, new Wall()); + providers.put(ReFramedBlueprintItem.class, new Blueprint()); + providers.put(ReFramedHammerItem.class, new Hammer()); + providers.put(ReFramedScrewdriverItem.class, new Screwdriver()); + } + public GRecipe(FabricDataOutput output) { super(output); } @@ -13,10 +47,10 @@ public class GRecipe extends FabricRecipeProvider { @Override public void generate(RecipeExporter exporter) { ReFramed.BLOCKS.forEach(block -> { - if (block instanceof RecipeSetter provider) provider.setRecipe(exporter); + if (providers.containsKey(block.getClass())) providers.get(block.getClass()).setRecipe(exporter, block); }); ReFramed.ITEMS.forEach(item -> { - if (item instanceof RecipeSetter provider) provider.setRecipe(exporter); + if (providers.containsKey(item.getClass())) providers.get(item.getClass()).setRecipe(exporter, item); }); } } diff --git a/src/main/java/fr/adrien1106/reframed/generator/RecipeSetter.java b/src/main/java/fr/adrien1106/reframed/generator/RecipeSetter.java index 626104a..779215a 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/RecipeSetter.java +++ b/src/main/java/fr/adrien1106/reframed/generator/RecipeSetter.java @@ -1,8 +1,9 @@ package fr.adrien1106.reframed.generator; import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.item.ItemConvertible; public interface RecipeSetter { - void setRecipe(RecipeExporter exporter); + void setRecipe(RecipeExporter exporter, ItemConvertible convertible); } diff --git a/src/main/java/fr/adrien1106/reframed/generator/TagGetter.java b/src/main/java/fr/adrien1106/reframed/generator/TagGetter.java new file mode 100644 index 0000000..d4f0ce8 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/TagGetter.java @@ -0,0 +1,11 @@ +package fr.adrien1106.reframed.generator; + +import net.minecraft.block.Block; +import net.minecraft.registry.tag.TagKey; + +import java.util.List; + +public interface TagGetter { + + List> getTags(); +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Cube.java b/src/main/java/fr/adrien1106/reframed/generator/block/Cube.java new file mode 100644 index 0000000..ce41774 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Cube.java @@ -0,0 +1,26 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.Items; +import net.minecraft.recipe.book.RecipeCategory; + +public class Cube implements RecipeSetter { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .pattern("III") + .pattern("I~I") + .pattern("III") + .input('I', Items.BAMBOO) + .input('~', Items.STRING) + .criterion(FabricRecipeProvider.hasItem(Items.BAMBOO), FabricRecipeProvider.conditionsFromItem(Items.BAMBOO)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStair.java new file mode 100644 index 0000000..9bdafac --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStair.java @@ -0,0 +1,106 @@ +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.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.util.Identifier; + +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.*; +import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_UP; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class HalfStair 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, 4) + .pattern("I ") + .pattern("II") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + return getMultipart( + block, + ReFramed.id("half_stair_down_special"), + ReFramed.id("half_stair_side_special") + ); + } + + public static BlockStateSupplier getMultipart(Block block, Identifier model_down, Identifier model_side) { + return MultipartBlockStateSupplier.create(block) + .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R0, R0)) + .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R90, R270)) + .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R0, R0)) + + .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R0, R90)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R90, R0)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R0, R90)) + + .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R0, R180)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R90, R90)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R0, R180)) + + .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R0, R270)) + .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R90, R180)) + .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R0, R270)) + + .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R180, R0)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R270, R90)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_UP, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R180, R0)) + + .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R180, R90)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R270, R180)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_UP, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R180, R90)) + + .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R180, R180)) + .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R270, R270)) + .with(GBlockstate.when(CORNER, WEST_NORTH_UP, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R180, R180)) + + .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 0), + GBlockstate.variant(model_side, true, R180, R270)) + .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 1), + GBlockstate.variant(model_side, true, R270, R0)) + .with(GBlockstate.when(CORNER, NORTH_EAST_UP, CORNER_FACE, 2), + GBlockstate.variant(model_down, true, R180, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsSlab.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsSlab.java new file mode 100644 index 0000000..474b884 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsSlab.java @@ -0,0 +1,37 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.BlockStateSupplier; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.RecipeProvider; +import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; + +public class HalfStairsSlab implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.HALF_STAIR) + .input(ReFramed.SMALL_CUBE) + .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 HalfStair.getMultipart( + block, + ReFramed.id("half_stairs_slab_down_special"), + ReFramed.id("half_stairs_slab_side_special") + ); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStair.java b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStair.java new file mode 100644 index 0000000..78274e8 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/HalfStairsStair.java @@ -0,0 +1,70 @@ +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.WEST_DOWN; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class HalfStairsStair implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 2); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.HALF_STAIR, 2) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier model_id = ReFramed.id("half_stairs_stair_down_special"); + Identifier side_model_id = ReFramed.id("half_stairs_stair_side_special"); + Identifier reverse_model_id = ReFramed.id("half_stairs_stair_reverse_special"); + return MultipartBlockStateSupplier.create(block) + /* X AXIS */ + .with(GBlockstate.when(EDGE, NORTH_DOWN), + GBlockstate.variant(side_model_id, true, R90, R180)) + .with(GBlockstate.when(EDGE, DOWN_SOUTH), + GBlockstate.variant(side_model_id, true, R0, R180)) + .with(GBlockstate.when(EDGE, SOUTH_UP), + GBlockstate.variant(side_model_id, true, R270, R180)) + .with(GBlockstate.when(EDGE, UP_NORTH), + GBlockstate.variant(side_model_id, true, R180, R180)) + /* Y AXIS */ + .with(GBlockstate.when(EDGE, NORTH_EAST), + GBlockstate.variant(model_id, true, R0, R0)) + .with(GBlockstate.when(EDGE, EAST_SOUTH), + GBlockstate.variant(model_id, true, R0, R90)) + .with(GBlockstate.when(EDGE, SOUTH_WEST), + GBlockstate.variant(model_id, true, R0, R180)) + .with(GBlockstate.when(EDGE, WEST_NORTH), + GBlockstate.variant(model_id, true, R0, R270)) + /* Z AXIS */ + .with(GBlockstate.when(EDGE, DOWN_EAST), + GBlockstate.variant(reverse_model_id, true, R0, R90)) + .with(GBlockstate.when(EDGE, EAST_UP), + GBlockstate.variant(side_model_id, true, R180, R270)) + .with(GBlockstate.when(EDGE, UP_WEST), + GBlockstate.variant(reverse_model_id, true, R180, R90)) + .with(GBlockstate.when(EDGE, WEST_DOWN), + GBlockstate.variant(side_model_id, true, R0, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Layer.java b/src/main/java/fr/adrien1106/reframed/generator/block/Layer.java new file mode 100644 index 0000000..ba6fd83 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Layer.java @@ -0,0 +1,58 @@ +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.MultipartBlockStateSupplier; +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; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Direction; + +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.FACING; +import static net.minecraft.state.property.Properties.LAYERS; + +public class Layer implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 8); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 16) + .pattern("II") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public MultipartBlockStateSupplier getMultipart(Block block) { + String model_pattern = "layer_x_special"; + MultipartBlockStateSupplier supplier = MultipartBlockStateSupplier.create(block); + for (int i = 1; i <= 8; i++) { + Identifier model = ReFramed.id(model_pattern.replace("x", i + "")); + supplier + .with(GBlockstate.when(FACING, Direction.DOWN, LAYERS, i), + GBlockstate.variant(model, true, R0, R0)) + .with(GBlockstate.when(FACING, Direction.SOUTH, LAYERS, i), + GBlockstate.variant(model, true, R90, R0)) + .with(GBlockstate.when(FACING, Direction.UP, LAYERS, i), + GBlockstate.variant(model, true, R180, R0)) + .with(GBlockstate.when(FACING, Direction.NORTH, LAYERS, i), + GBlockstate.variant(model, true, R270, R0)) + .with(GBlockstate.when(FACING, Direction.WEST, LAYERS, i), + GBlockstate.variant(model, true, R90, R90)) + .with(GBlockstate.when(FACING, Direction.EAST, LAYERS, i), + GBlockstate.variant(model, true, R90, R270)); + } + return supplier; + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Pillar.java b/src/main/java/fr/adrien1106/reframed/generator/block/Pillar.java new file mode 100644 index 0000000..40326b9 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Pillar.java @@ -0,0 +1,49 @@ +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.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Direction; + +import static net.minecraft.data.client.VariantSettings.Rotation.R0; +import static net.minecraft.data.client.VariantSettings.Rotation.R90; +import static net.minecraft.state.property.Properties.AXIS; + +public class Pillar implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 8) + .pattern("I") + .pattern("I") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier model_id = ReFramed.id("pillar_special"); + return MultipartBlockStateSupplier.create(block) + .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)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java b/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java new file mode 100644 index 0000000..4f8bcdb --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Slab.java @@ -0,0 +1,52 @@ +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.MultipartBlockStateSupplier; +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; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Direction; + +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.FACING; + +public class Slab 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, 6) + .pattern("III") + .input('I', ReFramed.CUBE) + .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("slab_special"); + return MultipartBlockStateSupplier.create(block) + .with(GBlockstate.when(FACING, Direction.DOWN), + GBlockstate.variant(model_id, true, R0, R0)) + .with(GBlockstate.when(FACING, Direction.SOUTH), + GBlockstate.variant(model_id, true, R90, R0)) + .with(GBlockstate.when(FACING, Direction.UP), + GBlockstate.variant(model_id, true, R180, R0)) + .with(GBlockstate.when(FACING, Direction.NORTH), + GBlockstate.variant(model_id, true, R270, R0)) + .with(GBlockstate.when(FACING, Direction.WEST), + GBlockstate.variant(model_id, true, R90, R90)) + .with(GBlockstate.when(FACING, Direction.EAST), + GBlockstate.variant(model_id, true, R90, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SlabsCube.java b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsCube.java new file mode 100644 index 0000000..37f68b8 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SlabsCube.java @@ -0,0 +1,46 @@ +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.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 net.minecraft.util.math.Direction; + +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.data.client.VariantSettings.Rotation.R90; +import static net.minecraft.state.property.Properties.AXIS; + +public class SlabsCube 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.SLAB, 2) + .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("double_slab_special"); + return MultipartBlockStateSupplier.create(block) + .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, R270, R0)) + .with(GBlockstate.when(AXIS, Direction.Axis.X), + GBlockstate.variant(model_id, true, R90, R90)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SmallCube.java b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCube.java new file mode 100644 index 0000000..d2b900d --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCube.java @@ -0,0 +1,57 @@ +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.CORNER; +import static fr.adrien1106.reframed.util.blocks.Corner.*; +import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_UP; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class SmallCube implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 8); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 8) + .input(ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier small_cube_id = ReFramed.id("small_cube_special"); + return MultipartBlockStateSupplier.create(block) + .with(GBlockstate.when(CORNER, NORTH_EAST_DOWN), + GBlockstate.variant(small_cube_id, true, R0, R0)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_DOWN), + GBlockstate.variant(small_cube_id, true, R0, R90)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_DOWN), + GBlockstate.variant(small_cube_id, true, R0, R180)) + .with(GBlockstate.when(CORNER, WEST_NORTH_DOWN), + GBlockstate.variant(small_cube_id, true, R0, R270)) + .with(GBlockstate.when(CORNER, EAST_SOUTH_UP), + GBlockstate.variant(small_cube_id, true, R180, R0)) + .with(GBlockstate.when(CORNER, SOUTH_WEST_UP), + GBlockstate.variant(small_cube_id, true, R180, R90)) + .with(GBlockstate.when(CORNER, WEST_NORTH_UP), + GBlockstate.variant(small_cube_id, true, R180, R180)) + .with(GBlockstate.when(CORNER, NORTH_EAST_UP), + GBlockstate.variant(small_cube_id, true, R180, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java new file mode 100644 index 0000000..c7c547e --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/SmallCubesStep.java @@ -0,0 +1,69 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.generator.GBlockstate; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.BlockStateSupplier; +import net.minecraft.data.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 { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4); + ShapelessRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.SMALL_CUBE, 2) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier 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)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Stair.java b/src/main/java/fr/adrien1106/reframed/generator/block/Stair.java new file mode 100644 index 0000000..9b46bfa --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Stair.java @@ -0,0 +1,267 @@ +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.MultipartBlockStateSupplier; +import net.minecraft.data.client.When; +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; +import net.minecraft.util.Identifier; + +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.Edge.*; +import static fr.adrien1106.reframed.util.blocks.StairShape.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; + +public class Stair implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 4) + .pattern("I ") + .pattern("II ") + .pattern("III") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public MultipartBlockStateSupplier getMultipart(Block block) { + return getMultipart(block, false); + } + + public static MultipartBlockStateSupplier getMultipart(Block block, boolean is_double) { + String infix = is_double ? "s_cube" : ""; + Identifier straight_id = ReFramed.id("stair" + infix + "_special"); + Identifier double_outer_id = ReFramed.id("outers_stair" + infix + "_special"); + Identifier inner_id = ReFramed.id("inner_stair" + infix + "_special"); + Identifier outer_id = ReFramed.id("outer_stair" + infix + "_special"); + Identifier outer_side_id = ReFramed.id("outer_side_stair" + infix + "_special"); + return MultipartBlockStateSupplier.create(block) + /* STRAIGHT X AXIS */ + .with(GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R0, R0)) + .with(GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R180, R0)) + .with(GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R180, R180)) + .with(GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R0, R180)) + /* STRAIGHT Y AXIS */ + .with(GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R90, R0)) + .with(GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R90, R90)) + .with(GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R90, R180)) + .with(GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R90, R270)) + /* STRAIGHT Z AXIS */ + .with(GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R0, R90)) + .with(GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R0, R270)) + .with(GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R180, R270)) + .with(GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, STRAIGHT), + GBlockstate.variant(straight_id, true, R180, R90)) + /* INNER BOTTOM */ + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.variant(inner_id, true, R0, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.variant(inner_id, true, R0, R270)) + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.variant(inner_id, true, R0, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.variant(inner_id, true, R0, R90)) + /* INNER TOP */ + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.variant(inner_id, true, R180, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.variant(inner_id, true, R180, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)), + GBlockstate.variant(inner_id, true, R180, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_RIGHT), + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_LEFT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)), + GBlockstate.variant(inner_id, true, R180, R270)) + /* OUTER BOTTOM */ + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_id, true, R0, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_id, true, R0, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_id, true, R0, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_id, true, R0, R270)) + /* OUTER TOP */ + .with(When.anyOf( + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_id, true, R180, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_id, true, R180, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_id, true, R180, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_id, true, R180, R270)) + /* OUTER EAST */ + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R0, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R90, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R180, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R270, R0)) + /* OUTER SOUTH */ + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R0, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R90, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R180, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R270, R90)) + /* OUTER WEST */ + .with(When.anyOf( + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R0, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R90, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R180, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R270, R180)) + /* OUTER NORTH */ + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT), + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R0, R270)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT), + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, FIRST_OUTER_LEFT)), + GBlockstate.variant(outer_side_id, true, R90, R270)) + .with(When.anyOf( + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, FIRST_OUTER_LEFT), + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, FIRST_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R180, R270)) + .with(When.anyOf( + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, FIRST_OUTER_RIGHT), + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)), + GBlockstate.variant(outer_side_id, true, R270, R270)) + /* OUTER BOTTOM */ + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_RIGHT)), + GBlockstate.variant(double_outer_id, true, R0, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_RIGHT)), + GBlockstate.variant(double_outer_id, true, R0, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_RIGHT)), + GBlockstate.variant(double_outer_id, true, R0, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_RIGHT)), + GBlockstate.variant(double_outer_id, true, R0, R270)) + /* OUTER TOP */ + .with(When.anyOf( + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_LEFT)), + GBlockstate.variant(double_outer_id, true, R180, R0)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_LEFT)), + GBlockstate.variant(double_outer_id, true, R180, R90)) + .with(When.anyOf( + GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT), + GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_LEFT)), + GBlockstate.variant(double_outer_id, true, R180, R180)) + .with(When.anyOf( + GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT), + GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_LEFT)), + GBlockstate.variant(double_outer_id, true, R180, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/StairsCube.java b/src/main/java/fr/adrien1106/reframed/generator/block/StairsCube.java new file mode 100644 index 0000000..8b45101 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/StairsCube.java @@ -0,0 +1,33 @@ +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.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; + +public class StairsCube 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.STAIR) + .input(ReFramed.STEP) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public MultipartBlockStateSupplier getMultipart(Block block) { + return Stair.getMultipart(block, true); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Step.java b/src/main/java/fr/adrien1106/reframed/generator/block/Step.java new file mode 100644 index 0000000..0bd28a9 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Step.java @@ -0,0 +1,69 @@ +package fr.adrien1106.reframed.generator.block; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.BlockStateProvider; +import fr.adrien1106.reframed.generator.GBlockstate; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.block.Block; +import net.minecraft.data.client.BlockStateSupplier; +import net.minecraft.data.client.MultipartBlockStateSupplier; +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; +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 Step implements RecipeSetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 4); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 8) + .pattern("II") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier model_id = ReFramed.id("step_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)) + .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)) + /* 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(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)) + .with(GBlockstate.when(EDGE, SOUTH_UP), + GBlockstate.variant(model_id, true, R180, R90)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java b/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java new file mode 100644 index 0000000..e2bc29b --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/StepsSlab.java @@ -0,0 +1,66 @@ +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.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 net.minecraft.util.math.Direction; + +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.data.client.VariantSettings.Rotation.R270; +import static net.minecraft.state.property.Properties.AXIS; +import static net.minecraft.state.property.Properties.FACING; + +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 + .create(RecipeCategory.BUILDING_BLOCKS, convertible) + .input(ReFramed.STEP, 2) + .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 step_id = ReFramed.id("steps_slab_special"); + Identifier step_side_id = ReFramed.id("steps_slab_side_special"); + return MultipartBlockStateSupplier.create(block) + .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Direction.Axis.X), + GBlockstate.variant(step_id, true, R0, R180)) + .with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Direction.Axis.Z), + GBlockstate.variant(step_id, true, R0, R270)) + .with(GBlockstate.when(FACING, Direction.UP, AXIS, Direction.Axis.X), + GBlockstate.variant(step_id, true, R180, R180)) + .with(GBlockstate.when(FACING, Direction.UP, AXIS, Direction.Axis.Z), + GBlockstate.variant(step_id, true, R180, R270)) + .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Direction.Axis.Z), + GBlockstate.variant(step_side_id, true, R0, R0)) + .with(GBlockstate.when(FACING, Direction.EAST, AXIS, Direction.Axis.Y), + GBlockstate.variant(step_side_id, true, R90, R0)) + .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Direction.Axis.X), + GBlockstate.variant(step_side_id, true, R180, R90)) + .with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Direction.Axis.Y), + GBlockstate.variant(step_side_id, true, R90, R90)) + .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Direction.Axis.Z), + GBlockstate.variant(step_side_id, true, R180, R180)) + .with(GBlockstate.when(FACING, Direction.WEST, AXIS, Direction.Axis.Y), + GBlockstate.variant(step_side_id, true, R90, R180)) + .with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Direction.Axis.X), + GBlockstate.variant(step_side_id, true, R0, R270)) + .with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Direction.Axis.Y), + GBlockstate.variant(step_side_id, true, R90, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java b/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java new file mode 100644 index 0000000..49bfb2a --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java @@ -0,0 +1,446 @@ +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.generator.TagGetter; +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.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +import java.util.List; + +import static net.minecraft.block.enums.WallShape.*; +import static net.minecraft.data.client.VariantSettings.Rotation.*; +import static net.minecraft.state.property.Properties.*; + +public class Wall implements RecipeSetter, TagGetter, BlockStateProvider { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE, 1); + ShapedRecipeJsonBuilder + .create(RecipeCategory.BUILDING_BLOCKS, convertible, 4) + .pattern("III") + .pattern("III") + .input('I', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } + + @Override + public List> getTags() { + return List.of(BlockTags.WALLS); + } + + @Override + public BlockStateSupplier getMultipart(Block block) { + Identifier side_low = ReFramed.id("wall_side_low_special"); + Identifier side_tall = ReFramed.id("wall_side_tall_special"); + Identifier pillar_low = ReFramed.id("wall_pillar_low_special"); + Identifier pillar_tall = ReFramed.id("wall_pillar_tall_special"); + Identifier pillar_none = ReFramed.id("wall_pillar_none_special"); + Identifier low_e = ReFramed.id("wall_low_e_special"); + Identifier tall_e = ReFramed.id("wall_tall_e_special"); + Identifier low_i = ReFramed.id("wall_low_i_special"); + Identifier tall_i = ReFramed.id("wall_tall_i_special"); + Identifier low_tall_i = ReFramed.id("wall_low_tall_i_special"); + Identifier low_c = ReFramed.id("wall_low_c_special"); + Identifier tall_c = ReFramed.id("wall_tall_c_special"); + Identifier low_tall_c = ReFramed.id("wall_low_tall_c_special"); + Identifier tall_low_c = ReFramed.id("wall_tall_low_c_special"); + Identifier low_t = ReFramed.id("wall_low_t_special"); + Identifier tall_t = ReFramed.id("wall_tall_t_special"); + return MultipartBlockStateSupplier.create(block) + // PILLAR CORE + .with(GBlockstate.when(UP, true), + GBlockstate.variant(ReFramed.id("wall_core_special"), true, R0, R0)) + // LOW + .with(GBlockstate.when(NORTH_WALL_SHAPE, LOW), + GBlockstate.variant(side_low, true, R0, R0)) + .with(GBlockstate.when(EAST_WALL_SHAPE, LOW), + GBlockstate.variant(side_low, true, R0, R90)) + .with(GBlockstate.when(SOUTH_WALL_SHAPE, LOW), + GBlockstate.variant(side_low, true, R0, R180)) + .with(GBlockstate.when(WEST_WALL_SHAPE, LOW), + GBlockstate.variant(side_low, true, R0, R270)) + // TALL + .with(GBlockstate.when(NORTH_WALL_SHAPE, TALL), + GBlockstate.variant(side_tall, true, R0, R0)) + .with(GBlockstate.when(EAST_WALL_SHAPE, TALL), + GBlockstate.variant(side_tall, true, R0, R90)) + .with(GBlockstate.when(SOUTH_WALL_SHAPE, TALL), + GBlockstate.variant(side_tall, true, R0, R180)) + .with(GBlockstate.when(WEST_WALL_SHAPE, TALL), + GBlockstate.variant(side_tall, true, R0, R270)) + // PILLAR LOW + .with(GBlockstate.when(NORTH_WALL_SHAPE, LOW, UP, true), + GBlockstate.variant(pillar_low, true, R0, R0)) + .with(GBlockstate.when(EAST_WALL_SHAPE, LOW, UP, true), + GBlockstate.variant(pillar_low, true, R0, R90)) + .with(GBlockstate.when(SOUTH_WALL_SHAPE, LOW, UP, true), + GBlockstate.variant(pillar_low, true, R0, R180)) + .with(GBlockstate.when(WEST_WALL_SHAPE, LOW, UP, true), + GBlockstate.variant(pillar_low, true, R0, R270)) + // PILLAR TALL + .with(GBlockstate.when(NORTH_WALL_SHAPE, TALL, UP, true), + GBlockstate.variant(pillar_tall, true, R0, R0)) + .with(GBlockstate.when(EAST_WALL_SHAPE, TALL, UP, true), + GBlockstate.variant(pillar_tall, true, R0, R90)) + .with(GBlockstate.when(SOUTH_WALL_SHAPE, TALL, UP, true), + GBlockstate.variant(pillar_tall, true, R0, R180)) + .with(GBlockstate.when(WEST_WALL_SHAPE, TALL, UP, true), + GBlockstate.variant(pillar_tall, true, R0, R270)) + // PILLAR NONE + .with(GBlockstate.when(NORTH_WALL_SHAPE, NONE, UP, true), + GBlockstate.variant(pillar_none, true, R0, R0)) + .with(GBlockstate.when(EAST_WALL_SHAPE, NONE, UP, true), + GBlockstate.variant(pillar_none, true, R0, R90)) + .with(GBlockstate.when(SOUTH_WALL_SHAPE, NONE, UP, true), + GBlockstate.variant(pillar_none, true, R0, R180)) + .with(GBlockstate.when(WEST_WALL_SHAPE, NONE, UP, true), + GBlockstate.variant(pillar_none, true, R0, R270)) + // JUNCTION LOW + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_e, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_e, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_e, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_e, true, R0, R270)) + // JUNCTION TALL + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_e, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_e, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_e, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_e, true, R0, R270)) + // JUNCTION LOW I + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_i, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_i, true, R0, R90)) + // JUNCTION TALL I + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_i, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_i, true, R0, R90)) + // JUNCTION LOW TALL I + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_tall_i, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_tall_i, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_tall_i, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_tall_i, true, R0, R270)) + // JUNCTION LOW C + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_c, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_c, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_c, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_c, true, R0, R270)) + // JUNCTION TALL C + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_c, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_c, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c, true, R0, R270)) + // JUNCTION LOW TALL C + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_tall_c, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_tall_c, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_tall_c, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_tall_c, true, R0, R270)) + // JUNCTION TALL LOW C + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_c, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_low_c, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_low_c, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_low_c, true, R0, R270)) + // JUNCTION LOW T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_t, true, R0, R270)) + // JUNCTION TALL T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t, true, R0, R270)); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/item/Blueprint.java b/src/main/java/fr/adrien1106/reframed/generator/item/Blueprint.java new file mode 100644 index 0000000..3d3860d --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/item/Blueprint.java @@ -0,0 +1,25 @@ +package fr.adrien1106.reframed.generator.item; + +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.Items; +import net.minecraft.recipe.book.RecipeCategory; + +public class Blueprint implements RecipeSetter { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + ShapedRecipeJsonBuilder + .create(RecipeCategory.TOOLS, convertible, 3) + .pattern("PI") + .pattern("PP") + .input('P', Items.PAPER) + .input('I', Items.INK_SAC) + .criterion(FabricRecipeProvider.hasItem(Items.PAPER), FabricRecipeProvider.conditionsFromItem(Items.PAPER)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/item/Hammer.java b/src/main/java/fr/adrien1106/reframed/generator/item/Hammer.java new file mode 100644 index 0000000..2c4aca0 --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/item/Hammer.java @@ -0,0 +1,28 @@ +package fr.adrien1106.reframed.generator.item; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.Items; +import net.minecraft.recipe.book.RecipeCategory; + +public class Hammer implements RecipeSetter { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + ShapedRecipeJsonBuilder + .create(RecipeCategory.TOOLS, convertible) + .pattern(" CI") + .pattern(" ~C") + .pattern("~ ") + .input('I', Items.IRON_INGOT) + .input('C', ReFramed.CUBE) + .input('~', Items.STICK) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/generator/item/Screwdriver.java b/src/main/java/fr/adrien1106/reframed/generator/item/Screwdriver.java new file mode 100644 index 0000000..619f02b --- /dev/null +++ b/src/main/java/fr/adrien1106/reframed/generator/item/Screwdriver.java @@ -0,0 +1,27 @@ +package fr.adrien1106.reframed.generator.item; + +import fr.adrien1106.reframed.ReFramed; +import fr.adrien1106.reframed.generator.RecipeSetter; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.Items; +import net.minecraft.recipe.book.RecipeCategory; + +public class Screwdriver implements RecipeSetter { + + @Override + public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) { + ShapedRecipeJsonBuilder + .create(RecipeCategory.TOOLS, convertible) + .pattern(" I") + .pattern(" I ") + .pattern("C ") + .input('I', Items.IRON_INGOT) + .input('C', ReFramed.CUBE) + .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) + .criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible)) + .offerTo(exporter); + } +} diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java index 3530eb6..5e89e31 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedBlueprintItem.java @@ -2,23 +2,17 @@ package fr.adrien1106.reframed.item; import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.block.ReFramedEntity; -import fr.adrien1106.reframed.generator.RecipeSetter; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.Blocks; -import net.minecraft.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.Items; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.ActionResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ReFramedBlueprintItem extends Item implements RecipeSetter { +public class ReFramedBlueprintItem extends Item { public ReFramedBlueprintItem(Settings settings) { super(settings); } @@ -39,17 +33,4 @@ public class ReFramedBlueprintItem extends Item implements RecipeSetter { return ActionResult.SUCCESS; } - - @Override - public void setRecipe(RecipeExporter exporter) { - ShapedRecipeJsonBuilder - .create(RecipeCategory.TOOLS, this, 3) - .pattern("PI") - .pattern("PP") - .input('P', Items.PAPER) - .input('I', Items.INK_SAC) - .criterion(FabricRecipeProvider.hasItem(Items.PAPER), FabricRecipeProvider.conditionsFromItem(Items.PAPER)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java index 06e0bca..b3a1f83 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedHammerItem.java @@ -2,26 +2,20 @@ package fr.adrien1106.reframed.item; import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.block.ReFramedDoubleBlock; -import fr.adrien1106.reframed.generator.RecipeSetter; import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.Items; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.ActionResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class ReFramedHammerItem extends Item implements RecipeSetter { +public class ReFramedHammerItem extends Item { public ReFramedHammerItem(Settings settings) { super(settings); } @@ -52,19 +46,4 @@ public class ReFramedHammerItem extends Item implements RecipeSetter { ReFramed.chunkRerenderProxy.accept(world, pos); return ActionResult.SUCCESS; } - - @Override - public void setRecipe(RecipeExporter exporter) { - ShapedRecipeJsonBuilder - .create(RecipeCategory.TOOLS, this) - .pattern(" CI") - .pattern(" ~C") - .pattern("~ ") - .input('I', Items.IRON_INGOT) - .input('C', ReFramed.CUBE) - .input('~', Items.STICK) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java index 9748477..b39b06c 100644 --- a/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java +++ b/src/main/java/fr/adrien1106/reframed/item/ReFramedScrewdriverItem.java @@ -2,17 +2,11 @@ package fr.adrien1106.reframed.item; import fr.adrien1106.reframed.ReFramed; import fr.adrien1106.reframed.block.ReFramedDoubleBlock; -import fr.adrien1106.reframed.generator.RecipeSetter; import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.minecraft.block.BlockState; -import net.minecraft.data.server.recipe.RecipeExporter; -import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.Items; -import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; import net.minecraft.state.property.Properties; @@ -21,7 +15,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -public class ReFramedScrewdriverItem extends Item implements RecipeSetter { +public class ReFramedScrewdriverItem extends Item { public ReFramedScrewdriverItem(Settings settings) { super(settings); @@ -61,18 +55,4 @@ public class ReFramedScrewdriverItem extends Item implements RecipeSetter { ReFramed.chunkRerenderProxy.accept(world, pos); return ActionResult.SUCCESS; } - - @Override - public void setRecipe(RecipeExporter exporter) { - ShapedRecipeJsonBuilder - .create(RecipeCategory.TOOLS, this) - .pattern(" I") - .pattern(" I ") - .pattern("C ") - .input('I', Items.IRON_INGOT) - .input('C', ReFramed.CUBE) - .criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE)) - .criterion(FabricRecipeProvider.hasItem(this), FabricRecipeProvider.conditionsFromItem(this)) - .offerTo(exporter); - } } diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/low.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/full/pillar/bottom.json rename to src/main/resources/assets/reframed/models/block/wall/full/pillar/low.json diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json deleted file mode 100644 index 2b04647..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/full/pillar/middle.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [4, 2, 4], - "to": [5, 14, 5], - "faces": { - "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 5, 14], "texture": "#side"} - } - }, - { - "from": [4, 14, 4], - "to": [11, 16, 5], - "faces": { - "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, - "up": {"uv": [4, 4, 11, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [4, 0, 4], - "to": [11, 2, 5], - "faces": { - "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, - "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, - "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} - } - }, - { - "from": [5, 2, 4], - "to": [11, 14, 5], - "faces": { - "north": {"uv": [5, 2, 11, 14], "texture": "#side"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/tall.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/full/pillar/both.json rename to src/main/resources/assets/reframed/models/block/wall/full/pillar/tall.json diff --git a/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json b/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json deleted file mode 100644 index 14a43c5..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/full/pillar/top.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [4, 2, 4], - "to": [5, 16, 5], - "faces": { - "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [5, 2, 4], - "to": [11, 16, 5], - "faces": { - "north": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [4, 0, 4], - "to": [11, 2, 5], - "faces": { - "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, - "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, - "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json b/src/main/resources/assets/reframed/models/block/wall/full/side/low.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/full/side/bottom.json rename to src/main/resources/assets/reframed/models/block/wall/full/side/low.json diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json b/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json deleted file mode 100644 index ccc7071..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/full/side/middle.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 0], - "to": [11, 14, 4], - "faces": { - "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, - "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, - "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, - "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, - "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, - "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/both.json b/src/main/resources/assets/reframed/models/block/wall/full/side/tall.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/full/side/both.json rename to src/main/resources/assets/reframed/models/block/wall/full/side/tall.json diff --git a/src/main/resources/assets/reframed/models/block/wall/full/side/top.json b/src/main/resources/assets/reframed/models/block/wall/full/side/top.json deleted file mode 100644 index 3b64a55..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/full/side/top.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 0], - "to": [11, 16, 4], - "faces": { - "north": {"uv": [5, 0, 11, 14], "texture": "#side", "cullface": "north"}, - "east": {"uv": [12, 0, 16, 14], "texture": "#side"}, - "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "west": {"uv": [0, 0, 4, 14], "texture": "#side"}, - "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/inventory/default.json b/src/main/resources/assets/reframed/models/block/wall/inventory/default.json index f49e0d9..0422a4d 100644 --- a/src/main/resources/assets/reframed/models/block/wall/inventory/default.json +++ b/src/main/resources/assets/reframed/models/block/wall/inventory/default.json @@ -6,23 +6,23 @@ }, "elements": [ { - "from": [5, 2, 0], + "from": [5, 0, 0], "to": [11, 14, 4], "faces": { - "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, - "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, - "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, + "north": {"uv": [5, 2, 11, 16], "texture": "#side", "cullface": "north"}, + "east": {"uv": [12, 2, 16, 16], "texture": "#side"}, + "west": {"uv": [0, 2, 4, 16], "texture": "#side"}, "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} } }, { - "from": [5, 2, 12], + "from": [5, 0, 12], "to": [11, 14, 16], "faces": { - "east": {"uv": [0, 2, 4, 14], "texture": "#side"}, - "south": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "south"}, - "west": {"uv": [12, 2, 16, 14], "texture": "#side"}, + "east": {"uv": [0, 2, 4, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 16], "texture": "#side", "cullface": "south"}, + "west": {"uv": [12, 2, 16, 16], "texture": "#side"}, "up": {"uv": [5, 12, 11, 16], "texture": "#top"}, "down": {"uv": [5, 0, 11, 4], "texture": "#bottom"} } diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom.json b/src/main/resources/assets/reframed/models/block/wall/junction/low.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/bottom.json rename to src/main/resources/assets/reframed/models/block/wall/junction/low.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_c.json similarity index 51% rename from src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json rename to src/main/resources/assets/reframed/models/block/wall/junction/low_c.json index 589682a..d159c80 100644 --- a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_c.json +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_c.json @@ -16,13 +16,31 @@ } }, { - "from": [5, 0, 5], - "to": [11, 14, 11], + "from": [8, 0, 5], + "to": [11, 14, 8], "faces": { - "east": {"uv": [5, 2, 11, 16], "texture": "#side"}, - "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + "east": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 8], "texture": "#top"}, + "down": {"uv": [8, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 14, 11], + "faces": { + "east": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 8], + "faces": { + "up": {"uv": [5, 5, 8, 8], "texture": "#top"}, + "down": {"uv": [5, 8, 8, 11], "texture": "#bottom", "cullface": "down"} } }, { diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_i.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/bottom_i.json rename to src/main/resources/assets/reframed/models/block/wall/junction/low_i.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_t.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/bottom_t.json rename to src/main/resources/assets/reframed/models/block/wall/junction/low_t.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c.json new file mode 100644 index 0000000..334552a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c.json @@ -0,0 +1,65 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 14, 8], + "faces": { + "east": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 8], "texture": "#top"}, + "down": {"uv": [8, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 8], + "faces": { + "north": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "east": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 16, 11], + "faces": { + "east": {"uv": [5, 0, 8, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 8], + "faces": { + "down": {"uv": [5, 8, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_i.json new file mode 100644 index 0000000..de9921a --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_i.json @@ -0,0 +1,38 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 8], + "faces": { + "east": {"uv": [8, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 8], "texture": "#top"}, + "down": {"uv": [5, 8, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 8], + "to": [11, 16, 12], + "faces": { + "north": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "east": {"uv": [4, 0, 8, 2], "texture": "#side"}, + "west": {"uv": [8, 0, 12, 2], "texture": "#side"}, + "up": {"uv": [5, 8, 11, 12], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 8], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 8, 16], "texture": "#side"}, + "west": {"uv": [8, 2, 12, 16], "texture": "#side"}, + "down": {"uv": [5, 4, 11, 8], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle.json deleted file mode 100644 index 0957db9..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/middle.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 14, 8], - "faces": { - "east": {"uv": [8, 2, 12, 14], "texture": "#side"}, - "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 8, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 8], "texture": "#top"}, - "down": {"uv": [5, 8, 11, 12], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json deleted file mode 100644 index b21b9ad..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/middle_c.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 14, 5], - "faces": { - "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 14, 11], - "faces": { - "east": {"uv": [5, 2, 11, 14], "texture": "#side"}, - "south": {"uv": [5, 2, 11, 14], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 14, 11], - "faces": { - "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json deleted file mode 100644 index 0f177cd..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/middle_i.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 14, 12], - "faces": { - "east": {"uv": [4, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 12], "texture": "#top"}, - "down": {"uv": [5, 4, 11, 12], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json deleted file mode 100644 index 7d14491..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/middle_t.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 14, 5], - "faces": { - "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 11], - "to": [11, 14, 12], - "faces": { - "east": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "west": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 14, 11], - "faces": { - "east": {"uv": [5, 2, 11, 14], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 14, 11], - "faces": { - "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json deleted file mode 100644 index a60bd78..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/middle_x.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 14, 5], - "faces": { - "east": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 11], - "to": [11, 14, 12], - "faces": { - "east": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "west": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 14, 11], - "faces": { - "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 14, 11], - "faces": { - "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - }, - { - "from": [11, 2, 5], - "to": [12, 14, 11], - "faces": { - "north": {"uv": [4, 2, 5, 14], "texture": "#side"}, - "south": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, - "down": {"uv": [11, 5, 12, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/both.json rename to src/main/resources/assets/reframed/models/block/wall/junction/tall.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c.json similarity index 51% rename from src/main/resources/assets/reframed/models/block/wall/junction/both_c.json rename to src/main/resources/assets/reframed/models/block/wall/junction/tall_c.json index 6115e86..fb368c1 100644 --- a/src/main/resources/assets/reframed/models/block/wall/junction/both_c.json +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c.json @@ -16,13 +16,31 @@ } }, { - "from": [5, 0, 5], - "to": [11, 16, 11], + "from": [8, 0, 5], + "to": [11, 16, 8], "faces": { - "east": {"uv": [5, 0, 11, 16], "texture": "#side"}, - "south": {"uv": [5, 0, 11, 16], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + "east": {"uv": [8, 0, 11, 16], "texture": "#side"}, + "south": {"uv": [8, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 16, 11], + "faces": { + "east": {"uv": [5, 0, 8, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 16, 8], + "faces": { + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 8, 8, 11], "texture": "#bottom", "cullface": "down"} } }, { diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_i.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/both_i.json rename to src/main/resources/assets/reframed/models/block/wall/junction/tall_i.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c.json new file mode 100644 index 0000000..eefbae9 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c.json @@ -0,0 +1,65 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 14, 11], + "faces": { + "east": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 8], + "faces": { + "south": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 16, 8], + "faces": { + "east": {"uv": [8, 0, 11, 16], "texture": "#side"}, + "south": {"uv": [8, 0, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 8], "texture": "#top", "cullface": "up"}, + "down": {"uv": [8, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 8], + "faces": { + "down": {"uv": [5, 8, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/both_t.json rename to src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top.json b/src/main/resources/assets/reframed/models/block/wall/junction/top.json deleted file mode 100644 index cd8d46c..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/top.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 16, 8], - "faces": { - "east": {"uv": [8, 0, 12, 14], "texture": "#side"}, - "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 8, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 8], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 8, 11, 12], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json deleted file mode 100644 index 488b597..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/top_c.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 16, 5], - "faces": { - "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 16, 11], - "faces": { - "east": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "south": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 16, 11], - "faces": { - "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json deleted file mode 100644 index ed3446a..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/top_i.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 16, 12], - "faces": { - "east": {"uv": [4, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 12], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 4, 11, 12], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json deleted file mode 100644 index fc4ba02..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/top_t.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 16, 5], - "faces": { - "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 11], - "to": [11, 16, 12], - "faces": { - "east": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "west": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 16, 11], - "faces": { - "east": {"uv": [5, 0, 11, 14], "texture": "#side"}, - "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 16, 11], - "faces": { - "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json deleted file mode 100644 index 6086284..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/junction/top_x.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 4], - "to": [11, 16, 5], - "faces": { - "east": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 11, 11, 12], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 11], - "to": [11, 16, 12], - "faces": { - "east": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "west": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom"} - } - }, - { - "from": [5, 2, 5], - "to": [11, 16, 11], - "faces": { - "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 5, 11, 11], "texture": "#bottom"} - } - }, - { - "from": [4, 2, 5], - "to": [5, 16, 11], - "faces": { - "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "south": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [4, 5, 5, 11], "texture": "#bottom"} - } - }, - { - "from": [11, 2, 5], - "to": [12, 16, 11], - "faces": { - "north": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "south": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, - "down": {"uv": [11, 5, 12, 11], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json b/src/main/resources/assets/reframed/models/block/wall/pillar/low.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/pillar/bottom.json rename to src/main/resources/assets/reframed/models/block/wall/pillar/low.json diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json b/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json deleted file mode 100644 index 1cf2b7a..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/pillar/middle.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [4, 2, 4], - "to": [5, 14, 5], - "faces": { - "north": {"uv": [11, 2, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 2, 5, 14], "texture": "#side"} - } - }, - { - "from": [4, 14, 4], - "to": [11, 16, 5], - "faces": { - "north": {"uv": [5, 0, 12, 2], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 2], "texture": "#side"}, - "up": {"uv": [4, 4, 11, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [4, 0, 4], - "to": [11, 2, 5], - "faces": { - "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, - "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, - "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/both.json b/src/main/resources/assets/reframed/models/block/wall/pillar/tall.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/pillar/both.json rename to src/main/resources/assets/reframed/models/block/wall/pillar/tall.json diff --git a/src/main/resources/assets/reframed/models/block/wall/pillar/top.json b/src/main/resources/assets/reframed/models/block/wall/pillar/top.json deleted file mode 100644 index baca217..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/pillar/top.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [4, 2, 4], - "to": [5, 16, 5], - "faces": { - "north": {"uv": [11, 0, 12, 14], "texture": "#side"}, - "west": {"uv": [4, 0, 5, 14], "texture": "#side"}, - "up": {"uv": [4, 4, 5, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [5, 2, 4], - "to": [11, 16, 5], - "faces": { - "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"} - } - }, - { - "from": [4, 0, 4], - "to": [11, 2, 5], - "faces": { - "north": {"uv": [5, 14, 12, 16], "texture": "#side"}, - "west": {"uv": [4, 14, 5, 16], "texture": "#side"}, - "down": {"uv": [4, 11, 11, 12], "texture": "#bottom", "cullface": "down"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/bottom.json b/src/main/resources/assets/reframed/models/block/wall/side/low.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/side/bottom.json rename to src/main/resources/assets/reframed/models/block/wall/side/low.json diff --git a/src/main/resources/assets/reframed/models/block/wall/side/middle.json b/src/main/resources/assets/reframed/models/block/wall/side/middle.json deleted file mode 100644 index 59432d8..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/side/middle.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 0], - "to": [11, 14, 4], - "faces": { - "north": {"uv": [5, 2, 11, 14], "texture": "#side", "cullface": "north"}, - "east": {"uv": [12, 2, 16, 14], "texture": "#side"}, - "west": {"uv": [0, 2, 4, 14], "texture": "#side"}, - "up": {"uv": [5, 0, 11, 4], "texture": "#top"}, - "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/side/both.json b/src/main/resources/assets/reframed/models/block/wall/side/tall.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/side/both.json rename to src/main/resources/assets/reframed/models/block/wall/side/tall.json diff --git a/src/main/resources/assets/reframed/models/block/wall/side/top.json b/src/main/resources/assets/reframed/models/block/wall/side/top.json deleted file mode 100644 index 99e3253..0000000 --- a/src/main/resources/assets/reframed/models/block/wall/side/top.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "particle": "#side" - }, - "elements": [ - { - "from": [5, 2, 0], - "to": [11, 16, 4], - "faces": { - "north": {"uv": [5, 0, 11, 14], "texture": "#side", "cullface": "north"}, - "east": {"uv": [12, 0, 16, 14], "texture": "#side"}, - "west": {"uv": [0, 0, 4, 14], "texture": "#side"}, - "up": {"uv": [5, 0, 11, 4], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 12, 11, 16], "texture": "#bottom"} - } - } - ] -} \ No newline at end of file From 572182e9f0e2dcd181573337f5fc7b3b58f79969 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Fri, 12 Apr 2024 01:06:11 +0200 Subject: [PATCH 08/10] imports cleanup --- .../adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java | 1 - .../java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java | 1 - .../java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java | 1 - .../java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java | 1 - .../fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java | 1 - .../fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java | 1 - .../adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java | 2 -- .../java/fr/adrien1106/reframed/block/ReFramedStairBlock.java | 2 -- .../java/fr/adrien1106/reframed/block/ReFramedStepBlock.java | 2 -- .../fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java | 1 - 10 files changed, 13 deletions(-) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java index 5a40c97..6da0e5d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairsStairBlock.java @@ -19,7 +19,6 @@ import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.HALF_STAIR_VOX 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.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlock { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index 5561b56..e2ee0d9 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -14,7 +14,6 @@ import net.minecraft.world.BlockView; import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.state.property.Properties.LAYERS; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java index 7f2428a..4bf272d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedPillarBlock.java @@ -15,7 +15,6 @@ 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 { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index c67b7a5..c3d9970 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -16,7 +16,6 @@ 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; import static net.minecraft.state.property.Properties.FACING; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java index 2c30cd8..380c1ad 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabsCubeBlock.java @@ -9,7 +9,6 @@ import net.minecraft.util.shape.VoxelShape; import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.AXIS; public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index c0181c4..83ed280 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -23,7 +23,6 @@ import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.*; import static fr.adrien1106.reframed.util.blocks.Corner.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.WATERLOGGED; public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java index 248a6de..4a6f153 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubesStepBlock.java @@ -16,8 +16,6 @@ import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.SMALL_CUBE_VOXELS; import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; -import static fr.adrien1106.reframed.util.blocks.Edge.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.util.shape.VoxelShapes.empty; public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBlock { diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index 5f29dfd..3156f8e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -27,9 +27,7 @@ import java.util.stream.Stream; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE; -import static fr.adrien1106.reframed.util.blocks.Edge.*; import static fr.adrien1106.reframed.util.blocks.StairShape.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; public class ReFramedStairBlock extends WaterloggableReFramedBlock { public static final VoxelShape[] STAIR_VOXELS; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 99f35a6..f2d3ff1 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -22,8 +22,6 @@ import java.util.Map; import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder; import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE; import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE; -import static fr.adrien1106.reframed.util.blocks.Edge.*; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.*; import static net.minecraft.state.property.Properties.WATERLOGGED; diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java index f56fb56..a23a987 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepsSlabBlock.java @@ -17,7 +17,6 @@ import org.jetbrains.annotations.Nullable; import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape; import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape; -import static net.minecraft.data.client.VariantSettings.Rotation.*; import static net.minecraft.state.property.Properties.AXIS; import static net.minecraft.state.property.Properties.FACING; import static net.minecraft.util.shape.VoxelShapes.empty; From d8e41537541d6077b5faea68498563c1691cfda1 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Fri, 12 Apr 2024 19:23:35 +0200 Subject: [PATCH 09/10] added all wall models --- .../reframed/client/ReFramedClient.java | 16 +- .../reframed/generator/block/Wall.java | 376 +++++++++++++++++- .../block/wall/junction/low_c_tall_t.json | 66 +++ .../block/wall/junction/low_i_tall_t.json | 65 +++ .../models/block/wall/junction/low_t.json | 22 +- .../block/wall/junction/low_tall_c_t.json | 88 ++++ .../junction/{bottom_x.json => low_x.json} | 0 .../block/wall/junction/tall_c_low_c_x.json | 96 +++++ .../block/wall/junction/tall_c_low_t.json | 88 ++++ .../block/wall/junction/tall_i_low_i_x.json | 65 +++ .../block/wall/junction/tall_i_low_t.json | 56 +++ .../block/wall/junction/tall_low_c_t.json | 66 +++ .../block/wall/junction/tall_low_t_x.json | 74 ++++ .../models/block/wall/junction/tall_t.json | 22 +- .../block/wall/junction/tall_t_low_x.json | 64 +++ .../junction/{both_x.json => tall_x.json} | 0 16 files changed, 1121 insertions(+), 43 deletions(-) create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/low_c_tall_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/low_i_tall_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c_t.json rename src/main/resources/assets/reframed/models/block/wall/junction/{bottom_x.json => low_x.json} (100%) create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_c_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_i_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c_t.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_low_t_x.json create mode 100644 src/main/resources/assets/reframed/models/block/wall/junction/tall_t_low_x.json rename src/main/resources/assets/reframed/models/block/wall/junction/{both_x.json => tall_x.json} (100%) diff --git a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java index 9cfd84a..c9bfc01 100644 --- a/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java +++ b/src/main/java/fr/adrien1106/reframed/client/ReFramedClient.java @@ -100,11 +100,19 @@ public class ReFramedClient implements ClientModInitializer { // --------------------- junction_t HELPER.addReFramedModel("wall_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_t"))); HELPER.addReFramedModel("wall_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t"))); + HELPER.addReFramedModel("wall_tall_low_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_c_t"))); + HELPER.addReFramedModel("wall_tall_i_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_t"))); + HELPER.addReFramedModel("wall_low_i_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_i_tall_t"))); + HELPER.addReFramedModel("wall_low_tall_c_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_tall_c_t"))); + HELPER.addReFramedModel("wall_low_c_tall_t" , HELPER.auto(ReFramed.id("block/wall/junction/low_c_tall_t"))); + HELPER.addReFramedModel("wall_tall_c_low_t" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_t"))); // --------------------- junction_x - HELPER.addReFramedModel("wall_junction_negative_x" , HELPER.auto(ReFramed.id("block/wall/junction/bottom_x"))); // (Axis only) - HELPER.addReFramedModel("wall_junction_both_x" , HELPER.auto(ReFramed.id("block/wall/junction/both_x"))); - HELPER.addReFramedModel("wall_junction_positive_x" , HELPER.auto(ReFramed.id("block/wall/junction/top_x"))); - HELPER.addReFramedModel("wall_junction_middle_x" , HELPER.auto(ReFramed.id("block/wall/junction/middle_x"))); + HELPER.addReFramedModel("wall_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/low_x"))); + HELPER.addReFramedModel("wall_tall_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_x"))); + HELPER.addReFramedModel("wall_tall_i_low_i_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_i_low_i_x"))); + HELPER.addReFramedModel("wall_tall_low_t_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_low_t_x"))); + HELPER.addReFramedModel("wall_tall_c_low_c_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_c_low_c_x"))); + HELPER.addReFramedModel("wall_tall_t_low_x" , HELPER.auto(ReFramed.id("block/wall/junction/tall_t_low_x"))); //item model assignments (in lieu of models/item/___.json) diff --git a/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java b/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java index 49bfb2a..9b552fb 100644 --- a/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java +++ b/src/main/java/fr/adrien1106/reframed/generator/block/Wall.java @@ -46,22 +46,33 @@ public class Wall implements RecipeSetter, TagGetter, BlockStateProvider { @Override public BlockStateSupplier getMultipart(Block block) { - Identifier side_low = ReFramed.id("wall_side_low_special"); - Identifier side_tall = ReFramed.id("wall_side_tall_special"); - Identifier pillar_low = ReFramed.id("wall_pillar_low_special"); - Identifier pillar_tall = ReFramed.id("wall_pillar_tall_special"); - Identifier pillar_none = ReFramed.id("wall_pillar_none_special"); - Identifier low_e = ReFramed.id("wall_low_e_special"); - Identifier tall_e = ReFramed.id("wall_tall_e_special"); - Identifier low_i = ReFramed.id("wall_low_i_special"); - Identifier tall_i = ReFramed.id("wall_tall_i_special"); - Identifier low_tall_i = ReFramed.id("wall_low_tall_i_special"); - Identifier low_c = ReFramed.id("wall_low_c_special"); - Identifier tall_c = ReFramed.id("wall_tall_c_special"); - Identifier low_tall_c = ReFramed.id("wall_low_tall_c_special"); - Identifier tall_low_c = ReFramed.id("wall_tall_low_c_special"); - Identifier low_t = ReFramed.id("wall_low_t_special"); - Identifier tall_t = ReFramed.id("wall_tall_t_special"); + Identifier + side_low = ReFramed.id("wall_side_low_special"), + side_tall = ReFramed.id("wall_side_tall_special"), + pillar_low = ReFramed.id("wall_pillar_low_special"), + pillar_tall = ReFramed.id("wall_pillar_tall_special"), + pillar_none = ReFramed.id("wall_pillar_none_special"), + low_e = ReFramed.id("wall_low_e_special"), + tall_e = ReFramed.id("wall_tall_e_special"), + low_i = ReFramed.id("wall_low_i_special"), + tall_i = ReFramed.id("wall_tall_i_special"), + low_tall_i = ReFramed.id("wall_low_tall_i_special"), + low_c = ReFramed.id("wall_low_c_special"), + tall_c = ReFramed.id("wall_tall_c_special"), + low_tall_c = ReFramed.id("wall_low_tall_c_special"), + tall_low_c = ReFramed.id("wall_tall_low_c_special"), + low_t = ReFramed.id("wall_low_t_special"), + tall_t = ReFramed.id("wall_tall_t_special"), + tall_low_c_t = ReFramed.id("wall_tall_low_c_t_special"), + tall_i_low_t = ReFramed.id("wall_tall_i_low_t_special"), + low_i_tall_t = ReFramed.id("wall_low_i_tall_t_special"), + low_tall_c_t = ReFramed.id("wall_low_tall_c_t_special"), + low_c_tall_t = ReFramed.id("wall_low_c_tall_t_special"), + tall_c_low_t = ReFramed.id("wall_tall_c_low_t_special"), + tall_i_low_i_x = ReFramed.id("wall_tall_i_low_i_x_special"), + tall_low_t_x = ReFramed.id("wall_tall_low_t_x_special"), + tall_c_low_c_x = ReFramed.id("wall_tall_c_low_c_x_special"), + tall_t_low_x = ReFramed.id("wall_tall_t_low_x_special"); return MultipartBlockStateSupplier.create(block) // PILLAR CORE .with(GBlockstate.when(UP, true), @@ -441,6 +452,337 @@ public class Wall implements RecipeSetter, TagGetter, BlockStateProvider { WEST_WALL_SHAPE, TALL, UP, false ), - GBlockstate.variant(tall_t, true, R0, R270)); + GBlockstate.variant(tall_t, true, R0, R270)) + // JUNCTION TALL LOW C T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_c_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_low_c_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_low_c_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_c_t, true, R0, R270)) + // JUNCTION TALL I LOW T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_i_low_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_i_low_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_i_low_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_i_low_t, true, R0, R270)) + // JUNCTION LOW I TALL T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_i_tall_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_i_tall_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_i_tall_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_i_tall_t, true, R0, R270)) + // JUNCTION LOW TALL C T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_tall_c_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_tall_c_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_tall_c_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_tall_c_t, true, R0, R270)) + // JUNCTION LOW C TALL T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(low_c_tall_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(low_c_tall_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_c_tall_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(low_c_tall_t, true, R0, R270)) + // JUNCTION TALL C LOW T + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, NONE, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_c_low_t, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, NONE, + UP, false + ), + GBlockstate.variant(tall_c_low_t, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, NONE, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c_low_t, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, NONE, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c_low_t, true, R0, R270)) + // JUNCTION X + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(ReFramed.id("wall_low_x_special"), true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(ReFramed.id("wall_tall_x_special"), true, R0, R0)) + // JUNCTION I X + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_i_low_i_x, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_i_low_i_x, true, R0, R90)) + // JUNCTION TALL LOW T X + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_t_x, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_t_x, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_low_t_x, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_low_t_x, true, R0, R270)) + // JUNCTION TALL C LOW C X + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_c_low_c_x, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_c_low_c_x, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c_low_c_x, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_c_low_c_x, true, R0, R270)) + // JUNCTION TALL C LOW C X + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, LOW, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t_low_x, true, R0, R0)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, LOW, + UP, false + ), + GBlockstate.variant(tall_t_low_x, true, R0, R90)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, LOW, + EAST_WALL_SHAPE, TALL, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t_low_x, true, R0, R180)) + .with(GBlockstate.when( + NORTH_WALL_SHAPE, TALL, + EAST_WALL_SHAPE, LOW, + SOUTH_WALL_SHAPE, TALL, + WEST_WALL_SHAPE, TALL, + UP, false + ), + GBlockstate.variant(tall_t_low_x, true, R0, R270)); } } diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_c_tall_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_c_tall_t.json new file mode 100644 index 0000000..f600690 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_c_tall_t.json @@ -0,0 +1,66 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 11], "texture": "#top"}, + "down": {"uv": [8, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 11], + "faces": { + "north": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "east": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "south": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 11], + "faces": { + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "down": {"uv": [5, 5, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_i_tall_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_i_tall_t.json new file mode 100644 index 0000000..d867482 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_i_tall_t.json @@ -0,0 +1,65 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 11, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 11, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 16, 8], + "faces": { + "east": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 8], + "faces": { + "down": {"uv": [5, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_t.json index 541b380..22f7f21 100644 --- a/src/main/resources/assets/reframed/models/block/wall/junction/low_t.json +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_t.json @@ -15,21 +15,11 @@ "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} } }, - { - "from": [5, 0, 11], - "to": [11, 14, 12], - "faces": { - "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, - "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} - } - }, { "from": [5, 0, 5], "to": [11, 14, 11], "faces": { - "east": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, "up": {"uv": [5, 5, 11, 11], "texture": "#top"}, "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} } @@ -43,6 +33,16 @@ "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} } + }, + { + "from": [11, 0, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c_t.json new file mode 100644 index 0000000..9828e01 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/low_tall_c_t.json @@ -0,0 +1,88 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 8], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "up": {"uv": [8, 8, 11, 11], "texture": "#top"}, + "down": {"uv": [8, 5, 11, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 14, 5], + "to": [11, 16, 8], + "faces": { + "east": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "south": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 14, 8], + "to": [8, 16, 11], + "faces": { + "east": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "south": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 8], + "faces": { + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 8], + "faces": { + "down": {"uv": [5, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 14, 11], + "faces": { + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 14, 11], + "faces": { + "north": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/low_x.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/bottom_x.json rename to src/main/resources/assets/reframed/models/block/wall/junction/low_x.json diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_c_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_c_x.json new file mode 100644 index 0000000..4a960fb --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_c_x.json @@ -0,0 +1,96 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 14, 11], + "faces": { + "up": {"uv": [5, 8, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 14, 8], + "to": [11, 16, 11], + "faces": { + "south": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "west": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [8, 8, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 14, 5], + "to": [11, 16, 8], + "faces": { + "up": {"uv": [8, 5, 11, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 8], + "faces": { + "south": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 14, 11], + "faces": { + "down": {"uv": [8, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 8], + "faces": { + "down": {"uv": [5, 8, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_t.json new file mode 100644 index 0000000..f4e82b7 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_c_low_t.json @@ -0,0 +1,88 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 8], + "to": [8, 14, 11], + "faces": { + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 8, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [8, 16, 8], + "faces": { + "south": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 14, 8], + "to": [11, 16, 11], + "faces": { + "south": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "west": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [8, 8, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 14, 5], + "to": [11, 16, 8], + "faces": { + "up": {"uv": [8, 5, 11, 8], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 8], + "faces": { + "down": {"uv": [5, 8, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 0, 8], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "down": {"uv": [8, 5, 11, 8], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_i_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_i_x.json new file mode 100644 index 0000000..5d382d5 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_i_x.json @@ -0,0 +1,65 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_t.json new file mode 100644 index 0000000..e7949b3 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_i_low_t.json @@ -0,0 +1,56 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [5, 2, 11, 16], "texture": "#side"}, + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c_t.json new file mode 100644 index 0000000..f47df56 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_c_t.json @@ -0,0 +1,66 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 11], + "faces": { + "south": {"uv": [5, 2, 8, 16], "texture": "#side"}, + "up": {"uv": [5, 5, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 14, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "south": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 14, 11], + "faces": { + "south": {"uv": [8, 2, 11, 16], "texture": "#side"}, + "down": {"uv": [8, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_t_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_t_x.json new file mode 100644 index 0000000..f4ae770 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_low_t_x.json @@ -0,0 +1,74 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 14, 5], + "faces": { + "east": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 5], + "to": [8, 14, 11], + "faces": { + "up": {"uv": [5, 5, 8, 11], "texture": "#top"}, + "down": {"uv": [5, 5, 8, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [8, 14, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [5, 0, 8, 2], "texture": "#side"}, + "south": {"uv": [8, 0, 11, 2], "texture": "#side"}, + "west": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [8, 5, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [8, 0, 5], + "to": [11, 14, 11], + "faces": { + "down": {"uv": [8, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 14, 11], + "faces": { + "north": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json index 889a4f3..6389879 100644 --- a/src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_t.json @@ -15,21 +15,11 @@ "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} } }, - { - "from": [5, 0, 11], - "to": [11, 16, 12], - "faces": { - "east": {"uv": [4, 0, 5, 16], "texture": "#side"}, - "west": {"uv": [11, 0, 12, 16], "texture": "#side"}, - "up": {"uv": [5, 11, 11, 12], "texture": "#top", "cullface": "up"}, - "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} - } - }, { "from": [5, 0, 5], "to": [11, 16, 11], "faces": { - "east": {"uv": [5, 0, 11, 16], "texture": "#side"}, + "south": {"uv": [5, 0, 11, 16], "texture": "#side"}, "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"}, "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} } @@ -43,6 +33,16 @@ "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/tall_t_low_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_t_low_x.json new file mode 100644 index 0000000..38fdc54 --- /dev/null +++ b/src/main/resources/assets/reframed/models/block/wall/junction/tall_t_low_x.json @@ -0,0 +1,64 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "particle": "#side" + }, + "elements": [ + { + "from": [5, 0, 4], + "to": [11, 16, 5], + "faces": { + "east": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "west": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [5, 4, 11, 5], "texture": "#top", "cullface": "up"}, + "down": {"uv": [5, 11, 11, 12], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 0, 11], + "to": [11, 14, 12], + "faces": { + "east": {"uv": [4, 2, 5, 16], "texture": "#side"}, + "west": {"uv": [11, 2, 12, 16], "texture": "#side"}, + "up": {"uv": [5, 11, 11, 12], "texture": "#top"}, + "down": {"uv": [5, 4, 11, 5], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 16, 11], + "faces": { + "south": {"uv": [5, 0, 11, 2], "texture": "#side"}, + "up": {"uv": [5, 5, 11, 11], "texture": "#top", "cullface": "up"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 14, 11], + "faces": { + "down": {"uv": [5, 5, 11, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [4, 0, 5], + "to": [5, 16, 11], + "faces": { + "north": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "south": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "up": {"uv": [4, 5, 5, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [4, 5, 5, 11], "texture": "#bottom", "cullface": "down"} + } + }, + { + "from": [11, 0, 5], + "to": [12, 16, 11], + "faces": { + "north": {"uv": [4, 0, 5, 16], "texture": "#side"}, + "south": {"uv": [11, 0, 12, 16], "texture": "#side"}, + "up": {"uv": [11, 5, 12, 11], "texture": "#top", "cullface": "up"}, + "down": {"uv": [11, 5, 12, 11], "texture": "#bottom", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/reframed/models/block/wall/junction/both_x.json b/src/main/resources/assets/reframed/models/block/wall/junction/tall_x.json similarity index 100% rename from src/main/resources/assets/reframed/models/block/wall/junction/both_x.json rename to src/main/resources/assets/reframed/models/block/wall/junction/tall_x.json From c3e0ab16b74ae6a24e3531ec71e899119f95fd38 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Mon, 15 Apr 2024 20:57:03 +0200 Subject: [PATCH 10/10] fixed cache issue with dynamic models from continuity and athena. Finished wall logic + updated to minor version 1.5.7 --- gradle.properties | 2 +- .../reframed/block/ReframedWallBlock.java | 78 ++++++++++++++++--- .../client/model/RetexturingBakedModel.java | 4 +- .../apperance/CamoAppearanceManager.java | 10 +-- 4 files changed, 78 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index d530df0..f8ef931 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.15.6 # Mod Properties modrinth_id = jCpoCBpn -mod_version = 1.5.6 +mod_version = 1.5.7 maven_group = fr.adrien1106 archives_base_name = ReFramed mod_id = reframed diff --git a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java index 9191776..561dbd3 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReframedWallBlock.java @@ -14,6 +14,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; @@ -58,6 +59,41 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { super.appendProperties(builder.add(UP, EAST_WALL_SHAPE, NORTH_WALL_SHAPE, SOUTH_WALL_SHAPE, WEST_WALL_SHAPE)); } + @Override + public BlockState getStateForNeighborUpdate(BlockState state, Direction dir, BlockState other_state, WorldAccess world, BlockPos pos, BlockPos moved) { + BlockState new_state = super.getStateForNeighborUpdate(state, dir, other_state, world, pos, moved); + if (dir == Direction.DOWN) return new_state; + BlockState top_state = dir == Direction.UP? other_state: world.getBlockState(pos.up()); + boolean fs = top_state.isSideSolidFullSquare(world, pos.up(), Direction.DOWN); + VoxelShape top_shape = fs ? null : top_state.getCollisionShape(world, pos.up()).getFace(Direction.DOWN); + if (dir == Direction.UP) { + for (Direction d : Direction.Type.HORIZONTAL) { + Property wall_shape = getWallShape(d); + if (state.get(wall_shape) == WallShape.NONE) continue; + new_state = new_state.with( + wall_shape, + fs + || (top_state.contains(wall_shape) && top_state.get(wall_shape) != WallShape.NONE) + || shouldUseTall(WALL_VOXELS[dir.ordinal() + 3], top_shape) + ? WallShape.TALL + : WallShape.LOW + ); + } + return new_state.with(UP, shouldHavePost(new_state, top_state, top_shape)); + } + + boolean side_full = other_state.isSideSolidFullSquare(world, moved, dir.getOpposite()); + if (shouldConnectTo(other_state, side_full, dir.getOpposite())) { + new_state = new_state.with( + getWallShape(dir), + fs || shouldUseTall(WALL_VOXELS[dir.ordinal() + 3], top_shape) + ? WallShape.TALL + : WallShape.LOW + ); + } else new_state = new_state.with(getWallShape(dir), WallShape.NONE); + return new_state.with(UP, shouldHavePost(new_state, top_state, top_shape)); + } + @Override public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { BlockState state = super.getPlacementState(ctx); @@ -67,9 +103,11 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { boolean fs = top_state.isSideSolidFullSquare(world, pos.up(), Direction.DOWN); VoxelShape top_shape = fs ? null : top_state.getCollisionShape(world, pos.up()).getFace(Direction.DOWN); for (Direction dir : Direction.Type.HORIZONTAL) { - BlockState neighbor = world.getBlockState(pos.offset(dir)); - if (shouldConnectTo(neighbor, fs, dir.getOpposite())) { - state.with( + BlockPos offset = pos.offset(dir); + BlockState neighbor = world.getBlockState(offset); + boolean side_full = neighbor.isSideSolidFullSquare(world, offset, dir.getOpposite()); + if (shouldConnectTo(neighbor, side_full, dir.getOpposite())) { + state = state.with( getWallShape(dir), fs || shouldUseTall(WALL_VOXELS[dir.ordinal() + 3], top_shape) ? WallShape.TALL @@ -80,15 +118,30 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { return state.with(UP, shouldHavePost(state, top_state, top_shape)); } + @Override + public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState new_state, boolean moved) { + super.onStateReplaced(state, world, pos, new_state, moved); + + if(!state.isOf(new_state.getBlock())) world.removeBlockEntity(pos); + } + @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { VoxelShape shape = state.get(UP) ? WALL_VOXELS[0]: VoxelShapes.empty(); for (Direction dir : Direction.Type.HORIZONTAL) { WallShape wall_shape = state.get(getWallShape(dir)); - if (wall_shape != WallShape.NONE) { -// System.out.println("wall_shape: " + wall_shape + " wall_shape.ordinal-1: " + (wall_shape.ordinal()-1) + " dir.ordinal() - 2: " + (dir.ordinal() - 2)); + if (wall_shape != WallShape.NONE) shape = VoxelShapes.union(shape, WALL_VOXELS[1 + (wall_shape.ordinal()-1) * 4 + (dir.ordinal() - 2)]); - } + } + return shape; + } + + @Override + public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { + VoxelShape shape = state.get(UP) ? WALL_VOXELS[9]: VoxelShapes.empty(); + for (Direction dir : Direction.Type.HORIZONTAL) { + if (state.get(getWallShape(dir)) != WallShape.NONE) + shape = VoxelShapes.union(shape, WALL_VOXELS[8 + dir.ordinal()]); } return shape; } @@ -115,10 +168,10 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { return top_state.isIn(BlockTags.WALL_POST_OVERRIDE) || top_shape == null || shouldUseTall(WALL_VOXELS[0], top_shape); } - private static boolean shouldConnectTo(BlockState state, boolean faceFullSquare, Direction side) { + private static boolean shouldConnectTo(BlockState state, boolean side_full, Direction side) { Block block = state.getBlock(); boolean bl = block instanceof FenceGateBlock && FenceGateBlock.canWallConnect(state, side); - return state.isIn(BlockTags.WALLS) || !WallBlock.cannotConnect(state) && faceFullSquare || block instanceof PaneBlock || bl; + return state.isIn(BlockTags.WALLS) || !WallBlock.cannotConnect(state) && side_full || block instanceof PaneBlock || bl; } private static boolean shouldUseTall(VoxelShape self_shape, VoxelShape other_shape) { @@ -141,9 +194,11 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { static { VoxelShape POST = createCuboidShape(4, 0, 4, 12, 16, 12); + VoxelShape POST_COLLISION = createCuboidShape(4, 0, 4, 12, 24, 12); VoxelShape LOW = createCuboidShape(5, 0, 0, 11, 14, 8); VoxelShape TALL = createCuboidShape(5, 0, 0, 11, 16, 8); - WALL_VOXELS = VoxelHelper.VoxelListBuilder.create(POST, 9) + VoxelShape SIDE_COLLISION = createCuboidShape(5, 0, 0, 11, 24, 8); + WALL_VOXELS = VoxelHelper.VoxelListBuilder.create(POST, 14) .add(LOW) .add(VoxelHelper::mirrorZ) .add(VoxelHelper::rotateY) @@ -152,6 +207,11 @@ public class ReframedWallBlock extends WaterloggableReFramedBlock { .add(VoxelHelper::mirrorZ) .add(VoxelHelper::rotateY) .add(VoxelHelper::mirrorX) + .add(POST_COLLISION) + .add(SIDE_COLLISION) + .add(VoxelHelper::mirrorZ) + .add(VoxelHelper::rotateY) + .add(VoxelHelper::mirrorX) .build(); } } 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 5ce4b48..0b211fc 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/RetexturingBakedModel.java @@ -114,7 +114,9 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel { if (camo instanceof WeightedComputedAppearance wca) model_id = wca.getAppearanceIndex(seed); int tint = 0xFF000000 | MinecraftClient.getInstance().getBlockColors().getColor(theme, world, pos, 0); - Mesh untintedMesh = getRetexturedMesh(new MeshCacheKey(frame_block.getModelCacheKey(state), camo, model_id), state); + MeshCacheKey key = new MeshCacheKey(frame_block.getModelCacheKey(state), camo, model_id); + // do not clutter the cache with single-use meshes + Mesh untintedMesh = camo.hashCode() == -1 ? transformMesh(key, state) : getRetexturedMesh(key, state); //The specific tint might vary a lot; imagine grass color smoothly changing. Trying to bake the tint into //the cached mesh will pollute it with a ton of single-use meshes with only slightly different colors. diff --git a/src/main/java/fr/adrien1106/reframed/client/model/apperance/CamoAppearanceManager.java b/src/main/java/fr/adrien1106/reframed/client/model/apperance/CamoAppearanceManager.java index e30fe39..665a5a2 100644 --- a/src/main/java/fr/adrien1106/reframed/client/model/apperance/CamoAppearanceManager.java +++ b/src/main/java/fr/adrien1106/reframed/client/model/apperance/CamoAppearanceManager.java @@ -95,7 +95,7 @@ public class CamoAppearanceManager { model = dynamic_model.computeQuads(world, state, pos, theme_index); // if model isn't rebaked its just wrapped (i.e. not dynamic and may be cached) if (model instanceof RebakedModel) { - CamoAppearance appearance = computeAppearance(model, state); + CamoAppearance appearance = computeAppearance(model, state, !item); if (item) APPEARANCE_CACHE.put(state, appearance); return appearance; } @@ -104,7 +104,7 @@ public class CamoAppearanceManager { // refresh cache if (APPEARANCE_CACHE.asMap().containsKey(state)) return APPEARANCE_CACHE.getIfPresent(state); - CamoAppearance appearance = computeAppearance(model, state); + CamoAppearance appearance = computeAppearance(model, state, false); APPEARANCE_CACHE.put(state, appearance); return appearance; } @@ -118,7 +118,7 @@ public class CamoAppearanceManager { // The computeIfAbsent map update will work without corrupting the map, but there will be some "wasted effort" computing the value twice. // The results are going to be the same, apart from their serialNumbers differing (= their equals & hashCode differing). // Tiny amount of wasted space in some caches if CamoAppearances are used as a map key, then. IMO it's not a critical issue. - private CamoAppearance computeAppearance(BakedModel model, BlockState state) { + private CamoAppearance computeAppearance(BakedModel model, BlockState state, boolean is_dynamic) { if(state.getBlock() == Blocks.BARRIER) return barrierItemAppearance; if (!(model instanceof WeightedBakedModelAccessor weighted_model)) { @@ -126,7 +126,7 @@ public class CamoAppearanceManager { getAppearance(model), getCachedMaterial(state, true), getCachedMaterial(state, false), - serial_number.getAndIncrement() + is_dynamic ? -1 : serial_number.getAndIncrement() ); } List> appearances = weighted_model.getModels().stream() @@ -137,7 +137,7 @@ public class CamoAppearanceManager { appearances, getCachedMaterial(state, true), getCachedMaterial(state, false), - serial_number.getAndIncrement() + is_dynamic ? -1 : serial_number.getAndIncrement() ); }