8 Commits

Author SHA1 Message Date
ef76408b80 Merge pull request 'fix and new block' (#22) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m32s
Reviewed-on: #22
2024-06-16 18:22:10 +02:00
8a9fbd9109 feat: added SlabsStair block 2024-06-16 18:17:04 +02:00
a76714d54d fix: render issue with items in axiom 2024-06-16 15:17:48 +02:00
b99f315c6f docs: updated objectives for publish 2024-06-14 17:46:47 +02:00
73bf27bdda Merge pull request 'fix: more checks on ThemedEntity Class (Always more to fix)' (#21) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m8s
Reviewed-on: #21
2024-06-14 17:17:37 +02:00
7df46a4b76 fix: more checks on ThemedEntity Class 2024-06-14 17:16:53 +02:00
402caaf549 Merge pull request 'fix: more injection fix + bad culling' (#20) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m5s
Reviewed-on: #20
2024-06-14 16:53:17 +02:00
42049047f7 fix: more injection fix + bad culling 2024-06-14 16:51:25 +02:00
25 changed files with 548 additions and 32 deletions

View File

@@ -22,8 +22,6 @@ or based on preferences add the person(s) to the project
### What Shapes are planed to be added
Currently, the list of shapes to be added is pretty simple as the mod is still under development:
- Pressure Plate
- Carpet (maybe redundant with Layer)
- Half Slab (maybe redundant with Layer)
- Slabs Stair (a stair with one end being of a second theme, might be done in multiple blocks)
Any Ideas feel free to make a suggestion [here](https://github.com/DriHut/ReFramed/issues).

View File

@@ -9,7 +9,7 @@ loader_version=0.15.11
# Mod Properties
modrinth_id = jCpoCBpn
mod_version = 1.6.1
mod_version = 1.6.4
maven_group = fr.adrien1106
archives_base_name = ReFramed
mod_id = reframed

View File

@@ -28,10 +28,10 @@ import java.util.stream.Stream;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
/**
* TODO Dynamic Ambient Occlusion -> for v1.6
* TODO add minecraft models like wall fence etc -> for v1.6
* TODO better connected textures -> maybe v1.6 ?
* TODO Dynamic Ambient Occlusion -> not scheduled
* TODO better connected textures -> not scheduled
* TODO support continuity overlays -> not scheduled
* TODO slopes -> thinking about it
*/
public class ReFramed implements ModInitializer {
public static final String MODID = "reframed";
@@ -42,7 +42,7 @@ public class ReFramed implements ModInitializer {
SMALL_CUBE, SMALL_CUBES_STEP,
STAIR, STAIRS_CUBE,
HALF_STAIR, HALF_STAIRS_SLAB, HALF_STAIRS_STAIR,
SLAB, SLABS_CUBE,
SLAB, SLABS_CUBE, SLABS_STAIR,
STEP, STEPS_SLAB,
LAYER,
PILLAR, PILLARS_WALL, WALL,
@@ -73,6 +73,7 @@ public class ReFramed implements ModInitializer {
LAYER = registerBlock("layer" , new ReFramedLayerBlock(cp(Blocks.OAK_SLAB)));
SLAB = registerBlock("slab" , new ReFramedSlabBlock(cp(Blocks.OAK_SLAB)));
SLABS_CUBE = registerBlock("slabs_cube" , new ReFramedSlabsCubeBlock(cp(Blocks.OAK_SLAB)));
SLABS_STAIR = registerBlock("slabs_stair" , new ReFramedSlabsStairBlock(cp(Blocks.OAK_STAIRS)));
STEP = registerBlock("step" , new ReFramedStepBlock(cp(Blocks.OAK_SLAB)));
STEPS_SLAB = registerBlock("steps_slab" , new ReFramedStepsSlabBlock(cp(Blocks.OAK_SLAB)));
PILLAR = registerBlock("pillar" , new ReFramedPillarBlock(cp(Blocks.OAK_FENCE)));

View File

@@ -101,7 +101,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return HALF_STAIR_VOXELS[state.get(CORNER_FACE) + state.get(CORNER).getID() * 3];
return getHalfStairShape(state.get(CORNER), state.get(CORNER_FACE));
}
@Override
@@ -131,6 +131,10 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock {
return super.getThemeMap(state, new_state);
}
public static VoxelShape getHalfStairShape(Corner corner, int face) {
return HALF_STAIR_VOXELS[face + corner.getID() * 3];
}
static {
final VoxelShape HALF_STAIR = VoxelShapes.combineAndSimplify(
createCuboidShape(8, 0, 0, 16, 16, 8),

View File

@@ -15,9 +15,9 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.HALF_STAIR_VOXELS;
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape;
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.SMALL_CUBE_VOXELS;
import static fr.adrien1106.reframed.block.ReFramedSmallCubeBlock.getSmallCubeShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE;
import static fr.adrien1106.reframed.util.blocks.Corner.NORTH_EAST_DOWN;
@@ -45,7 +45,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
return isGhost(view, pos) ? empty(): getSlabShape(state.get(CORNER).getDirection(state.get(CORNER_FACE)));
return isGhost(view, pos) ? empty(): getOutlineShape(state, view, pos, ctx);
}
@Override
@@ -72,7 +72,7 @@ public class ReFramedHalfStairsSlabBlock extends WaterloggableReFramedDoubleBloc
Corner corner = state.get(CORNER);
int face = state.get(CORNER_FACE);
return i == 2
? SMALL_CUBE_VOXELS[corner.getOpposite(face).getID()]
: HALF_STAIR_VOXELS[face + corner.getID() * 3];
? getSmallCubeShape(corner.getOpposite(face))
: getHalfStairShape(corner, face);
}
}

View File

@@ -17,7 +17,7 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.HALF_STAIR_VOXELS;
import static fr.adrien1106.reframed.block.ReFramedHalfStairBlock.getHalfStairShape;
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.Edge.*;
@@ -72,7 +72,7 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo
side
);
return HALF_STAIR_VOXELS[corner.getID() * 3 + corner.getDirectionIndex(side)];
return getHalfStairShape(corner, corner.getDirectionIndex(side));
}
@Override

View File

@@ -0,0 +1,78 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.util.blocks.BlockHelper;
import fr.adrien1106.reframed.util.blocks.Edge;
import fr.adrien1106.reframed.util.blocks.StairShape;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.getSlabShape;
import static fr.adrien1106.reframed.block.ReFramedStairBlock.getStairShape;
import static fr.adrien1106.reframed.block.ReFramedStepBlock.getStepShape;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.util.shape.VoxelShapes.empty;
public class ReFramedSlabsStairBlock extends WaterloggableReFramedDoubleBlock {
public ReFramedSlabsStairBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(EDGE, Edge.NORTH_DOWN).with(EDGE_FACE, 0));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(EDGE, EDGE_FACE));
}
@Override
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
Edge edge = BlockHelper.getPlacementEdge(ctx);
return super.getPlacementState(ctx)
.with(EDGE, edge)
.with(EDGE_FACE, edge.getDirectionIndex(ctx.getSide().getOpposite()));
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
return isGhost(view, pos) ? empty() : getOutlineShape(state, view, pos, ctx);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return getStairShape(state.get(EDGE), StairShape.STRAIGHT);
}
@Override
public BlockState rotate(BlockState state, BlockRotation rotation) {
Edge edge = state.get(EDGE).rotate(rotation);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(rotation.rotate(face)));
}
@Override
public BlockState mirror(BlockState state, BlockMirror mirror) {
Edge edge = state.get(EDGE).mirror(mirror);
Direction face = state.get(EDGE).getDirection(state.get(EDGE_FACE));
return state.with(EDGE, edge).with(EDGE_FACE, edge.getDirectionIndex(mirror.apply(face)));
}
@Override
public VoxelShape getShape(BlockState state, int i) {
Edge edge = state.get(EDGE);
Direction face = edge.getDirection(state.get(EDGE_FACE));
return i == 2
? getStepShape(edge.getOpposite(edge.getOtherDirection(face)))
: getSlabShape(face);
}
}

View File

@@ -125,7 +125,7 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return SMALL_CUBE_VOXELS[state.get(CORNER).getID()];
return getSmallCubeShape(state.get(CORNER));
}
@Override
@@ -151,6 +151,10 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock {
return super.getThemeMap(state, new_state);
}
public static VoxelShape getSmallCubeShape(Corner corner) {
return SMALL_CUBE_VOXELS[corner.getID()];
}
static {
final VoxelShape SMALL_CUBE = VoxelShapes.cuboid(.5f, 0f, 0f, 1f, .5f, .5f);

View File

@@ -144,6 +144,9 @@ public class ReFramedClient implements ClientModInitializer {
// POST FENCE
HELPER.addReFramedModel("post_fence_inventory" , HELPER.autoDouble(ReFramed.id("block/post"), ReFramed.id("block/fence/full/inventory")));
HELPER.addReFramedModel("post_fence_side" , HELPER.autoDouble(ReFramed.id("block/fence/full/side_core"), ReFramed.id("block/fence/full/side_bars")));
// SLABS STAIR
HELPER.addReFramedModel("slabs_stair" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/slab"), ReFramed.id("block/slabs_stair/step")));
HELPER.addReFramedModel("slabs_stair_side" , HELPER.autoDouble(ReFramed.id("block/slabs_stair/side/slab"), ReFramed.id("block/slabs_stair/side/step")));
//item model assignments (in lieu of models/item/___.json)
@@ -170,6 +173,7 @@ public class ReFramedClient implements ClientModInitializer {
HELPER.assignItemModel("post" , ReFramed.POST);
HELPER.assignItemModel("fence_inventory" , ReFramed.FENCE);
HELPER.assignItemModel("post_fence_inventory" , ReFramed.POST_FENCE);
HELPER.assignItemModel("slabs_stair" , ReFramed.SLABS_STAIR);
}
private void privateInit() {

View File

@@ -85,7 +85,7 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel {
appearance_manager.getDefaultAppearance(theme_index),
0
),
state
state == null ? item_state : state
)
);
}

View File

@@ -26,6 +26,7 @@ public class GBlockstate extends FabricModelProvider {
providers.put(ReFramedPillarBlock.class, new Pillar());
providers.put(ReFramedSlabBlock.class, new Slab());
providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube());
providers.put(ReFramedSlabsStairBlock.class, new SlabsStair());
providers.put(ReFramedSmallCubeBlock.class, new SmallCube());
providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep());
providers.put(ReFramedStairBlock.class, new Stair());

View File

@@ -28,6 +28,7 @@ public class GRecipe extends FabricRecipeProvider {
providers.put(ReFramedPillarBlock.class, new Pillar());
providers.put(ReFramedSlabBlock.class, new Slab());
providers.put(ReFramedSlabsCubeBlock.class, new SlabsCube());
providers.put(ReFramedSlabsStairBlock.class, new SlabsStair());
providers.put(ReFramedSmallCubeBlock.class, new SmallCube());
providers.put(ReFramedSmallCubesStepBlock.class, new SmallCubesStep());
providers.put(ReFramedStairBlock.class, new Stair());

View File

@@ -0,0 +1,97 @@
package fr.adrien1106.reframed.generator.block;
import fr.adrien1106.reframed.ReFramed;
import fr.adrien1106.reframed.generator.BlockStateProvider;
import fr.adrien1106.reframed.generator.GBlockstate;
import fr.adrien1106.reframed.generator.RecipeSetter;
import fr.adrien1106.reframed.util.blocks.Edge;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Block;
import net.minecraft.data.client.MultipartBlockStateSupplier;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.RecipeProvider;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE_FACE;
import static net.minecraft.data.client.VariantSettings.Rotation.*;
public class SlabsStair implements RecipeSetter, BlockStateProvider {
@Override
public void setRecipe(RecipeExporter exporter, ItemConvertible convertible) {
RecipeProvider.offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, convertible, ReFramed.CUBE);
ShapelessRecipeJsonBuilder
.create(RecipeCategory.BUILDING_BLOCKS, convertible)
.input(ReFramed.STEP)
.input(ReFramed.SLAB)
.criterion(FabricRecipeProvider.hasItem(ReFramed.CUBE), FabricRecipeProvider.conditionsFromItem(ReFramed.CUBE))
.criterion(FabricRecipeProvider.hasItem(convertible), FabricRecipeProvider.conditionsFromItem(convertible))
.offerTo(exporter);
}
@Override
public MultipartBlockStateSupplier getMultipart(Block block) {
Identifier model_id = ReFramed.id("slabs_stair_special");
Identifier side_id = ReFramed.id("slabs_stair_side_special");
return MultipartBlockStateSupplier.create(block)
// BOTTOM
.with(GBlockstate.when(EDGE, Edge.DOWN_EAST, EDGE_FACE, 0),
GBlockstate.variant(model_id, true, R0, R0))
.with(GBlockstate.when(EDGE, Edge.DOWN_SOUTH, EDGE_FACE, 0),
GBlockstate.variant(model_id, true, R0, R90))
.with(GBlockstate.when(EDGE, Edge.WEST_DOWN, EDGE_FACE, 1),
GBlockstate.variant(model_id, true, R0, R180))
.with(GBlockstate.when(EDGE, Edge.NORTH_DOWN, EDGE_FACE, 1),
GBlockstate.variant(model_id, true, R0, R270))
// TOP
.with(GBlockstate.when(EDGE, Edge.EAST_UP, EDGE_FACE, 1),
GBlockstate.variant(model_id, true, R180, R0))
.with(GBlockstate.when(EDGE, Edge.SOUTH_UP, EDGE_FACE, 1),
GBlockstate.variant(model_id, true, R180, R90))
.with(GBlockstate.when(EDGE, Edge.UP_WEST, EDGE_FACE, 0),
GBlockstate.variant(model_id, true, R180, R180))
.with(GBlockstate.when(EDGE, Edge.UP_NORTH, EDGE_FACE, 0),
GBlockstate.variant(model_id, true, R180, R270))
// EAST
.with(GBlockstate.when(EDGE, Edge.EAST_SOUTH, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R0, R0))
.with(GBlockstate.when(EDGE, Edge.EAST_UP, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R90, R0))
.with(GBlockstate.when(EDGE, Edge.NORTH_EAST, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R180, R0))
.with(GBlockstate.when(EDGE, Edge.DOWN_EAST, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R270, R0))
// SOUTH
.with(GBlockstate.when(EDGE, Edge.SOUTH_WEST, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R0, R90))
.with(GBlockstate.when(EDGE, Edge.SOUTH_UP, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R90, R90))
.with(GBlockstate.when(EDGE, Edge.EAST_SOUTH, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R180, R90))
.with(GBlockstate.when(EDGE, Edge.DOWN_SOUTH, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R270, R90))
// WEST
.with(GBlockstate.when(EDGE, Edge.WEST_NORTH, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R0, R180))
.with(GBlockstate.when(EDGE, Edge.UP_WEST, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R90, R180))
.with(GBlockstate.when(EDGE, Edge.SOUTH_WEST, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R180, R180))
.with(GBlockstate.when(EDGE, Edge.WEST_DOWN, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R270, R180))
// NORTH
.with(GBlockstate.when(EDGE, Edge.NORTH_EAST, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R0, R270))
.with(GBlockstate.when(EDGE, Edge.UP_NORTH, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R90, R270))
.with(GBlockstate.when(EDGE, Edge.WEST_NORTH, EDGE_FACE, 1),
GBlockstate.variant(side_id, true, R180, R270))
.with(GBlockstate.when(EDGE, Edge.NORTH_DOWN, EDGE_FACE, 0),
GBlockstate.variant(side_id, true, R270, R270))
;
}
}

View File

@@ -6,11 +6,13 @@ import com.moulberry.axiom.utils.IntMatrix;
import com.moulberry.axiom.world_modification.CompressedBlockEntity;
import fr.adrien1106.reframed.client.model.MultiRetexturableModel;
import fr.adrien1106.reframed.client.model.RetexturingBakedModel;
import fr.adrien1106.reframed.util.DefaultList;
import fr.adrien1106.reframed.util.mixin.IAxiomChunkedBlockRegionMixin;
import fr.adrien1106.reframed.util.mixin.IMultipartBakedModelMixin;
import fr.adrien1106.reframed.util.mixin.ThemedBlockEntity;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Camera;
@@ -78,15 +80,19 @@ public abstract class AxiomChunkedBlockRegionMixin implements IAxiomChunkedBlock
cancellable = true)
private static void onRenderBlock(BufferBuilder blockBuilder, BlockRenderManager renderer, BlockPos.Mutable pos, Random rand, MatrixStack matrices, BlockRenderView world, Matrix4f currentPoseMatrix, Matrix4f basePoseMatrix, int x, int y, int z, BlockState state, boolean useAmbientOcclusion, CallbackInfo ci, @Local BakedModel model) {
List<BakedModel> models;
if ((models = getModels(model, state)).isEmpty() // not a retexturable model
|| !(world.getBlockEntity(pos) instanceof ThemedBlockEntity block_entity) // not a themed block entity
) return;
if ((models = getModels(model, state)).isEmpty()) return;
DefaultList<BlockState> themes = new DefaultList<>(
Blocks.AIR.getDefaultState(),
world.getBlockEntity(pos) instanceof ThemedBlockEntity themed
? themed.getThemes()
: List.of()
);
models.stream().flatMap(m -> m instanceof MultiRetexturableModel mm
? mm.models().stream()
: Stream.of((RetexturingBakedModel)m)
).forEach(m -> {
m.setCamo(world, block_entity.getTheme(m.getThemeIndex()), pos);
m.setCamo(world, themes.get(m.getThemeIndex() - 1), pos);
if (useAmbientOcclusion && state.getLuminance() == 0 && m.useAmbientOcclusion()) renderer.getModelRenderer()
.renderSmooth(world, m, state, pos, matrices, blockBuilder, true, rand, state.getRenderingSeed(pos), OverlayTexture.DEFAULT_UV);
else renderer.getModelRenderer()

View File

@@ -1,6 +1,5 @@
package fr.adrien1106.reframed.mixin.compat;
import com.llamalad7.mixinextras.sugar.Local;
import fr.adrien1106.reframed.client.util.RenderHelper;
import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity;
import fr.adrien1106.reframed.util.mixin.IBlockRenderInfoMixin;
@@ -24,7 +23,6 @@ public abstract class IndiumBlockRenderInfoMixin implements IBlockRenderInfoMixi
@Shadow public BlockPos blockPos;
@Shadow public BlockRenderView blockView;
@Shadow public BlockState blockState;
@Shadow(remap = false) private int cullResultFlags;
@Unique private int theme_index = 0;
@Unique private int model_hash = 0;
@@ -32,19 +30,18 @@ public abstract class IndiumBlockRenderInfoMixin implements IBlockRenderInfoMixi
@Inject(
method = "shouldDrawFace",
at = @At(
value = "INVOKE",
target = "Llink/infra/indium/renderer/render/BlockRenderInfo;shouldDrawFaceInner(Lnet/minecraft/util/math/Direction;)Z"
value = "INVOKE_ASSIGN",
target = "Lnet/minecraft/util/math/Direction;getId()I",
shift = At.Shift.AFTER
),
cancellable = true
)
private void shouldDrawInnerFace(Direction face, CallbackInfoReturnable<Boolean> cir, @Local int mask) {
private void shouldDrawInnerFace(Direction face, CallbackInfoReturnable<Boolean> cir) {
BlockPos other_pos = blockPos.offset(face);
if (!(blockView.getBlockEntity(blockPos) instanceof ThemeableBlockEntity
|| blockView.getBlockEntity(other_pos) instanceof ThemeableBlockEntity)
) return;
boolean result = RenderHelper.shouldDrawSide(blockState, blockView, blockPos, face, other_pos, theme_index);
if (result) cullResultFlags |= mask;
cir.setReturnValue(result);
cir.setReturnValue(RenderHelper.shouldDrawSide(blockState, blockView, blockPos, face, other_pos, theme_index));
}
@Override

View File

@@ -42,7 +42,6 @@ public abstract class IndiumNonTerrainBlockRenderContextMixin extends AbstractBl
target = "Llink/infra/indium/renderer/render/BlockRenderInfo;prepareForWorld(Lnet/minecraft/world/BlockRenderView;Z)V",
shift = At.Shift.AFTER
),
remap = false,
cancellable = true
)
private void renderMultipleModels(BlockRenderView blockView, BakedModel wrapper, BlockState state, BlockPos pos, MatrixStack matrixStack, VertexConsumer buffer, boolean cull, Random random, long seed, int overlay, CallbackInfo ci) {

View File

@@ -0,0 +1,140 @@
package fr.adrien1106.reframed.util;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public class DefaultList<T> implements List<T> {
protected T default_value;
protected List<T> elements;
public DefaultList(T default_value, List<T> elements) {
this.default_value = default_value;
this.elements = elements;
}
@Override
public int size() {
return elements.size();
}
@Override
public boolean isEmpty() {
return elements.isEmpty();
}
@Override
public boolean contains(Object o) {
return elements.contains(o) || default_value.equals(o);
}
@NotNull
@Override
public Iterator<T> iterator() {
return elements.iterator();
}
@NotNull
@Override
public Object[] toArray() {
return elements.toArray();
}
@NotNull
@Override
public <T1> T1[] toArray(@NotNull T1[] a) {
return elements.toArray(a);
}
@Override
public boolean add(T t) {
return elements.add(t);
}
@Override
public boolean remove(Object o) {
return elements.remove(o);
}
@Override
public boolean containsAll(@NotNull Collection<?> c) {
return elements.containsAll(c);
}
@Override
public boolean addAll(@NotNull Collection<? extends T> c) {
return elements.addAll(c);
}
@Override
public boolean addAll(int index, @NotNull Collection<? extends T> c) {
return elements.addAll(index, c);
}
@Override
public boolean removeAll(@NotNull Collection<?> c) {
return elements.removeAll(c);
}
@Override
public boolean retainAll(@NotNull Collection<?> c) {
return elements.retainAll(c);
}
@Override
public void clear() {
elements.clear();
}
@Override
public T get(int index) {
return index < elements.size() && index >= 0 ? elements.get(index) : default_value;
}
@Override
public T set(int index, T element) {
return elements.set(index, element);
}
@Override
public void add(int index, T element) {
elements.add(index, element);
}
@Override
public T remove(int index) {
return elements.remove(index);
}
@Override
public int indexOf(Object o) {
return elements.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
return elements.lastIndexOf(o);
}
@NotNull
@Override
public ListIterator<T> listIterator() {
return elements.listIterator();
}
@NotNull
@Override
public ListIterator<T> listIterator(int index) {
return elements.listIterator();
}
@NotNull
@Override
public List<T> subList(int fromIndex, int toIndex) {
return elements.subList(fromIndex, toIndex);
}
}

View File

@@ -7,6 +7,7 @@ import net.minecraft.state.property.IntProperty;
public class BlockProperties {
public static final BooleanProperty LIGHT = BooleanProperty.of("emits_light");
public static final EnumProperty<Edge> EDGE = EnumProperty.of("edge", Edge.class);
public static final IntProperty EDGE_FACE = IntProperty.of("face", 0, 1);
public static final EnumProperty<Corner> CORNER = EnumProperty.of("corner", Corner.class);
public static final IntProperty CORNER_FACE = IntProperty.of("face", 0, 2);
public static final EnumProperty<StairShape> STAIR_SHAPE = EnumProperty.of("shape", StairShape.class);

View File

@@ -106,6 +106,22 @@ public enum Edge implements StringIdentifiable {
.findFirst().orElse(Edge.NORTH_DOWN);
}
public Direction getDirection(int side) {
return side == 1 ? second_direction : first_direction;
}
public int getDirectionIndex(Direction direction) {
return direction == first_direction ? 0 : 1;
}
public Edge getOpposite(int index) {
return getOpposite(getDirection(index));
}
public Edge getOpposite(Direction direction) {
return getByDirections(direction, getOtherDirection(direction).getOpposite());
}
public Edge rotate(BlockRotation rotation) {
return getByDirections(
rotation.rotate(first_direction),

View File

@@ -2,6 +2,7 @@ package fr.adrien1106.reframed.util.mixin;
import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper;
@@ -29,11 +30,16 @@ public class ThemedBlockEntity extends BlockEntity implements ThemeableBlockEnti
@Override
public BlockState getTheme(int i) {
if (i > themes.size())
return Blocks.AIR.getDefaultState();
return themes.get(Math.max(0, i-1));
}
@Override
public void setTheme(BlockState state, int i) {
if (i > themes.size())
themes.add(state);
else
themes.set(Math.max(0, i-1), state);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
"to": [8, 8, 16],
"faces": {
"north": {"uv": [8, 8, 16, 16], "texture": "#side", "cullface": "north"},
"east": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "east"},
"east": {"uv": [0, 8, 16, 16], "texture": "#side"},
"south": {"uv": [0, 8, 8, 16], "texture": "#side", "cullface": "south"},
"west": {"uv": [0, 8, 16, 16], "texture": "#side", "cullface": "west"},
"up": {"uv": [0, 0, 8, 16], "texture": "#top"},