New minor version with fix for caching on dynamic models #12

Merged
Adrien1106 merged 10 commits from dev into master 2024-04-15 20:58:48 +02:00
82 changed files with 2055 additions and 1578 deletions
Showing only changes of commit 6f394bbe6f - Show all commits

View File

@ -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";

View File

@ -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<Integer, Integer> 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);
}
}

View File

@ -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),

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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))

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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),

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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<Block, BlockState> 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<WallShape> 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();
}
}

View File

@ -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")));

View File

@ -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);
}

View File

@ -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<Class<? extends Block>, TagGetter> providers = new HashMap<>();
static {
providers.put(ReframedWallBlock.class, new Wall());
}
public GBlockTag(FabricDataOutput output, CompletableFuture<WrapperLookup> 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);
});
}
}

View File

@ -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<Class<? extends Block>, 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 <T extends Comparable<T>, U extends Comparable<U>> When when(Property<T> property_1, T value_1, Property<U> property_2, U value_2) {
return When.allOf(when(property_1, value_1), when(property_2, value_2));
public static <T extends Comparable<T>,
U extends Comparable<U>> When when(Property<T> property_1, T value_1,
Property<U> property_2, U value_2) {
return When.allOf(
when(property_1, value_1),
when(property_2, value_2)
);
}
public static <T extends Comparable<T>, U extends Comparable<U>, V extends Comparable<V>> When when(Property<T> property_1, T value_1, Property<U> property_2, U value_2, Property<V> 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 <T extends Comparable<T>,
U extends Comparable<U>,
V extends Comparable<V>> When when(Property<T> property_1, T value_1,
Property<U> property_2, U value_2,
Property<V> 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 <T extends Comparable<T>,
U extends Comparable<U>,
V extends Comparable<V>,
W extends Comparable<W>> When when(Property<T> property_1, T value_1,
Property<U> property_2, U value_2,
Property<V> property_3, V value_3,
Property<W> 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 <T extends Comparable<T>,
U extends Comparable<U>,
V extends Comparable<V>,
W extends Comparable<W>,
X extends Comparable<X>> When when(Property<T> property_1, T value_1,
Property<U> property_2, U value_2,
Property<V> property_3, V value_3,
Property<W> property_4, W value_4,
Property<X> 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)
);
}
}

View File

@ -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<Class<? extends ItemConvertible>, 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);
});
}
}

View File

@ -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);
}

View File

@ -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<TagKey<Block>> getTags();
}

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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")
);
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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<TagKey<Block>> 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));
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}

View File

@ -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"}
}
},
{

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
},
{

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}

View File

@ -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"}
}
}
]
}