Skip to content

Commit 9112d89

Browse files
authored
Fix Ghost Circuit Format Error in Input Busses (GregTechCEu#2099)
1 parent f637be3 commit 9112d89

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ protected TextureArea getCircuitSlotOverlay() {
497497
// Method provided to override
498498
protected void getCircuitSlotTooltip(SlotWidget widget) {
499499
String configString;
500-
if (circuitInventory == null) {
500+
if (circuitInventory == null || circuitInventory.getCircuitValue() == GhostCircuitItemStackHandler.NO_CONFIG) {
501501
configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText();
502502
} else {
503503
configString = String.valueOf(circuitInventory.getCircuitValue());

src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import gregtech.api.util.GTHashMaps;
2323
import gregtech.client.renderer.texture.Textures;
2424
import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer;
25+
import gregtech.integration.jei.recipe.IntCircuitCategory;
2526
import it.unimi.dsi.fastutil.objects.Object2IntMap;
2627
import net.minecraft.client.resources.I18n;
2728
import net.minecraft.entity.player.EntityPlayer;
@@ -274,7 +275,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) {
274275

275276
SlotWidget circuitSlot = new GhostCircuitSlotWidget(circuitInventory, 0, circuitX, circuitY)
276277
.setBackgroundTexture(GuiTextures.SLOT, getCircuitSlotOverlay());
277-
builder.widget(getCircuitSlotTooltip(circuitSlot));
278+
builder.widget(circuitSlot.setConsumer(this::getCircuitSlotTooltip));
278279
}
279280

280281
return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, inventoryStartX, inventoryStartY);
@@ -291,8 +292,15 @@ protected TextureArea getCircuitSlotOverlay() {
291292
}
292293

293294
// Method provided to override
294-
protected SlotWidget getCircuitSlotTooltip(@Nonnull SlotWidget widget) {
295-
return widget.setTooltipText("gregtech.gui.configurator_slot.tooltip");
295+
protected void getCircuitSlotTooltip(@Nonnull SlotWidget widget) {
296+
String configString;
297+
if (circuitInventory == null || circuitInventory.getCircuitValue() == GhostCircuitItemStackHandler.NO_CONFIG) {
298+
configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText();
299+
} else {
300+
configString = String.valueOf(circuitInventory.getCircuitValue());
301+
}
302+
303+
widget.setTooltipText("gregtech.gui.configurator_slot.tooltip", configString);
296304
}
297305

298306
private static void collapseInventorySlotContents(IItemHandlerModifiable inventory) {

0 commit comments

Comments
 (0)