aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2022-12-23 17:18:10 -0800
committerAnthony Hilyard <anthony.hilyard@gmail.com>2022-12-23 17:18:10 -0800
commit94e0927f324032c49a610f41c6055e56a0823321 (patch)
tree18f352a3c2cc496d487b843773620d3eee6bec40 /src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
parentce46c0feb25b6127a1ce4e5624a05acf5ce16a71 (diff)
downloadIceberg-94e0927f324032c49a610f41c6055e56a0823321.tar.gz
Iceberg-94e0927f324032c49a610f41c6055e56a0823321.tar.bz2
Iceberg-94e0927f324032c49a610f41c6055e56a0823321.zip
Fixed items rendered with alpha being upside down.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
index 301b4c4..77e814a 100644
--- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
+++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
@@ -640,10 +640,9 @@ public class CustomItemRenderer extends ItemRenderer
RenderSystem.backupProjectionMatrix();
RenderSystem.setProjectionMatrix(matrix);
- Lighting.setupFor3DItems();
-
mc.getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
+ RenderSystem.disableCull();
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
@@ -655,14 +654,21 @@ public class CustomItemRenderer extends ItemRenderer
modelViewStack.scale(96.0f, 96.0f, 96.0f);
RenderSystem.applyModelViewMatrix();
PoseStack poseStack = new PoseStack();
- BufferSource bufferSource = Minecraft.getInstance().renderBuffers().bufferSource();
+ BufferSource bufferSource = mc.renderBuffers().bufferSource();
+
boolean flatLighting = !bakedModel.usesBlockLight();
- if (flatLighting) { Lighting.setupForFlatItems(); }
+ if (flatLighting)
+ {
+ Lighting.setupForFlatItems();
+ }
render(stack, ItemTransforms.TransformType.GUI, false, poseStack, bufferSource, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
bufferSource.endBatch();
RenderSystem.enableDepthTest();
- if (flatLighting) { Lighting.setupFor3DItems(); }
+ if (flatLighting)
+ {
+ Lighting.setupFor3DItems();
+ }
modelViewStack.popPose();
RenderSystem.applyModelViewMatrix();
@@ -679,13 +685,12 @@ public class CustomItemRenderer extends ItemRenderer
RenderSystem.disableCull();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, alpha);
modelViewStack.pushPose();
- modelViewStack.scale(1.0f, -1.0f, 1.0f);
modelViewStack.translate(0.0f, 0.0f, 50.0f + this.blitOffset);
RenderSystem.applyModelViewMatrix();
RenderSystem.setShaderTexture(0, iconFrameBuffer.getColorTextureId());
- GuiComponent.blit(new PoseStack(), x, y - 18, 16, 16, 0, 0, iconFrameBuffer.width, iconFrameBuffer.height, iconFrameBuffer.width, iconFrameBuffer.height);
+ GuiComponent.blit(new PoseStack(), x, y, 16, 16, 0, 0, iconFrameBuffer.width, iconFrameBuffer.height, iconFrameBuffer.width, iconFrameBuffer.height);
modelViewStack.popPose();
RenderSystem.applyModelViewMatrix();
iconFrameBuffer.unbindRead();