Files
NotEnoughItems/src/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java
T

70 lines
3.0 KiB
Java

package codechicken.nei.guihook;
import java.util.List;
import java.util.Map;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
/**
* If this interface is implemented by a GuiContainer then it will be the first handler delegated to but
* handleItmeDisplayName will not be called
*/
public interface IContainerTooltipHandler {
/**
* Use this to add tooltips for other objects. If the current tip has lines in it after this call, the item tootip
* will not be handled. GuiContainerManager.shouldShowTooltip is not enforced here. It is recommended that you make
* this check yourself
*
* @param gui An instance of the currentscreen
* @param mousex The x position of the mouse in pixels from left
* @param mousey The y position of the mouse in pixels from top
* @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers
* @return The modified list. NOTE: Do not return null
*/
default List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
return currenttip;
}
/**
* Use this for modifying the multiline display name of an item which may not necessarily be under the mouse.
* GuiContainerManager.shouldShowTooltip is enforced here.
*
* @param gui An instance of the currentscreen. If only general information about the item is wanted (Eg.
* potion effects) then this may be null.
* @param itemstack The ItemStack under the mouse
* @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers
* @return The modified list. NOTE: Do not return null
*/
default List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
return currenttip;
}
/**
* Use this for modifying the tooltips of items that are under the mouse. GuiContainerManager.shouldShowTooltip is
* enforced here.
*
* @param gui An instance of the currentscreen
* @param itemstack The ItemStack under the mouse
* @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers
* @return The modified list. NOTE: Do not return null
*/
default List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
List<String> currenttip) {
return currenttip;
}
/**
* Use this to specify a list of hotkeys that will work when hovering over an element that is under the mouse
* pointer.
*
* @param gui An instance of the currentscreen
* @param mousex The x position of the mouse in pixels from left
* @param mousey The y position of the mouse in pixels from top
*/
default Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
return hotkeys;
}
}