Skip to content

Commit 84b68dd

Browse files
Copilotrubensworks
andauthored
Fix crash when opening terminal: replace removed drawSlotText with inlined GuiGraphicsExtractor calls
Agent-Logs-Url: https://github.com/CyclopsMC/IntegratedTerminals/sessions/9cc5d25d-d22a-49c1-a9ee-2fcd472e5264 Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 6bef7eb commit 84b68dd

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ org.gradle.daemon=false
2929
org.gradle.caching=true
3030

3131
# Dependencies
32-
cyclopscore_version=1.25.5-974
32+
cyclopscore_version=1.29.0-984
3333
integrateddynamics_version=1.24.1-1707
3434
integratedterminalscompat_version=1.0.0-162
3535
integratedcrafting_version=1.1.13-545

src/main/java/org/cyclops/integratedterminals/capability/ingredient/IngredientComponentTerminalStorageHandlerEnergyClient.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
77
import net.minecraft.client.renderer.RenderPipelines;
88
import net.minecraft.network.chat.Component;
9-
import org.cyclops.cyclopscore.client.gui.GuiGraphicsExtended;
109
import org.cyclops.cyclopscore.helper.IGuiHelpers;
1110
import org.cyclops.cyclopscore.helper.IModHelpers;
1211
import org.cyclops.integratedterminals.api.ingredient.IIngredientComponentTerminalStorageHandlerClient;
@@ -53,8 +52,12 @@ public void drawInstance(GuiGraphicsExtractor guiGraphics, Long instance, long m
5352
16, 240, IGuiHelpers.ProgressDirection.UP, progressScaled, progressMaxScaled);
5453

5554
// Draw amount
56-
GuiGraphicsExtended renderItem = new GuiGraphicsExtended(guiGraphics);
57-
renderItem.drawSlotText(Minecraft.getInstance().font, label != null ? label : IModHelpers.get().getGuiHelpers().quantityToScaledString(instance), x, y);
55+
float scale = 0.5f;
56+
guiGraphics.pose().pushMatrix();
57+
guiGraphics.pose().scale(scale, scale);
58+
String amountLabel = label != null ? label : IModHelpers.get().getGuiHelpers().quantityToScaledString(instance);
59+
guiGraphics.text(Minecraft.getInstance().font, amountLabel, (int) ((x + 17) / scale - Minecraft.getInstance().font.width(amountLabel)), (int) ((y + 12) / scale), -1, true);
60+
guiGraphics.pose().popMatrix();
5861
} else {
5962
IModHelpers.get().getGuiHelpers().renderTooltip(gui, guiGraphics, x, y, IModHelpers.get().getGuiHelpers().getSlotSizeInner(), IModHelpers.get().getGuiHelpers().getSlotSizeInner(),
6063
mouseX, mouseY, () -> {

src/main/java/org/cyclops/integratedterminals/capability/ingredient/IngredientComponentTerminalStorageHandlerFluidStackClient.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import net.minecraft.network.chat.MutableComponent;
1010
import net.minecraft.network.chat.Style;
1111
import net.neoforged.neoforge.fluids.FluidStack;
12-
import org.cyclops.cyclopscore.client.gui.GuiGraphicsExtended;
1312
import org.cyclops.cyclopscore.helper.IModHelpers;
1413
import org.cyclops.cyclopscore.helper.IModHelpersNeoForge;
1514
import org.cyclops.integratedterminals.api.ingredient.IIngredientComponentTerminalStorageHandlerClient;
@@ -43,8 +42,12 @@ public void drawInstance(GuiGraphicsExtractor guiGraphics, FluidStack instance,
4342
IModHelpersNeoForge.get().getGuiHelpers().renderFluidSlot(guiGraphics, instance, x, y);
4443

4544
// Draw amount
46-
GuiGraphicsExtended renderItem = new GuiGraphicsExtended(guiGraphics);
47-
renderItem.drawSlotText(Minecraft.getInstance().font, label != null ? label : IModHelpers.get().getGuiHelpers().quantityToScaledString(instance.getAmount()), x, y);
45+
float scale = 0.5f;
46+
guiGraphics.pose().pushMatrix();
47+
guiGraphics.pose().scale(scale, scale);
48+
String amountLabel = label != null ? label : IModHelpers.get().getGuiHelpers().quantityToScaledString(instance.getAmount());
49+
guiGraphics.text(Minecraft.getInstance().font, amountLabel, (int) ((x + 17) / scale - Minecraft.getInstance().font.width(amountLabel)), (int) ((y + 12) / scale), -1, true);
50+
guiGraphics.pose().popMatrix();
4851
} else {
4952
IModHelpers.get().getGuiHelpers().renderTooltip(gui, guiGraphics, x, y, IModHelpers.get().getGuiHelpers().getSlotSizeInner(), IModHelpers.get().getGuiHelpers().getSlotSizeInner(), mouseX, mouseY, () -> {
5053
List<Component> lines = Lists.newArrayList();

src/main/java/org/cyclops/integratedterminals/core/terminalstorage/slot/TerminalStorageSlotIngredientCraftingOption.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import net.minecraft.network.chat.Component;
99
import org.cyclops.commoncapabilities.api.ingredient.IIngredientMatcher;
1010
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
11-
import org.cyclops.cyclopscore.client.gui.GuiGraphicsExtended;
1211
import org.cyclops.cyclopscore.helper.IModHelpers;
1312
import org.cyclops.integratedterminals.api.ingredient.IIngredientComponentTerminalStorageHandler;
1413
import org.cyclops.integratedterminals.api.terminalstorage.ITerminalStorageTabClient;
@@ -72,8 +71,12 @@ public HandlerWrappedTerminalCraftingOption<T> getCraftingOption() {
7271
}
7372

7473
private void drawCraftLabel(GuiGraphicsExtractor guiGraphics, int x, int y) {
75-
new GuiGraphicsExtended(guiGraphics).drawSlotText(Minecraft.getInstance().font,
76-
ChatFormatting.GOLD + IModHelpers.get().getL10NHelpers().localize("gui.integratedterminals.terminal_storage.craft"), x, y - 11);
74+
String text = ChatFormatting.GOLD + IModHelpers.get().getL10NHelpers().localize("gui.integratedterminals.terminal_storage.craft");
75+
float scale = 0.5f;
76+
guiGraphics.pose().pushMatrix();
77+
guiGraphics.pose().scale(scale, scale);
78+
guiGraphics.text(Minecraft.getInstance().font, text, (int) ((x + 17) / scale - Minecraft.getInstance().font.width(text)), (int) ((y + 1) / scale), -1, true);
79+
guiGraphics.pose().popMatrix();
7780
}
7881

7982
}

0 commit comments

Comments
 (0)