Compare commits

...

2 Commits

13 changed files with 491 additions and 88 deletions

View File

@ -8,7 +8,7 @@ yarn_mappings=1.20.4+build.3
loader_version=0.15.6
# Mod Properties
mod_version = 1.2
mod_version = 1.3
maven_group = fr.adrien1106
archives_base_name = ReFramed
mod_id = reframed

View File

@ -24,11 +24,14 @@ import java.util.ArrayList;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/**
* TODO self culling, fix other models, better connected textures
*/
public class ReFramed implements ModInitializer {
public static final String MODID = "reframed";
public static final ArrayList<Block> BLOCKS = new ArrayList<>();
public static Block CUBE, STAIRS, SLAB, DOUBLE_SLAB, POST, FENCE, FENCE_GATE, DOOR, TRAPDOOR, IRON_DOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE, CANDLE;
public static Block CUBE, STAIRS, DOUBLE_STAIRS, SLAB, DOUBLE_SLAB, POST, FENCE, FENCE_GATE, DOOR, TRAPDOOR, IRON_DOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE, CANDLE;
public static BlockEntityType<ReFramedEntity> REFRAMED_BLOCK_ENTITY;
public static BlockEntityType<ReFramedDoubleEntity> REFRAMED_DOUBLE_BLOCK_ENTITY;
@ -44,6 +47,7 @@ public class ReFramed implements ModInitializer {
//and button, because they're redstoney... hopefully this ordering makes sense lol
CUBE = registerReFramed("cube" , new ReFramedBlock(ReFramedInteractionUtil.makeSettings()));
STAIRS = registerReFramed("stairs" , new ReFramedStairsBlock(cp(Blocks.OAK_STAIRS)));
DOUBLE_STAIRS = registerReFramed("double_stairs" , new ReFramedDoubleStairsBlock(cp(Blocks.OAK_STAIRS)));
SLAB = registerReFramed("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB)));
DOUBLE_SLAB = registerReFramed("double_slab" , new ReFramedDoubleSlabBlock(cp(Blocks.OAK_SLAB)));
POST = registerReFramed("post" , new ReFramedPostBlock(cp(Blocks.OAK_FENCE)));

View File

@ -269,7 +269,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider {
if (self_theme.isSideInvisible(other_state, side)) return false;
// Opaque is also simple as each model are rendered one by one
if (self_theme.isOpaque()) {
if (other_state.isOpaque()) {
// no cache section :( because it differs between each instance of the frame
VoxelShape self_shape = self_block.getShape(self_state, theme_index).getFace(side);
if (self_shape.isEmpty()) return true;

View File

@ -0,0 +1,187 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.generator.MultipartBlockStateProvider;
import fr.adrien1106.reframed.util.property.StairDirection;
import fr.adrien1106.reframed.util.property.StairShape;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.data.client.MultipartBlockStateSupplier;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
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.World;
import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import static fr.adrien1106.reframed.block.ReFramedStairsBlock.*;
import static fr.adrien1106.reframed.util.property.StairShape.STRAIGHT;
public class ReFramedDoubleStairsBlock extends ReFramedDoubleBlock implements MultipartBlockStateProvider {
private static final List<VoxelShape> COMPLEMENT_LIST = new ArrayList<>(52);
public ReFramedDoubleStairsBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(FACING, StairDirection.NORTH_DOWN).with(SHAPE, STRAIGHT));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(FACING).add(SHAPE));
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) {
return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved)
.with(SHAPE, getPlacementShape(this, state.get(FACING), world, pos));
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return getPlacement(super.getPlacementState(ctx), ctx);
}
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
super.onStateReplaced(state, world, pos, newState, moved);
if(!state.isOf(newState.getBlock())) world.removeBlockEntity(pos);
}
@Override
public VoxelShape getShape(BlockState state, int i) {
return i == 2 ? getComplementOutline(state) : getOutline(state);
}
private VoxelShape getComplementOutline(BlockState state) {
StairShape shape = state.get(SHAPE);
StairDirection direction = state.get(FACING);
return switch (shape) {
case STRAIGHT ->
switch (direction) {
case DOWN_SOUTH -> COMPLEMENT_LIST.get(0);
case NORTH_DOWN -> COMPLEMENT_LIST.get(1);
case UP_NORTH -> COMPLEMENT_LIST.get(2);
case SOUTH_UP -> COMPLEMENT_LIST.get(3);
case DOWN_EAST -> COMPLEMENT_LIST.get(4);
case WEST_DOWN -> COMPLEMENT_LIST.get(5);
case UP_WEST -> COMPLEMENT_LIST.get(6);
case EAST_UP -> COMPLEMENT_LIST.get(7);
case NORTH_EAST -> COMPLEMENT_LIST.get(8);
case EAST_SOUTH -> COMPLEMENT_LIST.get(9);
case SOUTH_WEST -> COMPLEMENT_LIST.get(10);
case WEST_NORTH -> COMPLEMENT_LIST.get(11);
};
case INNER_LEFT ->
switch (direction) {
case WEST_DOWN, NORTH_DOWN -> COMPLEMENT_LIST.get(44);
case DOWN_EAST -> COMPLEMENT_LIST.get(45);
case DOWN_SOUTH -> COMPLEMENT_LIST.get(47);
case UP_WEST, UP_NORTH, WEST_NORTH -> COMPLEMENT_LIST.get(48);
case EAST_UP, NORTH_EAST -> COMPLEMENT_LIST.get(49);
case EAST_SOUTH -> COMPLEMENT_LIST.get(50);
case SOUTH_UP, SOUTH_WEST -> COMPLEMENT_LIST.get(51);
};
case INNER_RIGHT ->
switch (direction) {
case WEST_NORTH -> COMPLEMENT_LIST.get(44);
case NORTH_DOWN, NORTH_EAST -> COMPLEMENT_LIST.get(45);
case DOWN_EAST, DOWN_SOUTH, EAST_SOUTH -> COMPLEMENT_LIST.get(46);
case WEST_DOWN, SOUTH_WEST -> COMPLEMENT_LIST.get(47);
case UP_NORTH -> COMPLEMENT_LIST.get(49);
case EAST_UP, SOUTH_UP -> COMPLEMENT_LIST.get(50);
case UP_WEST -> COMPLEMENT_LIST.get(51);
};
case OUTER_LEFT ->
switch (direction) {
case DOWN_EAST -> COMPLEMENT_LIST.get(43);
case WEST_DOWN, NORTH_DOWN -> COMPLEMENT_LIST.get(42);
case DOWN_SOUTH -> COMPLEMENT_LIST.get(41);
case EAST_UP, NORTH_EAST -> COMPLEMENT_LIST.get(39);
case UP_WEST, UP_NORTH, WEST_NORTH -> COMPLEMENT_LIST.get(38);
case SOUTH_UP, SOUTH_WEST -> COMPLEMENT_LIST.get(37);
case EAST_SOUTH -> COMPLEMENT_LIST.get(36);
};
case OUTER_RIGHT ->
switch (direction) {
case NORTH_DOWN, NORTH_EAST -> COMPLEMENT_LIST.get(43);
case WEST_NORTH -> COMPLEMENT_LIST.get(42);
case WEST_DOWN, SOUTH_WEST -> COMPLEMENT_LIST.get(41);
case DOWN_EAST, DOWN_SOUTH, EAST_SOUTH -> COMPLEMENT_LIST.get(40);
case UP_NORTH -> COMPLEMENT_LIST.get(39);
case UP_WEST -> COMPLEMENT_LIST.get(37);
case EAST_UP, SOUTH_UP -> COMPLEMENT_LIST.get(36);
};
case FIRST_OUTER_LEFT ->
switch (direction) {
case WEST_DOWN, NORTH_DOWN -> COMPLEMENT_LIST.get(14);
case SOUTH_UP -> COMPLEMENT_LIST.get(17);
case EAST_UP -> COMPLEMENT_LIST.get(19);
case EAST_SOUTH -> COMPLEMENT_LIST.get(20);
case DOWN_SOUTH -> COMPLEMENT_LIST.get(22);
case UP_NORTH, WEST_NORTH -> COMPLEMENT_LIST.get(25);
case SOUTH_WEST -> COMPLEMENT_LIST.get(28);
case UP_WEST -> COMPLEMENT_LIST.get(31);
case DOWN_EAST -> COMPLEMENT_LIST.get(34);
case NORTH_EAST -> COMPLEMENT_LIST.get(35);
};
case FIRST_OUTER_RIGHT ->
switch (direction) {
case NORTH_DOWN -> COMPLEMENT_LIST.get(15);
case SOUTH_UP, EAST_UP -> COMPLEMENT_LIST.get(16);
case WEST_DOWN -> COMPLEMENT_LIST.get(13);
case DOWN_SOUTH, EAST_SOUTH -> COMPLEMENT_LIST.get(23);
case UP_NORTH -> COMPLEMENT_LIST.get(24);
case WEST_NORTH -> COMPLEMENT_LIST.get(26);
case UP_WEST -> COMPLEMENT_LIST.get(28);
case SOUTH_WEST -> COMPLEMENT_LIST.get(29);
case DOWN_EAST -> COMPLEMENT_LIST.get(33);
case NORTH_EAST -> COMPLEMENT_LIST.get(34);
};
case SECOND_OUTER_LEFT ->
switch (direction) {
case DOWN_EAST -> COMPLEMENT_LIST.get(15);
case DOWN_SOUTH -> COMPLEMENT_LIST.get(13);
case UP_WEST, UP_NORTH -> COMPLEMENT_LIST.get(18);
case SOUTH_UP, SOUTH_WEST -> COMPLEMENT_LIST.get(21);
case NORTH_EAST -> COMPLEMENT_LIST.get(24);
case NORTH_DOWN -> COMPLEMENT_LIST.get(26);
case WEST_DOWN -> COMPLEMENT_LIST.get(30);
case WEST_NORTH -> COMPLEMENT_LIST.get(31);
case EAST_SOUTH -> COMPLEMENT_LIST.get(32);
case EAST_UP -> COMPLEMENT_LIST.get(35);
};
case SECOND_OUTER_RIGHT ->
switch (direction) {
case DOWN_SOUTH, DOWN_EAST -> COMPLEMENT_LIST.get(12);
case UP_WEST -> COMPLEMENT_LIST.get(17);
case UP_NORTH -> COMPLEMENT_LIST.get(19);
case SOUTH_UP -> COMPLEMENT_LIST.get(20);
case SOUTH_WEST -> COMPLEMENT_LIST.get(22);
case NORTH_EAST, NORTH_DOWN -> COMPLEMENT_LIST.get(27);
case WEST_DOWN -> COMPLEMENT_LIST.get(29);
case WEST_NORTH -> COMPLEMENT_LIST.get(30);
case EAST_UP -> COMPLEMENT_LIST.get(32);
case EAST_SOUTH -> COMPLEMENT_LIST.get(33);
};
};
}
@Override
public MultipartBlockStateSupplier getMultipart() {
return getStairMultipart(this, true);
}
static {
VOXEL_LIST.forEach(shape -> COMPLEMENT_LIST.add(VoxelShapes.combineAndSimplify(VoxelShapes.fullCube(), shape, BooleanBiFunction.ONLY_FIRST)));
}
}

View File

@ -38,7 +38,7 @@ public class ReFramedStairsBlock extends WaterloggableReFramedBlock implements M
public static final EnumProperty<StairDirection> FACING = EnumProperty.of("facing", StairDirection.class);
public static final EnumProperty<StairShape> SHAPE = EnumProperty.of("shape", StairShape.class);
private static final List<VoxelShape> VOXEL_LIST = new ArrayList<>(52);
public static final List<VoxelShape> VOXEL_LIST = new ArrayList<>(52);
public ReFramedStairsBlock(Settings settings) {
super(settings);
@ -53,13 +53,16 @@ public class ReFramedStairsBlock extends WaterloggableReFramedBlock implements M
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) {
return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved)
.with(SHAPE, getPlacementShape(state.get(FACING), world, pos));
.with(SHAPE, getPlacementShape(state.getBlock(), state.get(FACING), world, pos));
}
@Nullable
@Override // Pretty happy of how clean it is (also got it on first try :) )
public BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState state = super.getPlacementState(ctx);
return getPlacement(super.getPlacementState(ctx), ctx);
}
public static BlockState getPlacement(BlockState state, ItemPlacementContext ctx) {
Direction side = ctx.getSide().getOpposite();
BlockPos block_pos = ctx.getBlockPos();
Vec3d hit_pos = ctx.getHitPos();
@ -84,20 +87,23 @@ public class ReFramedStairsBlock extends WaterloggableReFramedBlock implements M
);
StairDirection face = StairDirection.getByDirections(side, part_direction);
return state.with(FACING, face).with(SHAPE, getPlacementShape(face, ctx.getWorld(), block_pos));
return state.with(FACING, face).with(SHAPE, getPlacementShape(state.getBlock(), face, ctx.getWorld(), block_pos));
}
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
super.onStateReplaced(state, world, pos, newState, moved);
//StairsBlock onStateReplaced is Weird! it doesn't delegate to regular block onStateReplaced!
if(!state.isOf(newState.getBlock())) world.removeBlockEntity(pos);
}
/* ---------------------------------- DON'T GO FURTHER IF YOU LIKE HAVING EYES ---------------------------------- */
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getOutline(state);
}
public static VoxelShape getOutline(BlockState state) {
StairShape shape = state.get(SHAPE);
StairDirection direction = state.get(FACING);
return switch (shape) {
@ -211,40 +217,40 @@ public class ReFramedStairsBlock extends WaterloggableReFramedBlock implements M
};
}
private static String getNeighborPos(StairDirection face, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos) {
public static String getNeighborPos(StairDirection face, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos, Block block) {
BlockState block_state = world.getBlockState(
pos.offset(reverse ? direction.getOpposite() : direction)
);
if (block_state.getBlock() instanceof ReFramedStairsBlock && block_state.get(FACING).hasDirection(reference)) {
if (block_state.isOf(block) && block_state.get(FACING).hasDirection(reference)) {
if (block_state.get(FACING).hasDirection(face.getLeftDirection())) return "left";
else if (block_state.get(FACING).hasDirection(face.getRightDirection())) return "right";
}
return "";
}
private static StairShape getPlacementShape(StairDirection face, BlockView world, BlockPos pos) {
public static StairShape getPlacementShape(Block block, StairDirection face, BlockView world, BlockPos pos) {
StairShape shape = STRAIGHT;
String sol = getNeighborPos(face, face.getFirstDirection(), true, face.getSecondDirection(), world, pos);
String sol = getNeighborPos(face, face.getFirstDirection(), true, face.getSecondDirection(), world, pos, block);
switch (sol) {
case "right": return INNER_RIGHT;
case "left": return INNER_LEFT;
}
sol = getNeighborPos(face, face.getSecondDirection(), true, face.getFirstDirection(), world, pos);
sol = getNeighborPos(face, face.getSecondDirection(), true, face.getFirstDirection(), world, pos, block);
switch (sol) {
case "right": return INNER_RIGHT;
case "left": return INNER_LEFT;
}
sol = getNeighborPos(face, face.getFirstDirection(), false, face.getSecondDirection(), world, pos);
sol = getNeighborPos(face, face.getFirstDirection(), false, face.getSecondDirection(), world, pos, block);
switch (sol) {
case "right" -> shape = FIRST_OUTER_RIGHT;
case "left" -> shape = FIRST_OUTER_LEFT;
}
sol = getNeighborPos(face, face.getSecondDirection(), false, face.getFirstDirection(), world, pos);
sol = getNeighborPos(face, face.getSecondDirection(), false, face.getFirstDirection(), world, pos, block);
switch (sol) {
case "right" -> {
if (shape.equals(STRAIGHT)) shape = SECOND_OUTER_RIGHT;
@ -261,12 +267,17 @@ public class ReFramedStairsBlock extends WaterloggableReFramedBlock implements M
@Override
public MultipartBlockStateSupplier getMultipart() {
Identifier straight_id = ReFramed.id("stairs_special");
Identifier double_outer_id = ReFramed.id("double_outer_stairs_special");
Identifier inner_id = ReFramed.id("inner_stairs_special");
Identifier outer_id = ReFramed.id("outer_stairs_special");
Identifier outer_side_id = ReFramed.id("outer_side_stairs_special");
return MultipartBlockStateSupplier.create(this)
return getStairMultipart(this, false);
}
public static MultipartBlockStateSupplier getStairMultipart(Block block, boolean is_double) {
String prefix = is_double ? "double_" : "";
Identifier straight_id = ReFramed.id(prefix + "stairs_special");
Identifier double_outer_id = ReFramed.id(prefix + "outers_stairs_special");
Identifier inner_id = ReFramed.id(prefix + "inner_stairs_special");
Identifier outer_id = ReFramed.id(prefix + "outer_stairs_special");
Identifier outer_side_id = ReFramed.id(prefix + "outer_side_stairs_special");
return MultipartBlockStateSupplier.create(block)
/* STRAIGHT X AXIS */
.with(GBlockstate.when(FACING, DOWN_EAST, SHAPE, STRAIGHT),
GBlockstate.variant(straight_id, true, R0, R0))

View File

@ -26,74 +26,80 @@ public class ReFramedClient implements ClientModInitializer {
//all frames mustn't be on the SOLID layer because they are not opaque!
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), ReFramed.BLOCKS.toArray(new Block[0]));
HELPER.addReFramedModel(ReFramed.id("button_special") , HELPER.auto(new Identifier("block/button")));
HELPER.addReFramedModel(ReFramed.id("button_pressed_special") , HELPER.auto(new Identifier("block/button_pressed")));
HELPER.addReFramedModel(ReFramed.id("one_candle_special") , HELPER.auto(new Identifier("block/template_candle")));
HELPER.addReFramedModel(ReFramed.id("two_candles_special") , HELPER.auto(new Identifier("block/template_two_candles")));
HELPER.addReFramedModel(ReFramed.id("three_candles_special") , HELPER.auto(new Identifier("block/template_three_candles")));
HELPER.addReFramedModel(ReFramed.id("four_candles_special") , HELPER.auto(new Identifier("block/template_four_candles")));
HELPER.addReFramedModel(ReFramed.id("carpet_special") , HELPER.auto(new Identifier("block/carpet")));
HELPER.addReFramedModel(ReFramed.id("cube_special") , HELPER.auto(new Identifier("block/cube")));
HELPER.addReFramedModel(ReFramed.id("door_bottom_left_special") , HELPER.auto(new Identifier("block/door_bottom_left")));
HELPER.addReFramedModel(ReFramed.id("door_bottom_right_special") , HELPER.auto(new Identifier("block/door_bottom_right")));
HELPER.addReFramedModel(ReFramed.id("door_top_left_special") , HELPER.auto(new Identifier("block/door_top_left")));
HELPER.addReFramedModel(ReFramed.id("door_top_right_special") , HELPER.auto(new Identifier("block/door_top_right")));
HELPER.addReFramedModel(ReFramed.id("door_bottom_left_open_special"), HELPER.auto(new Identifier("block/door_bottom_left_open")));
HELPER.addReFramedModel(ReFramed.id("door_bottom_right_open_special"), HELPER.auto(new Identifier("block/door_bottom_right_open"))); //This is why we dont format code as tables kids
HELPER.addReFramedModel(ReFramed.id("door_top_left_open_special") , HELPER.auto(new Identifier("block/door_top_left_open")));
HELPER.addReFramedModel(ReFramed.id("door_top_right_open_special") , HELPER.auto(new Identifier("block/door_top_right_open")));
HELPER.addReFramedModel(ReFramed.id("fence_post_special") , HELPER.auto(new Identifier("block/fence_post")));
HELPER.addReFramedModel(ReFramed.id("fence_gate_special") , HELPER.auto(new Identifier("block/template_fence_gate")));
HELPER.addReFramedModel(ReFramed.id("fence_gate_open_special") , HELPER.auto(new Identifier("block/template_fence_gate_open")));
HELPER.addReFramedModel(ReFramed.id("fence_gate_wall_special") , HELPER.auto(new Identifier("block/template_fence_gate_wall")));
HELPER.addReFramedModel(ReFramed.id("fence_gate_wall_open_special") , HELPER.auto(new Identifier("block/template_fence_gate_wall_open")));
HELPER.addReFramedModel(ReFramed.id("glass_pane_post_special") , HELPER.auto(new Identifier("block/glass_pane_post")));
HELPER.addReFramedModel(ReFramed.id("glass_pane_noside_special") , HELPER.auto(new Identifier("block/glass_pane_noside")));
HELPER.addReFramedModel(ReFramed.id("glass_pane_noside_alt_special"), HELPER.auto(new Identifier("block/glass_pane_noside_alt")));
HELPER.addReFramedModel(ReFramed.id("pressure_plate_up_special") , HELPER.auto(new Identifier("block/pressure_plate_up")));
HELPER.addReFramedModel(ReFramed.id("pressure_plate_down_special") , HELPER.auto(new Identifier("block/pressure_plate_down")));
HELPER.addReFramedModel(ReFramed.id("slab_special") , HELPER.auto(new Identifier("block/slab")));
HELPER.addReFramedModel(ReFramed.id("double_slab_special") , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top")));
HELPER.addReFramedModel(ReFramed.id("stairs_special") , HELPER.auto(ReFramed.id("block/stairs")));
HELPER.addReFramedModel(ReFramed.id("double_outer_stairs_special") , HELPER.auto(ReFramed.id("block/double_outer_stairs")));
HELPER.addReFramedModel(ReFramed.id("inner_stairs_special") , HELPER.auto(ReFramed.id("block/inner_stairs")));
HELPER.addReFramedModel(ReFramed.id("outer_stairs_special") , HELPER.auto(ReFramed.id("block/outer_stairs")));
HELPER.addReFramedModel(ReFramed.id("outer_side_stairs_special") , HELPER.auto(ReFramed.id("block/outer_side_stairs")));
HELPER.addReFramedModel(ReFramed.id("trapdoor_bottom_special") , HELPER.auto(new Identifier("block/template_trapdoor_bottom")));
HELPER.addReFramedModel(ReFramed.id("trapdoor_top_special") , HELPER.auto(new Identifier("block/template_trapdoor_top")));
HELPER.addReFramedModel(ReFramed.id("wall_post_special") , HELPER.auto(new Identifier("block/template_wall_post")));
HELPER.addReFramedModel("button_special" , HELPER.auto(new Identifier("block/button")));
HELPER.addReFramedModel("button_pressed_special" , HELPER.auto(new Identifier("block/button_pressed")));
HELPER.addReFramedModel("one_candle_special" , HELPER.auto(new Identifier("block/template_candle")));
HELPER.addReFramedModel("two_candles_special" , HELPER.auto(new Identifier("block/template_two_candles")));
HELPER.addReFramedModel("three_candles_special" , HELPER.auto(new Identifier("block/template_three_candles")));
HELPER.addReFramedModel("four_candles_special" , HELPER.auto(new Identifier("block/template_four_candles")));
HELPER.addReFramedModel("carpet_special" , HELPER.auto(new Identifier("block/carpet")));
HELPER.addReFramedModel("cube_special" , HELPER.auto(new Identifier("block/cube")));
HELPER.addReFramedModel("door_bottom_left_special" , HELPER.auto(new Identifier("block/door_bottom_left")));
HELPER.addReFramedModel("door_bottom_right_special" , HELPER.auto(new Identifier("block/door_bottom_right")));
HELPER.addReFramedModel("door_top_left_special" , HELPER.auto(new Identifier("block/door_top_left")));
HELPER.addReFramedModel("door_top_right_special" , HELPER.auto(new Identifier("block/door_top_right")));
HELPER.addReFramedModel("door_bottom_left_open_special" , HELPER.auto(new Identifier("block/door_bottom_left_open")));
HELPER.addReFramedModel("door_bottom_right_open_special" , HELPER.auto(new Identifier("block/door_bottom_right_open"))); //This is why we dont format code as tables kids
HELPER.addReFramedModel("door_top_left_open_special" , HELPER.auto(new Identifier("block/door_top_left_open")));
HELPER.addReFramedModel("door_top_right_open_special" , HELPER.auto(new Identifier("block/door_top_right_open")));
HELPER.addReFramedModel("fence_post_special" , HELPER.auto(new Identifier("block/fence_post")));
HELPER.addReFramedModel("fence_gate_special" , HELPER.auto(new Identifier("block/template_fence_gate")));
HELPER.addReFramedModel("fence_gate_open_special" , HELPER.auto(new Identifier("block/template_fence_gate_open")));
HELPER.addReFramedModel("fence_gate_wall_special" , HELPER.auto(new Identifier("block/template_fence_gate_wall")));
HELPER.addReFramedModel("fence_gate_wall_open_special" , HELPER.auto(new Identifier("block/template_fence_gate_wall_open")));
HELPER.addReFramedModel("glass_pane_post_special" , HELPER.auto(new Identifier("block/glass_pane_post")));
HELPER.addReFramedModel("glass_pane_noside_special" , HELPER.auto(new Identifier("block/glass_pane_noside")));
HELPER.addReFramedModel("glass_pane_noside_alt_special" , HELPER.auto(new Identifier("block/glass_pane_noside_alt")));
HELPER.addReFramedModel("pressure_plate_up_special" , HELPER.auto(new Identifier("block/pressure_plate_up")));
HELPER.addReFramedModel("pressure_plate_down_special" , HELPER.auto(new Identifier("block/pressure_plate_down")));
HELPER.addReFramedModel("slab_special" , HELPER.auto(new Identifier("block/slab")));
HELPER.addReFramedModel("double_slab_special" , HELPER.autoDouble(new Identifier("block/slab"), new Identifier("block/slab_top")));
HELPER.addReFramedModel("stairs_special" , HELPER.auto(ReFramed.id("block/stairs")));
HELPER.addReFramedModel("outers_stairs_special" , HELPER.auto(ReFramed.id("block/double_outer_stairs")));
HELPER.addReFramedModel("inner_stairs_special" , HELPER.auto(ReFramed.id("block/inner_stairs")));
HELPER.addReFramedModel("outer_stairs_special" , HELPER.auto(ReFramed.id("block/outer_stairs")));
HELPER.addReFramedModel("outer_side_stairs_special" , HELPER.auto(ReFramed.id("block/outer_side_stairs")));
HELPER.addReFramedModel("double_stairs_special" , HELPER.autoDouble(ReFramed.id("block/stairs"), ReFramed.id("block/stairs_complement")));
HELPER.addReFramedModel("double_outers_stairs_special" , HELPER.autoDouble(ReFramed.id("block/double_outer_stairs"), ReFramed.id("block/double_outer_stairs_complement")));
HELPER.addReFramedModel("double_inner_stairs_special" , HELPER.autoDouble(ReFramed.id("block/inner_stairs"), ReFramed.id("block/inner_stairs_complement")));
HELPER.addReFramedModel("double_outer_stairs_special" , HELPER.autoDouble(ReFramed.id("block/outer_stairs"), ReFramed.id("block/outer_stairs_complement")));
HELPER.addReFramedModel("double_outer_side_stairs_special", HELPER.autoDouble(ReFramed.id("block/outer_side_stairs"), ReFramed.id("block/outer_side_stairs_complement")));
HELPER.addReFramedModel("trapdoor_bottom_special" , HELPER.auto(new Identifier("block/template_trapdoor_bottom")));
HELPER.addReFramedModel("trapdoor_top_special" , HELPER.auto(new Identifier("block/template_trapdoor_top")));
HELPER.addReFramedModel("wall_post_special" , HELPER.auto(new Identifier("block/template_wall_post")));
//vanilla style models (using "special-sprite replacement" method)
HELPER.addReFramedModel(ReFramed.id("lever_special") , HELPER.json(ReFramed.id("block/lever")));
HELPER.addReFramedModel(ReFramed.id("trapdoor_open_special") , HELPER.json(ReFramed.id("block/trapdoor_open")));
HELPER.addReFramedModel(ReFramed.id("lever_on_special") , HELPER.json(ReFramed.id("block/lever_on")));
HELPER.addReFramedModel("lever_special" , HELPER.json(ReFramed.id("block/lever")));
HELPER.addReFramedModel("trapdoor_open_special" , HELPER.json(ReFramed.id("block/trapdoor_open")));
HELPER.addReFramedModel("lever_on_special" , HELPER.json(ReFramed.id("block/lever_on")));
//these next five only exist because AutoRetexturedModels don't seem to rotate their textures the right way when rotated from a multipart blockstate
HELPER.addReFramedModel(ReFramed.id("fence_side_special") , HELPER.json(ReFramed.id("block/fence_side")));
HELPER.addReFramedModel(ReFramed.id("glass_pane_side_special") , HELPER.json(ReFramed.id("block/glass_pane_side")));
HELPER.addReFramedModel(ReFramed.id("glass_pane_side_alt_special") , HELPER.json(ReFramed.id("block/glass_pane_side_alt")));
HELPER.addReFramedModel(ReFramed.id("wall_side_special") , HELPER.json(ReFramed.id("block/wall_side")));
HELPER.addReFramedModel(ReFramed.id("wall_side_tall_special") , HELPER.json(ReFramed.id("block/wall_side_tall")));
HELPER.addReFramedModel("fence_side_special" , HELPER.json(ReFramed.id("block/fence_side")));
HELPER.addReFramedModel("glass_pane_side_special" , HELPER.json(ReFramed.id("block/glass_pane_side")));
HELPER.addReFramedModel("glass_pane_side_alt_special" , HELPER.json(ReFramed.id("block/glass_pane_side_alt")));
HELPER.addReFramedModel("wall_side_special" , HELPER.json(ReFramed.id("block/wall_side")));
HELPER.addReFramedModel("wall_side_tall_special" , HELPER.json(ReFramed.id("block/wall_side_tall")));
//item only models
HELPER.addReFramedModel(ReFramed.id("button_inventory_special") , HELPER.auto(new Identifier("block/button_inventory")));
HELPER.addReFramedModel(ReFramed.id("fence_inventory_special") , HELPER.auto(new Identifier("block/fence_inventory")));
HELPER.addReFramedModel(ReFramed.id("fence_post_inventory_special") , HELPER.auto(ReFramed.id("block/fence_post_inventory")));
HELPER.addReFramedModel(ReFramed.id("wall_inventory_special") , HELPER.auto(new Identifier("block/wall_inventory")));
HELPER.addReFramedModel("button_inventory_special" , HELPER.auto(new Identifier("block/button_inventory")));
HELPER.addReFramedModel("fence_inventory_special" , HELPER.auto(new Identifier("block/fence_inventory")));
HELPER.addReFramedModel("fence_post_inventory_special" , HELPER.auto(ReFramed.id("block/fence_post_inventory")));
HELPER.addReFramedModel("wall_inventory_special" , HELPER.auto(new Identifier("block/wall_inventory")));
//item model assignments (in lieu of models/item/___.json)
HELPER.assignItemModel(ReFramed.id("button_inventory_special") , ReFramed.BUTTON);
HELPER.assignItemModel(ReFramed.id("carpet_special") , ReFramed.CARPET);
HELPER.assignItemModel(ReFramed.id("cube_special") , ReFramed.CUBE);
HELPER.assignItemModel(ReFramed.id("fence_inventory_special") , ReFramed.FENCE);
HELPER.assignItemModel(ReFramed.id("fence_gate_special") , ReFramed.FENCE_GATE);
HELPER.assignItemModel(ReFramed.id("trapdoor_bottom_special") , ReFramed.IRON_TRAPDOOR);
HELPER.assignItemModel(ReFramed.id("fence_post_inventory_special") , ReFramed.POST);
HELPER.assignItemModel(ReFramed.id("pressure_plate_up_special") , ReFramed.PRESSURE_PLATE);
HELPER.assignItemModel(ReFramed.id("slab_special") , ReFramed.SLAB);
HELPER.assignItemModel(ReFramed.id("double_slab_special") , ReFramed.DOUBLE_SLAB);
HELPER.assignItemModel(ReFramed.id("stairs_special") , ReFramed.STAIRS);
HELPER.assignItemModel(ReFramed.id("trapdoor_bottom_special") , ReFramed.TRAPDOOR);
HELPER.assignItemModel(ReFramed.id("wall_inventory_special") , ReFramed.WALL);
HELPER.assignItemModel("button_inventory_special" , ReFramed.BUTTON);
HELPER.assignItemModel("carpet_special" , ReFramed.CARPET);
HELPER.assignItemModel("cube_special" , ReFramed.CUBE);
HELPER.assignItemModel("fence_inventory_special" , ReFramed.FENCE);
HELPER.assignItemModel("fence_gate_special" , ReFramed.FENCE_GATE);
HELPER.assignItemModel("trapdoor_bottom_special" , ReFramed.IRON_TRAPDOOR);
HELPER.assignItemModel("fence_post_inventory_special" , ReFramed.POST);
HELPER.assignItemModel("pressure_plate_up_special" , ReFramed.PRESSURE_PLATE);
HELPER.assignItemModel("slab_special" , ReFramed.SLAB);
HELPER.assignItemModel("double_slab_special" , ReFramed.DOUBLE_SLAB);
HELPER.assignItemModel("stairs_special" , ReFramed.STAIRS);
HELPER.assignItemModel("double_stairs_special" , ReFramed.DOUBLE_STAIRS);
HELPER.assignItemModel("trapdoor_bottom_special" , ReFramed.TRAPDOOR);
HELPER.assignItemModel("wall_inventory_special" , ReFramed.WALL);
}
private void privateInit() {

View File

@ -1,5 +1,6 @@
package fr.adrien1106.reframed.client;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.client.model.UnbakedAutoRetexturedModel;
import fr.adrien1106.reframed.client.model.UnbakedDoubleRetexturedModel;
import fr.adrien1106.reframed.client.model.UnbakedJsonRetexturedModel;
@ -38,12 +39,12 @@ public class ReFramedClientHelper {
return new UnbakedDoubleRetexturedModel(auto(first), auto(second));
}
public void addReFramedModel(Identifier id, UnbakedModel unbaked) {
prov.addReFramedModel(id, unbaked);
public void addReFramedModel(String id, UnbakedModel unbaked) {
prov.addReFramedModel(ReFramed.id(id), unbaked);
}
public void assignItemModel(Identifier model_id, ItemConvertible... item_convertibles) {
prov.assignItemModel(model_id, item_convertibles);
public void assignItemModel(String id, ItemConvertible... item_convertibles) {
prov.assignItemModel(ReFramed.id(id), item_convertibles);
}
public CamoAppearanceManager getCamoApperanceManager(Function<SpriteIdentifier, Sprite> spriteLookup) {

View File

@ -13,7 +13,7 @@ public class Generator implements DataGeneratorEntrypoint {
/**
* missing DOOR, IRON_DOOR, CANDLE
*/
public static List<Block> BLOCKS = List.of(CUBE, STAIRS, SLAB, DOUBLE_SLAB, POST, FENCE, FENCE_GATE, TRAPDOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE);
public static List<Block> BLOCKS = List.of(CUBE, STAIRS, DOUBLE_STAIRS, SLAB, DOUBLE_SLAB, POST, FENCE, FENCE_GATE, TRAPDOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE);
@Override
public void onInitializeDataGenerator(FabricDataGenerator data_generator) {
FabricDataGenerator.Pack myPack = data_generator.createPack();

View File

@ -0,0 +1,51 @@
{
"credit": "Made with Blockbench",
"parent": "minecraft:block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [8, 8, 0],
"to": [16, 16, 8],
"faces": {
"north": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [8, 0, 16, 8], "texture": "#side"},
"up": {"uv": [8, 0, 16, 8], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 8, 16, 16], "texture": "#bottom"}
}
},
{
"from": [0, 0, 0],
"to": [8, 8, 8],
"faces": {
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 8, 16, 16], "texture": "#side"},
"south": {"uv": [0, 8, 8, 16], "texture": "#side"},
"west": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "west"},
"down": {"uv": [8, 0, 16, 8], "texture": "#bottom", "cullface": "down"}
}
},
{
"from": [0, 8, 0],
"to": [8, 16, 8],
"faces": {
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
"west": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 8], "texture": "#top", "cullface": "up"}
}
},
{
"from": [0, 8, 8],
"to": [8, 16, 16],
"faces": {
"east": {"uv": [0, 0, 8, 8], "texture": "#side"},
"south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 8], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"credit": "Made with Blockbench",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [8, 16, 8],
"faces": {
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 0, 16, 8], "texture": "#side"},
"south": {"uv": [0, 0, 8, 8], "texture": "#side"},
"west": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 8], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 8, 8, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,48 @@
{
"credit": "Made with Blockbench",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [8, 16, 8],
"faces": {
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 0, 16, 8], "texture": "#side"},
"west": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 8], "texture": "#top", "cullface": "up"}
}
},
{
"from": [0, 8, 8],
"to": [8, 16, 16],
"faces": {
"east": {"uv": [0, 0, 8, 8], "texture": "#side"},
"south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 8], "texture": "#bottom"}
}
},
{
"from": [0, 0, 0],
"to": [8, 8, 8],
"faces": {
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 8, 16, 16], "texture": "#side"},
"south": {"uv": [0, 8, 8, 16], "texture": "#side"},
"west": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "west"},
"down": {"uv": [0, 8, 8, 16], "texture": "#bottom", "cullface": "down"}
}
}
],
"groups": [
{
"name": "outer_stairs",
"origin": [8, 8, 8],
"color": 0,
"children": [0, 1, 2]
}
]
}

View File

@ -0,0 +1,40 @@
{
"credit": "Made with Blockbench",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 8],
"to": [8, 16, 16],
"faces": {
"east": {"uv": [0, 0, 8, 8], "texture": "#side"},
"south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 8, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 8], "texture": "#bottom"}
}
},
{
"from": [8, 8, 0],
"to": [16, 16, 8],
"faces": {
"north": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "east"},
"south": {"uv": [9, 0, 16, 8], "texture": "#side"},
"up": {"uv": [8, 0, 16, 8], "texture": "#top", "cullface": "up"},
"down": {"uv": [8, 8, 16, 16], "texture": "#bottom"}
}
},
{
"from": [0, 8, 0],
"to": [8, 16, 8],
"faces": {
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
"west": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 8], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 8, 8, 16], "texture": "#bottom"}
}
}
]
}

View File

@ -0,0 +1,35 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"particle": "#side"
},
"elements": [
{
"from": [0, 8, 0],
"to": [8, 16, 16],
"faces": {
"north": {"uv": [8, 0, 16, 8], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 0, 16, 8], "texture": "#side"},
"south": {"uv": [0, 0, 8, 8], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 16], "texture": "#top", "cullface": "up"},
"down": {"uv": [0, 0, 8, 16], "texture": "#bottom"}
}
}
],
"display": {
"thirdperson_lefthand": {
"rotation": [75, -135, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"gui": {
"rotation": [30, 135, 0],
"scale": [0.625, 0.625, 0.625]
},
"head": {
"rotation": [0, -90, 0]
}
}
}