Fixed compacting drawers render and voxel boxes

This commit is contained in:
Buuz135 2021-12-20 17:27:16 +01:00
parent 69c25794b0
commit 74bd22480c
2 changed files with 18 additions and 17 deletions

View File

@ -50,23 +50,23 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
public static Multimap<Direction, VoxelShape> CACHED_SHAPES = MultimapBuilder.hashKeys().arrayListValues().build(); public static Multimap<Direction, VoxelShape> CACHED_SHAPES = MultimapBuilder.hashKeys().arrayListValues().build();
static { static {
CACHED_SHAPES.put(Direction.NORTH, Shapes.box(1/16D, 1/16D, 0, 8/16D, 8/16D, 1/16D)); CACHED_SHAPES.put(Direction.NORTH, Shapes.box(1/16D, 1/16D, 0, 7/16D, 7/16D, 1/16D));
CACHED_SHAPES.put(Direction.NORTH, Shapes.box(8/16D, 1/16D, 0, 15/16D, 8/16D, 1/16D)); CACHED_SHAPES.put(Direction.NORTH, Shapes.box(9/16D, 1/16D, 0, 15/16D, 7/16D, 1/16D));
CACHED_SHAPES.put(Direction.NORTH, Shapes.box(1/16D, 8/16D, 0, 15/16D, 15/16D, 1/16D)); CACHED_SHAPES.put(Direction.NORTH, Shapes.box(1/16D, 9/16D, 0, 15/16D, 15/16D, 1/16D));
CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(8/16D, 1/16D, 15/16D, 15/16D, 8/16D, 1)); CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(9/16D, 1/16D, 15/16D, 15/16D, 7/16D, 1));
CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(1/16D, 1/16D, 15/16D, 8/16D, 8/16D, 1)); CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(1/16D, 1/16D, 15/16D, 7/16D, 7/16D, 1));
CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(1/16D, 8/16D, 15/16D, 15/16D, 15/16D, 1)); CACHED_SHAPES.put(Direction.SOUTH, Shapes.box(1/16D, 9/16D, 15/16D, 15/16D, 15/16D, 1));
CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 1/16D, 1/16D, 1, 8/16D, 7/16D)); CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 1/16D, 1/16D, 1, 7/16D, 7/16D));
CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 1/16D, 8/16D, 1, 8/16D, 15/16D)); CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 1/16D, 9/16D, 1, 7/16D, 15/16D));
CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 8/16D, 1/16D, 1, 15/16D, 15/16D)); CACHED_SHAPES.put(Direction.EAST, Shapes.box(15/16D, 9/16D, 1/16D, 1, 15/16D, 15/16D));
CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 1/16D, 8/16D, 1/16D, 8/16D, 15/16D)); CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 1/16D, 9/16D, 1/16D, 7/16D, 15/16D));
CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 1/16D, 1/16D, 1/16D, 8/16D, 7/16D)); CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 1/16D, 1/16D, 1/16D, 7/16D, 7/16D));
CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 8/16D, 1/16D, 1/16D, 15/16D, 15/16D)); CACHED_SHAPES.put(Direction.WEST, Shapes.box(0, 9/16D, 1/16D, 1/16D, 15/16D, 15/16D));
} }
public CompactingDrawerBlock(String name) { public CompactingDrawerBlock(String name) {
super(name, Properties.copy(Blocks.OAK_PLANKS), CompactingDrawerTile.class); super(name, Properties.copy(Blocks.STONE_BRICKS), CompactingDrawerTile.class);
setItemGroup(FunctionalStorage.TAB); setItemGroup(FunctionalStorage.TAB);
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH)); registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH));
} }

View File

@ -36,7 +36,7 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD
Direction facing = tile.getFacingDirection(); Direction facing = tile.getFacingDirection();
matrixStack.mulPose(Vector3f.YP.rotationDegrees(-180)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(-180));
matrixStack.last().normal().load(FAKE_NORMALS); if (facing != Direction.SOUTH) matrixStack.last().normal().load(FAKE_NORMALS);
if (facing == Direction.NORTH) { if (facing == Direction.NORTH) {
//matrixStack.translate(0, 0, 1.016 / 16D); //matrixStack.translate(0, 0, 1.016 / 16D);
matrixStack.translate(-1, 0, 0); matrixStack.translate(-1, 0, 0);
@ -52,11 +52,12 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD
if (facing == Direction.WEST) { if (facing == Direction.WEST) {
matrixStack.mulPose(Vector3f.YP.rotationDegrees(90)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(90));
} }
matrixStack.translate(0,0,-0.5/16D);
combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing));
ItemStack stack = tile.getHandler().getResultList().get(0).getResult(); ItemStack stack = tile.getHandler().getResultList().get(0).getResult();
if (!stack.isEmpty()){ if (!stack.isEmpty()){
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(0.725, 0.30f, 0.0005f); matrixStack.translate(0.75, 0.27f,0.0005f);
matrixStack.scale(0.5f, 0.5f, 1); matrixStack.scale(0.5f, 0.5f, 1);
DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(0).getCount(), 0.02f); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(0).getCount(), 0.02f);
matrixStack.popPose(); matrixStack.popPose();
@ -64,7 +65,7 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD
stack = tile.getHandler().getResultList().get(1).getResult(); stack = tile.getHandler().getResultList().get(1).getResult();
if (!stack.isEmpty()){ if (!stack.isEmpty()){
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(0.275, 0.30f, 0.0005f); matrixStack.translate(0.25, 0.27f, 0.0005f);
matrixStack.scale(0.5f, 0.5f, 1); matrixStack.scale(0.5f, 0.5f, 1);
DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(1).getCount(), 0.02f); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(1).getCount(), 0.02f);
matrixStack.popPose(); matrixStack.popPose();
@ -72,7 +73,7 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD
stack = tile.getHandler().getResultList().get(2).getResult(); stack = tile.getHandler().getResultList().get(2).getResult();
if (!stack.isEmpty()){ if (!stack.isEmpty()){
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(0.5, 0.75f, 0.0005f); matrixStack.translate(0.5, 0.77f, 0.0005f);
matrixStack.scale(0.5f, 0.5f, 1); matrixStack.scale(0.5f, 0.5f, 1);
DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(2).getCount(), 0.02f); DrawerRenderer.renderStack(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, stack, tile.getHandler().getStackInSlot(2).getCount(), 0.02f);
matrixStack.popPose(); matrixStack.popPose();