Skip to content

Commit

Permalink
make drawing item count configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Jan 8, 2025
1 parent 764e15b commit 5630c26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ protected void createWidgets(ModularPanel mainPanel, PanelSyncManager syncManage
() -> TextFormattingUtil.formatNumbers(itemsStoredInside)))
.child(new GTItemSlot()
.showTooltip(false)
.showAmount(false)
.background(IDrawable.NONE)
.slot(new ModularSlot(itemInventory, 0)
.accessibility(false, false))
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/gregtech/common/mui/widget/GTItemSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class GTItemSlot extends Widget<GTItemSlot>
JeiIngredientProvider {

private boolean showTooltip = true;
private boolean showAmount = true;
private ItemSlotSH syncHandler;

public GTItemSlot() {
Expand Down Expand Up @@ -59,6 +60,11 @@ public GTItemSlot showTooltip(boolean showTooltip) {
return getThis();
}

public GTItemSlot showAmount(boolean showAmount) {
this.showAmount = showTooltip;
return getThis();
}

@SuppressWarnings("UnstableApiUsage")
public GTItemSlot slot(ModularSlot slot) {
this.syncHandler = new ItemSlotSH(slot);
Expand Down Expand Up @@ -131,7 +137,7 @@ public void drawForeground(ModularGuiContext context) {
public void draw(ModularGuiContext context, WidgetTheme widgetTheme) {
if (this.syncHandler == null) return;

RenderUtil.drawItemStack(getSlot().getStack(), 1, 1, false);
RenderUtil.drawItemStack(getSlot().getStack(), 1, 1, showAmount);

if (isHovering()) {
GlStateManager.colorMask(true, true, true, false);
Expand Down

0 comments on commit 5630c26

Please sign in to comment.