Added upgrade rendering

This commit is contained in:
Buuz135 2021-12-22 22:44:32 +01:00
parent e1e238de3e
commit d8ad7a702c
3 changed files with 46 additions and 0 deletions

View File

@ -205,6 +205,10 @@ public abstract class ControllableDrawerTile<T extends ControllableDrawerTile<T>
markComponentDirty();
}
public InventoryComponent<ControllableDrawerTile<T>> getStorageUpgrades() {
return storageUpgrades;
}
@Override
public void invalidateCaps() {
super.invalidateCaps();

View File

@ -54,6 +54,27 @@ public class CompactingDrawerRenderer implements BlockEntityRenderer<CompactingD
}
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();
}
ItemStack stack = tile.getHandler().getResultList().get(0).getResult();
if (!stack.isEmpty()){
matrixStack.pushPose();

View File

@ -57,6 +57,27 @@ public class DrawerRenderer implements BlockEntityRenderer<DrawerTile> {
}
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);