Skip to content

Commit 3aaada1

Browse files
committed
improve draw slightly
fix defaults for StyledTextMixin
1 parent f529281 commit 3aaada1

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/main/java/gregtech/common/mui/widget/GTFluidSlot.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ public void drawBackground(ModularGuiContext context, WidgetTheme widgetTheme) {
106106

107107
@Override
108108
public void draw(ModularGuiContext context, WidgetTheme widgetTheme) {
109+
if (widgetTheme instanceof WidgetSlotTheme slotTheme) {
110+
draw(context, slotTheme);
111+
}
112+
}
113+
114+
public void draw(ModularGuiContext context, WidgetSlotTheme widgetTheme) {
109115
FluidStack content = this.syncHandler.getFluid();
110116
if (content == null && this.syncHandler.canLockFluid())
111117
content = this.syncHandler.getLockedFluid();
@@ -121,7 +127,7 @@ public void draw(ModularGuiContext context, WidgetTheme widgetTheme) {
121127

122128
if (isHovering()) {
123129
GlStateManager.colorMask(true, true, true, false);
124-
GuiDraw.drawRect(1, 1, getArea().w() - 2, getArea().h() - 2, getSlotHoverColor());
130+
GuiDraw.drawRect(1, 1, getArea().w() - 2, getArea().h() - 2, widgetTheme.getSlotHoverColor());
125131
GlStateManager.colorMask(true, true, true, true);
126132
}
127133
}
@@ -167,14 +173,6 @@ protected WidgetTheme getWidgetThemeInternal(ITheme theme) {
167173
return theme.getFluidSlotTheme();
168174
}
169175

170-
public int getSlotHoverColor() {
171-
WidgetTheme theme = getWidgetTheme(getContext().getTheme());
172-
if (theme instanceof WidgetSlotTheme slotTheme) {
173-
return slotTheme.getSlotHoverColor();
174-
}
175-
return ITheme.getDefault().getFluidSlotTheme().getSlotHoverColor();
176-
}
177-
178176
public static void addIngotMolFluidTooltip(FluidStack fluidStack, RichTooltip tooltip) {
179177
// Add tooltip showing how many "ingot moles" (increments of 144) this fluid is if shift is held
180178
if (TooltipHelper.isShiftDown() && fluidStack.amount > GTValues.L) {

src/main/java/gregtech/mixins/mui2/StyledTextMixin.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import org.spongepowered.asm.mixin.Shadow;
1616
import org.spongepowered.asm.mixin.Unique;
1717
import org.spongepowered.asm.mixin.injection.At;
18+
import org.spongepowered.asm.mixin.injection.Inject;
1819
import org.spongepowered.asm.mixin.injection.ModifyArg;
20+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1921

2022
@Mixin(value = StyledText.class, remap = false)
2123
public abstract class StyledTextMixin implements UnboxFix {
@@ -52,6 +54,16 @@ public abstract class StyledTextMixin implements UnboxFix {
5254
gregTech$defaultShadow = b;
5355
}
5456

57+
@Inject(method = "color", at = @At("HEAD"))
58+
private void setDefault(int color, CallbackInfoReturnable<StyledText> cir) {
59+
gregTech$useDefaultTextColor(false);
60+
}
61+
62+
@Inject(method = "shadow", at = @At("HEAD"))
63+
private void setDefault(boolean shadow, CallbackInfoReturnable<StyledText> cir) {
64+
gregTech$useDefaultShadow(false);
65+
}
66+
5567
/**
5668
* @author GTCEu - Ghzdude
5769
* @reason Implement <a href="https://github.com/CleanroomMC/ModularUI/pull/86">MUI2 PR#86</a>

0 commit comments

Comments
 (0)