Fix NEI Tooltips.

This commit is contained in:
AlgorithmX2 2014-07-14 22:30:32 -05:00
parent 6d43d21067
commit cc76e2329c
2 changed files with 31 additions and 2 deletions

View file

@ -4,12 +4,14 @@ import java.text.NumberFormat;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME; import appeng.client.me.SlotME;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import codechicken.nei.guihook.IContainerTooltipHandler;
public abstract class AEBaseMEGui extends AEBaseGui public abstract class AEBaseMEGui extends AEBaseGui
{ {
@ -18,7 +20,6 @@ public abstract class AEBaseMEGui extends AEBaseGui
super( container ); super( container );
} }
// @Override - NEI
public List<String> handleItemTooltip(ItemStack stack, int mousex, int mousey, List<String> currenttip) public List<String> handleItemTooltip(ItemStack stack, int mousex, int mousey, List<String> currenttip)
{ {
if ( stack != null ) if ( stack != null )

View file

@ -3,12 +3,15 @@ package appeng.integration.modules;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.implementations.GuiCraftingTerm; import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm; import appeng.client.gui.implementations.GuiPatternTerm;
import appeng.integration.BaseModule; import appeng.integration.BaseModule;
@ -23,8 +26,9 @@ import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder; import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
import codechicken.nei.api.IStackPositioner; import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
public class NEI extends BaseModule implements IIntegrationModule, INEI public class NEI extends BaseModule implements IIntegrationModule, INEI, IContainerTooltipHandler
{ {
public static NEI instance; public static NEI instance;
@ -60,6 +64,9 @@ public class NEI extends BaseModule implements IIntegrationModule, INEI
registerRecipeHandler( new NEIWorldCraftingHandler() ); registerRecipeHandler( new NEIWorldCraftingHandler() );
registerRecipeHandler( new NEIGrinderRecipeHandler() ); registerRecipeHandler( new NEIGrinderRecipeHandler() );
// large stack tooltips
GuiContainerManager.addTooltipHandler( this );
// crafting terminal... // crafting terminal...
Method registerGuiOverlay = API.getDeclaredMethod( "registerGuiOverlay", new Class[] { Class.class, String.class, IStackPositioner.class } ); Method registerGuiOverlay = API.getDeclaredMethod( "registerGuiOverlay", new Class[] { Class.class, String.class, IStackPositioner.class } );
Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" ); Class IOverlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" );
@ -115,4 +122,25 @@ public class NEI extends BaseModule implements IIntegrationModule, INEI
} }
} }
@Override
public List<String> handleItemDisplayName(GuiContainer arg0, ItemStack arg1, List<String> current)
{
return current;
}
@Override
public List<String> handleItemTooltip(GuiContainer guiScreen, ItemStack stack, int mousex, int mousey, List<String> currenttip)
{
if ( guiScreen instanceof AEBaseMEGui )
return ((AEBaseMEGui) guiScreen).handleItemTooltip( stack, mousex, mousey, currenttip );
return currenttip;
}
@Override
public List<String> handleTooltip(GuiContainer arg0, int arg1, int arg2, List<String> current)
{
return current;
}
} }