From d8ad7a702cf1c8671af769dc847c269ae0b2d2dd Mon Sep 17 00:00:00 2001 From: Buuz135 Date: Wed, 22 Dec 2021 22:44:32 +0100 Subject: [PATCH] Added upgrade rendering --- .../block/tile/ControllableDrawerTile.java | 4 ++++ .../client/CompactingDrawerRenderer.java | 21 +++++++++++++++++++ .../client/DrawerRenderer.java | 21 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java index 1475d5e..6c128d7 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/ControllableDrawerTile.java @@ -205,6 +205,10 @@ public abstract class ControllableDrawerTile markComponentDirty(); } + public InventoryComponent> getStorageUpgrades() { + return storageUpgrades; + } + @Override public void invalidateCaps() { super.invalidateCaps(); diff --git a/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java b/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java index 55dae48..43be4b6 100644 --- a/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java +++ b/src/main/java/com/buuz135/functionalstorage/client/CompactingDrawerRenderer.java @@ -54,6 +54,27 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer { } matrixStack.translate(0,0,-0.5/16D); combinedLightIn = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos().relative(facing)); + matrixStack.pushPose(); + matrixStack.translate(0.031,0.031f,0.469/16D); + float scale = 0.0625f; + for (int i = 0; i < tile.getStorageUpgrades().getSlots(); i++) { + ItemStack stack = tile.getStorageUpgrades().getStackInSlot(i); + if (!stack.isEmpty()){ + matrixStack.pushPose(); + matrixStack.scale(scale, scale, scale); + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.NONE, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, 0); + matrixStack.popPose(); + matrixStack.translate(scale,0,0); + } + } + matrixStack.popPose(); + if (tile.isVoid()){ + matrixStack.pushPose(); + matrixStack.translate(0.969,0.031f,0.469/16D); + matrixStack.scale(scale, scale, scale); + Minecraft.getInstance().getItemRenderer().renderStatic(new ItemStack(FunctionalStorage.VOID_UPGRADE.get()), ItemTransforms.TransformType.NONE, combinedLightIn, combinedOverlayIn, matrixStack, bufferIn, 0); + matrixStack.popPose(); + } if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_1) render1Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_2) render2Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile); if (tile.getDrawerType() == FunctionalStorage.DrawerType.X_4) render4Slot(matrixStack, bufferIn, combinedLightIn, combinedOverlayIn, tile);