Skip to content

Commit

Permalink
fix: Inventory texture disappears during bulk buy (Wynntils#3152)
Browse files Browse the repository at this point in the history
* minimum fix

* move method to utils

* cleanup, comments

* remove leftover

* ci: spotless formatting

* constant render state

* fix incorrect item lighting

* comment originals

* alternate fix for this issue

Co-authored-by: Kristof Kovacs <49001742+kristofbolyai@users.noreply.github.com>

* fix wrong aw change

* typo

---------

Co-authored-by: Kristof Kovacs <49001742+kristofbolyai@users.noreply.github.com>
  • Loading branch information
ryanzhoudev and kristofbolyai authored Mar 7, 2025
1 parent 6b69feb commit 16b75b0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/
package com.wynntils.screens.bulkbuy.widgets;

import com.mojang.blaze3d.vertex.ByteBufferBuilder;
import com.wynntils.core.text.StyledText;
import com.wynntils.features.ui.BulkBuyFeature;
import com.wynntils.utils.colors.CommonColors;
import com.wynntils.utils.mc.McUtils;
import com.wynntils.utils.render.FontRenderer;
import com.wynntils.utils.render.RenderUtils;
import com.wynntils.utils.render.Texture;
Expand All @@ -18,10 +20,14 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;

public class BulkBuyWidget extends AbstractWidget {
private static final MultiBufferSource.BufferSource BUFFER_SOURCE =
MultiBufferSource.immediate(new ByteBufferBuilder(256));

private static final int BULK_BUY_WIDGET_CENTER = 89;

private final int originalX;
Expand Down Expand Up @@ -77,7 +83,10 @@ protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, flo
TextShadow.NORMAL);

// X coordinate is center of widget (BULK_BUY_WIDGET_CENTER) minus half of the item icon width (8)
guiGraphics.renderItem(bulkBoughtItem.itemStack(), getX() + BULK_BUY_WIDGET_CENTER - 8, getY() + 34);
GuiGraphics itemRenderGuiGraphics = new GuiGraphics(McUtils.mc(), BUFFER_SOURCE);
itemRenderGuiGraphics.renderItem(
bulkBoughtItem.itemStack(), getX() + BULK_BUY_WIDGET_CENTER - 8, getY() + 34);

FontRenderer.getInstance()
.renderScrollingText(
guiGraphics.pose(),
Expand Down

0 comments on commit 16b75b0

Please sign in to comment.