mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-26 14:25:20 +00:00
Bookmark support for crafting status GUI (#104)
* Bookmark support for crafting status GUI * fix double tooltip
This commit is contained in:
1 parent
90b88f8b16
commit
addfbefedb
3 files changed
+58
-1
No files matched your search
@@ -71,6 +71,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
private GuiButton start;
|
||||
private GuiButton selectCPU;
|
||||
private int tooltip = -1;
|
||||
private ItemStack hoveredStack;
|
||||
|
||||
public GuiCraftConfirm( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
@@ -241,6 +242,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
final List<String> lineList = new LinkedList<String>();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
hoveredStack = null;
|
||||
|
||||
final int offY = 23;
|
||||
|
||||
@@ -363,6 +365,8 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
|
||||
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
|
||||
hoveredStack = is;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, is );
|
||||
@@ -580,4 +584,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
}
|
||||
}
|
||||
}
|
||||
public ItemStack getHoveredStack() {
|
||||
return hoveredStack;
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
private List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
|
||||
private GuiButton cancel;
|
||||
private int tooltip = -1;
|
||||
private ItemStack hoveredStack;
|
||||
|
||||
public GuiCraftingCPU( final InventoryPlayer inventoryPlayer, final Object te )
|
||||
{
|
||||
@@ -211,6 +212,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
hoveredStack = null;
|
||||
|
||||
final int offY = 23;
|
||||
|
||||
final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
|
||||
@@ -316,6 +319,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
toolPosX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 8;
|
||||
toolPosY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||
|
||||
hoveredStack = is;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, is );
|
||||
@@ -487,4 +492,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
return ViewItems.ALL;
|
||||
}
|
||||
|
||||
public ItemStack getHoveredStack() {
|
||||
return hoveredStack;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ package appeng.integration.modules;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -33,6 +35,7 @@ import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.guihook.IContainerObjectHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -46,7 +49,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule
|
||||
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule, IContainerObjectHandler
|
||||
{
|
||||
@Reflected
|
||||
public static NEI instance;
|
||||
@@ -94,6 +97,7 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule
|
||||
|
||||
// large stack tooltips
|
||||
GuiContainerManager.addTooltipHandler( this );
|
||||
GuiContainerManager.addObjectHandler(this);
|
||||
|
||||
// crafting terminal...
|
||||
final Method registerGuiOverlay = this.apiClass.getDeclaredMethod( "registerGuiOverlay", Class.class, String.class, IStackPositioner.class );
|
||||
@@ -182,4 +186,41 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
@Override
|
||||
public void guiTick(GuiContainer gui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(GuiContainer gui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(GuiContainer gui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
||||
if (gui instanceof GuiCraftConfirm)
|
||||
return ((GuiCraftConfirm)gui).getHoveredStack();
|
||||
else if (gui instanceof GuiCraftingCPU)
|
||||
return ((GuiCraftingCPU)gui).getHoveredStack();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean objectUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowTooltip(GuiContainer gui) {
|
||||
if (gui instanceof GuiCraftConfirm)
|
||||
return ((GuiCraftConfirm)gui).getHoveredStack() == null;
|
||||
if (gui instanceof GuiCraftingCPU)
|
||||
return ((GuiCraftingCPU)gui).getHoveredStack() == null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user