Skip to content

Commit

Permalink
Update GraphicsUtil.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Jan 15, 2025
1 parent 630330d commit 4edf1c6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,23 @@ public static void renderItem(GuiGraphics guiGraphics, SlotExtension slot, @Null

static void renderItem(GuiGraphics guiGraphics, SlotExtension slot, @Nullable LivingEntity entity, @Nullable Level level, ItemStack stack, int x, int y, int seed, int guiOffset) {
if (!stack.isEmpty()) {
float scale = slot.lt$getSize();
float normalizedScale = scale / 16;
BakedModel bakedmodel = minecraft.getItemRenderer().getModel(stack, level, entity, seed);
PoseStack pose = guiGraphics.pose();
pose.pushPose();
pose.translate((float)(x + 8), (float)(y + 8), (float)(150 + (bakedmodel.isGui3d() ? guiOffset : 0)));
pose.translate(-0.5f, -0.5f, 0f);
pose.translate((float)(x + 8 * normalizedScale), (float)(y + 8 * normalizedScale), (float)(150 + (bakedmodel.isGui3d() ? guiOffset : 0) * normalizedScale));
//pose.translate(-0.5f, -0.5f, 0f);
try {
float scale = slot.lt$getSize();

System.out.println(scale);
pose.scale(scale, -scale, scale);
boolean flag = !bakedmodel.usesBlockLight();
if (flag) {
Lighting.setupForFlatItems();
}

minecraft.getItemRenderer().render(stack, ItemDisplayContext.GUI, false, pose, guiGraphics.bufferSource(), 15728880, OverlayTexture.NO_OVERLAY, bakedmodel);
minecraft.getItemRenderer().render(stack, ItemDisplayContext.GUI, false, pose, guiGraphics.bufferSource(), 0xf000f0, OverlayTexture.NO_OVERLAY, bakedmodel);
guiGraphics.flush();
if (flag) {
Lighting.setupFor3DItems();
Expand Down

0 comments on commit 4edf1c6

Please sign in to comment.