2014-04-29 10:54:20 +10:00
|
|
|
package codechicken.nei;
|
|
|
|
|
|
|
|
|
|
import codechicken.lib.gui.GuiDraw;
|
|
|
|
|
import codechicken.nei.KeyManager.IKeyStateTracker;
|
2019-12-24 13:37:41 -08:00
|
|
|
import codechicken.nei.api.API;
|
|
|
|
|
import codechicken.nei.api.GuiInfo;
|
|
|
|
|
import codechicken.nei.api.INEIGuiHandler;
|
|
|
|
|
import codechicken.nei.api.IRecipeOverlayRenderer;
|
|
|
|
|
import codechicken.nei.api.ItemInfo;
|
|
|
|
|
import codechicken.nei.api.LayoutStyle;
|
2021-03-23 23:34:05 -07:00
|
|
|
import codechicken.nei.drawable.DrawableBuilder;
|
|
|
|
|
import codechicken.nei.drawable.DrawableResource;
|
2019-12-24 13:37:41 -08:00
|
|
|
import codechicken.nei.guihook.GuiContainerManager;
|
|
|
|
|
import codechicken.nei.guihook.IContainerDrawHandler;
|
|
|
|
|
import codechicken.nei.guihook.IContainerInputHandler;
|
|
|
|
|
import codechicken.nei.guihook.IContainerObjectHandler;
|
|
|
|
|
import codechicken.nei.guihook.IContainerTooltipHandler;
|
2021-03-28 00:12:17 -07:00
|
|
|
import codechicken.nei.recipe.GuiRecipeTab;
|
2019-12-24 13:37:41 -08:00
|
|
|
import cpw.mods.fml.common.Loader;
|
2014-04-29 10:54:20 +10:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
|
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
|
|
|
|
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
|
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2021-03-15 22:31:36 -07:00
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
|
|
|
|
import org.lwjgl.input.Keyboard;
|
2014-04-29 10:54:20 +10:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.TreeSet;
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
|
|
|
|
import static codechicken.lib.gui.GuiDraw.drawRect;
|
|
|
|
|
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.canPerformAction;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.disabledActions;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.getItemQuantity;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.getKeyBinding;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.getOptionList;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.getSearchExpression;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.hasSMPCounterPart;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.invCreativeMode;
|
2021-03-14 12:22:27 -07:00
|
|
|
import static codechicken.nei.NEIClientConfig.isBookmarkPanelHidden;
|
2019-12-24 13:37:41 -08:00
|
|
|
import static codechicken.nei.NEIClientConfig.isEnabled;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.isHidden;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.showIDs;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.toggleBooleanSetting;
|
|
|
|
|
import static codechicken.nei.NEIClientConfig.world;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.controlKey;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.cycleGamemode;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.decreaseSlotStack;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.deleteEverything;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.deleteHeldItem;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.deleteItemsOfType;
|
2021-03-20 16:43:24 -07:00
|
|
|
import static codechicken.nei.NEIClientUtils.getGamemode;
|
2019-12-24 13:37:41 -08:00
|
|
|
import static codechicken.nei.NEIClientUtils.getGuiContainer;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.getHeldItem;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.getNextGamemode;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.healPlayer;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.isValidGamemode;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.setHourForward;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.setItemQuantity;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.shiftKey;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.toggleMagnetMode;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.toggleRaining;
|
|
|
|
|
import static codechicken.nei.NEIClientUtils.translate;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
|
|
|
|
public class LayoutManager implements IContainerInputHandler, IContainerTooltipHandler, IContainerDrawHandler, IContainerObjectHandler, IKeyStateTracker
|
|
|
|
|
{
|
|
|
|
|
private static LayoutManager instance;
|
|
|
|
|
|
|
|
|
|
private static Widget inputFocused;
|
|
|
|
|
/**
|
|
|
|
|
* Sorted bottom first
|
|
|
|
|
*/
|
|
|
|
|
private static TreeSet<Widget> drawWidgets;
|
|
|
|
|
/**
|
|
|
|
|
* Sorted top first
|
|
|
|
|
*/
|
|
|
|
|
private static TreeSet<Widget> controlWidgets;
|
|
|
|
|
|
|
|
|
|
public static ItemPanel itemPanel;
|
2019-12-24 13:37:41 -08:00
|
|
|
public static BookmarkPanel bookmarkPanel;
|
2014-06-29 20:31:37 +10:00
|
|
|
public static SubsetWidget dropDown;
|
2014-04-29 10:54:20 +10:00
|
|
|
public static TextField searchField;
|
|
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
public static ButtonCycled options;
|
2021-03-20 22:38:46 -07:00
|
|
|
public static ButtonCycled bookmarksButton;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
|
|
|
|
public static Button more;
|
|
|
|
|
public static Button less;
|
|
|
|
|
public static ItemQuantityField quantity;
|
|
|
|
|
|
|
|
|
|
public static Button delete;
|
|
|
|
|
public static ButtonCycled gamemode;
|
|
|
|
|
public static Button rain;
|
|
|
|
|
public static Button magnet;
|
|
|
|
|
public static Button[] timeButtons = new Button[4];
|
|
|
|
|
public static Button heal;
|
|
|
|
|
|
|
|
|
|
public static IRecipeOverlayRenderer overlayRenderer;
|
|
|
|
|
|
2019-12-30 20:19:16 -08:00
|
|
|
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<>();
|
2014-04-29 10:54:20 +10:00
|
|
|
|
2020-01-08 21:32:53 -08:00
|
|
|
public static boolean itemsLoaded = false;
|
2019-12-24 13:37:41 -08:00
|
|
|
|
2021-05-22 18:31:40 +01:00
|
|
|
/**
|
|
|
|
|
* Not present, Present
|
|
|
|
|
*/
|
|
|
|
|
public static Image[] itemPresenceOverlays = new Image[2];
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
public static void load() {
|
|
|
|
|
API.addLayoutStyle(0, new LayoutStyleMinecraft());
|
|
|
|
|
|
|
|
|
|
instance = new LayoutManager();
|
|
|
|
|
KeyManager.trackers.add(instance);
|
|
|
|
|
GuiContainerManager.addInputHandler(instance);
|
|
|
|
|
GuiContainerManager.addTooltipHandler(instance);
|
|
|
|
|
GuiContainerManager.addDrawHandler(instance);
|
|
|
|
|
GuiContainerManager.addObjectHandler(instance);
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onPreDraw(GuiContainer gui) {
|
|
|
|
|
if (!isHidden() && isEnabled() && gui instanceof InventoryEffectRenderer)//Reset the gui to the center of the screen, for potion effect offsets etc
|
|
|
|
|
{
|
|
|
|
|
gui.guiLeft = (gui.width - gui.xSize) / 2;
|
|
|
|
|
gui.guiTop = (gui.height - gui.ySize) / 2;
|
|
|
|
|
|
|
|
|
|
if (gui instanceof GuiContainerCreative && gui.buttonList.size() >= 2) {
|
|
|
|
|
GuiButton button1 = (GuiButton) gui.buttonList.get(0);
|
|
|
|
|
GuiButton button2 = (GuiButton) gui.buttonList.get(1);
|
|
|
|
|
button1.xPosition = gui.guiLeft;
|
|
|
|
|
button2.xPosition = gui.guiLeft + gui.xSize - 20;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
public static int getSideWidth(GuiContainer gui) {
|
|
|
|
|
return gui.width - 3;
|
|
|
|
|
}
|
|
|
|
|
public static int getLeftSize(GuiContainer gui) {
|
2021-03-24 18:23:30 -07:00
|
|
|
return getSideWidth(gui);
|
2019-12-24 13:37:41 -08:00
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
|
|
|
|
if (isHidden())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
widget.onGuiClick(mousex, mousey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
|
|
|
|
if (isHidden())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!isEnabled())
|
|
|
|
|
return options.contains(mousex, mousey) && options.handleClick(mousex, mousey, button);
|
|
|
|
|
|
|
|
|
|
for (Widget widget : controlWidgets) {
|
|
|
|
|
widget.onGuiClick(mousex, mousey);
|
|
|
|
|
if (widget.contains(mousex, mousey) ? widget.handleClick(mousex, mousey, button) : widget.handleClickExt(mousex, mousey, button))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean objectUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
2014-06-29 20:31:37 +10:00
|
|
|
if (!isHidden() && isEnabled())
|
2014-04-29 10:54:20 +10:00
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
if (widget.contains(mousex, mousey))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean keyTyped(GuiContainer gui, char keyChar, int keyID) {
|
|
|
|
|
if (isEnabled() && !isHidden()) {
|
|
|
|
|
if (inputFocused != null)
|
|
|
|
|
return inputFocused.handleKeyPress(keyID, keyChar);
|
|
|
|
|
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
if (widget.handleKeyPress(keyID, keyChar))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
|
|
|
|
if (keyID == getKeyBinding("gui.hide")) {
|
|
|
|
|
toggleBooleanSetting("inventory.hidden");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-03-14 12:22:27 -07:00
|
|
|
if (keyID == getKeyBinding("gui.hide_bookmarks")) {
|
2021-03-20 22:38:46 -07:00
|
|
|
toggleBooleanSetting("inventory.bookmarksEnabled");
|
2021-03-14 12:22:27 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
if (isEnabled() && !isHidden()) {
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
if (inputFocused == null)
|
|
|
|
|
widget.lastKeyTyped(keyID, keyChar);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onMouseUp(GuiContainer gui, int mx, int my, int button) {
|
|
|
|
|
if (!isHidden() && isEnabled()) {
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
widget.mouseUp(mx, my, button);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onMouseDragged(GuiContainer gui, int mx, int my, int button, long heldTime) {
|
|
|
|
|
if (!isHidden() && isEnabled()) {
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
widget.mouseDragged(mx, my, button, heldTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
|
|
|
|
if (!isHidden() && isEnabled()) {
|
|
|
|
|
for (Widget widget : controlWidgets) {
|
|
|
|
|
ItemStack stack = widget.getStackMouseOver(mousex, mousey);
|
|
|
|
|
if (stack != null)
|
|
|
|
|
return stack;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void renderObjects(GuiContainer gui, int mousex, int mousey) {
|
|
|
|
|
if (!isHidden()) {
|
|
|
|
|
layout(gui);
|
|
|
|
|
if (isEnabled()) {
|
|
|
|
|
getLayoutStyle().drawBackground(GuiContainerManager.getManager(gui));
|
|
|
|
|
for (Widget widget : drawWidgets)
|
|
|
|
|
widget.draw(mousex, mousey);
|
|
|
|
|
} else {
|
|
|
|
|
options.draw(mousex, mousey);
|
2021-03-20 22:38:46 -07:00
|
|
|
bookmarksButton.draw(mousex, mousey);
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-21 21:43:37 -07:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public void postRenderObjects(GuiContainer gui, int mousex, int mousey) {
|
|
|
|
|
if (!isHidden() && isEnabled()) {
|
|
|
|
|
for (Widget widget : drawWidgets)
|
|
|
|
|
widget.postDraw(mousex, mousey);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
|
|
|
|
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
currenttip = widget.handleTooltip(mousex, mousey, currenttip);
|
|
|
|
|
}
|
|
|
|
|
return currenttip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack stack, List<String> currenttip) {
|
|
|
|
|
String overridename = ItemInfo.getNameOverride(stack);
|
|
|
|
|
if (overridename != null)
|
|
|
|
|
currenttip.set(0, overridename);
|
|
|
|
|
|
|
|
|
|
String mainname = currenttip.get(0);
|
|
|
|
|
if (showIDs()) {
|
|
|
|
|
mainname += " " + Item.getIdFromItem(stack.getItem());
|
|
|
|
|
if (stack.getItemDamage() != 0)
|
|
|
|
|
mainname += ":" + stack.getItemDamage();
|
|
|
|
|
|
|
|
|
|
currenttip.set(0, mainname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currenttip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
|
|
|
|
|
return currenttip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void layout(GuiContainer gui) {
|
|
|
|
|
VisiblityData visiblity = new VisiblityData();
|
|
|
|
|
if (isHidden())
|
|
|
|
|
visiblity.showNEI = false;
|
2021-03-14 12:22:27 -07:00
|
|
|
|
|
|
|
|
if (isBookmarkPanelHidden())
|
|
|
|
|
visiblity.showBookmarkPanel = false;
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
if (gui.height - gui.ySize <= 40)
|
|
|
|
|
visiblity.showSearchSection = false;
|
2021-03-14 12:22:27 -07:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
if (gui.guiLeft - 4 < 76)
|
|
|
|
|
visiblity.showWidgets = false;
|
2021-06-05 10:47:58 -07:00
|
|
|
try {
|
|
|
|
|
GuiInfo.readLock.lock();
|
|
|
|
|
GuiInfo.guiHandlers.forEach(handler -> handler.modifyVisiblity(gui, visiblity));
|
|
|
|
|
} finally {
|
|
|
|
|
GuiInfo.readLock.unlock();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
visiblity.translateDependancies();
|
|
|
|
|
|
|
|
|
|
getLayoutStyle().layout(gui, visiblity);
|
|
|
|
|
|
|
|
|
|
updateWidgetVisiblities(gui, visiblity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void init() {
|
2019-12-24 13:37:41 -08:00
|
|
|
itemPanel = ItemPanels.itemPanel;
|
|
|
|
|
itemPanel.init();
|
|
|
|
|
|
|
|
|
|
bookmarkPanel = ItemPanels.bookmarkPanel;
|
|
|
|
|
bookmarkPanel.init();
|
|
|
|
|
|
2014-06-29 20:31:37 +10:00
|
|
|
dropDown = new SubsetWidget();
|
2014-04-29 10:54:20 +10:00
|
|
|
searchField = new SearchField("search");
|
|
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
options = new ButtonCycled(3)
|
2014-04-29 10:54:20 +10:00
|
|
|
{
|
2021-03-23 23:34:05 -07:00
|
|
|
@Override
|
|
|
|
|
public void init() {
|
|
|
|
|
this.icons[0] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 32, 0, 16, 16).build();
|
|
|
|
|
this.icons[1] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 48, 0, 16, 16).build();
|
|
|
|
|
this.icons[2] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 64, 0, 16, 16).build();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (!rightclick) {
|
2021-03-15 22:31:36 -07:00
|
|
|
if (Keyboard.getEventKeyState() && (Keyboard.getEventKey() == Keyboard.KEY_LCONTROL || Keyboard.getEventKey() == Keyboard.KEY_RCONTROL)) {
|
|
|
|
|
NEIClientConfig.cycleSetting("inventory.cheatmode", 3);
|
|
|
|
|
} else {
|
2021-03-28 00:12:17 -07:00
|
|
|
if (Keyboard.getEventKeyState() && (Keyboard.getEventKey() == Keyboard.KEY_LSHIFT || Keyboard.getEventKey() == Keyboard.KEY_RSHIFT)) {
|
|
|
|
|
GuiRecipeTab.loadHandlerInfo();
|
|
|
|
|
}
|
2021-03-15 22:31:36 -07:00
|
|
|
getOptionList().openGui(getGuiContainer(), false);
|
|
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-03-15 22:31:36 -07:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addTooltips(List<String> tooltip) {
|
|
|
|
|
tooltip.add(translate("inventory.options.tip"));
|
|
|
|
|
String modeColor = "";
|
|
|
|
|
final int cheatMode = NEIClientConfig.getCheatMode();
|
|
|
|
|
if (cheatMode == 1)
|
|
|
|
|
modeColor = EnumChatFormatting.GOLD.toString();
|
|
|
|
|
else if (cheatMode == 2)
|
|
|
|
|
modeColor = EnumChatFormatting.RED.toString();
|
|
|
|
|
String controlKeyLocalization = translate(Minecraft.isRunningOnMac ? "key.ctrl.mac" : "key.ctrl");
|
|
|
|
|
tooltip.add(modeColor + translate("inventory.options.tip.cheatmode." + cheatMode));
|
|
|
|
|
tooltip.add(modeColor + translate("inventory.options.tip.cheatmode.disable", controlKeyLocalization));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public String getRenderLabel() {
|
|
|
|
|
return translate("inventory.options");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-20 22:38:46 -07:00
|
|
|
bookmarksButton = new ButtonCycled(2)
|
2014-04-29 10:54:20 +10:00
|
|
|
{
|
2021-03-23 23:34:05 -07:00
|
|
|
@Override
|
|
|
|
|
public void init() {
|
|
|
|
|
this.icons[0] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 0, 0, 16, 16).build();
|
|
|
|
|
this.icons[1] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 16, 0, 16, 16).build();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
@Override
|
2014-04-29 10:54:20 +10:00
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
2021-03-21 09:32:03 -07:00
|
|
|
NEIClientConfig.toggleBooleanSetting("inventory.bookmarksEnabled");
|
2021-03-14 12:22:27 -07:00
|
|
|
return true;
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
public String getButtonTip() {
|
|
|
|
|
return translate("bookmark.toggle.tip");
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public String getRenderLabel() {
|
2019-12-24 13:37:41 -08:00
|
|
|
return translate("bookmark.toggle");
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
more = new Button("+")
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (rightclick)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int modifier = controlKey() ? 64 : shiftKey() ? 10 : 1;
|
|
|
|
|
|
|
|
|
|
int quantity = getItemQuantity() + modifier;
|
|
|
|
|
if (quantity < 0)
|
|
|
|
|
quantity = 0;
|
|
|
|
|
|
|
|
|
|
setItemQuantity(quantity);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
less = new Button("-")
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (rightclick)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int modifier = controlKey() ? -64 : shiftKey() ? -10 : -1;
|
|
|
|
|
|
|
|
|
|
int quantity = getItemQuantity() + modifier;
|
|
|
|
|
if (quantity < 0)
|
|
|
|
|
quantity = 0;
|
|
|
|
|
|
|
|
|
|
setItemQuantity(quantity);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
quantity = new ItemQuantityField("quantity");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete = new Button()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if ((state & 0x3) == 2)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
ItemStack held = getHeldItem();
|
|
|
|
|
if (held != null) {
|
|
|
|
|
if (shiftKey()) {
|
|
|
|
|
deleteHeldItem();
|
|
|
|
|
deleteItemsOfType(held);
|
|
|
|
|
} else if (rightclick)
|
|
|
|
|
decreaseSlotStack(-999);
|
|
|
|
|
else
|
|
|
|
|
deleteHeldItem();
|
|
|
|
|
} else if (shiftKey())
|
|
|
|
|
deleteEverything();
|
|
|
|
|
else
|
|
|
|
|
NEIController.toggleDeleteMode();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getButtonTip() {
|
|
|
|
|
if ((state & 0x3) != 2) {
|
|
|
|
|
if (shiftKey())
|
2014-06-29 20:31:37 +10:00
|
|
|
return translate("inventory.delete.inv");
|
2014-04-29 10:54:20 +10:00
|
|
|
if (NEIController.canUseDeleteMode())
|
|
|
|
|
return getStateTip("delete", state);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void postDraw(int mousex, int mousey) {
|
|
|
|
|
if(contains(mousex, mousey) && getHeldItem() != null && (state & 0x3) != 2)
|
|
|
|
|
GuiDraw.drawTip(mousex + 9, mousey, translate("inventory.delete." + (shiftKey() ? "all" : "one"), GuiContainerManager.itemDisplayNameShort(getHeldItem())));
|
|
|
|
|
}
|
|
|
|
|
};
|
2021-03-15 22:31:36 -07:00
|
|
|
gamemode = new ButtonCycled(3)
|
2014-04-29 10:54:20 +10:00
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (!rightclick) {
|
|
|
|
|
cycleGamemode();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-03-20 22:38:46 -07:00
|
|
|
public void addTooltips(List<String> tooltip) {
|
|
|
|
|
tooltip.add(translate("inventory.current.gamemode." + getGamemode()));
|
|
|
|
|
tooltip.add(EnumChatFormatting.GRAY + translate("inventory.gamemode." + getNextGamemode()));
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
2021-03-20 16:43:24 -07:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
};
|
|
|
|
|
rain = new Button()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (handleDisabledButtonPress("rain", rightclick))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (!rightclick) {
|
|
|
|
|
toggleRaining();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getButtonTip() {
|
|
|
|
|
return getStateTip("rain", state);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
magnet = new Button()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (!rightclick) {
|
|
|
|
|
toggleMagnetMode();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getButtonTip() {
|
|
|
|
|
return getStateTip("magnet", state);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
final int zone = i;
|
|
|
|
|
timeButtons[i] = new Button()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (handleDisabledButtonPress(NEIActions.timeZones[zone], rightclick))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (!rightclick) {
|
|
|
|
|
setHourForward(zone * 6);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonTip() {
|
|
|
|
|
return getTimeTip(NEIActions.timeZones[zone], state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
heal = new Button()
|
|
|
|
|
{
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onButtonPress(boolean rightclick) {
|
|
|
|
|
if (!rightclick) {
|
|
|
|
|
healPlayer();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonTip() {
|
|
|
|
|
return translate("inventory.heal");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
delete.state |= 0x4;
|
|
|
|
|
gamemode.state |= 0x4;
|
|
|
|
|
rain.state |= 0x4;
|
|
|
|
|
magnet.state |= 0x4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getStateTip(String name, int state) {
|
|
|
|
|
String sfx = (state & 0x3) == 2 ? "enable" :
|
|
|
|
|
(state & 0x3) == 1 ? "0" : "1";
|
|
|
|
|
|
|
|
|
|
return translate("inventory." + name + "." + sfx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getTimeTip(String name, int state) {
|
|
|
|
|
String sfx = (state & 0x3) == 2 ? "enable" : "set";
|
|
|
|
|
return translate("inventory." + name + "." + sfx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean handleDisabledButtonPress(String ident, boolean rightclick) {
|
|
|
|
|
if (!NEIActions.canDisable.contains(ident))
|
|
|
|
|
return false;
|
|
|
|
|
if (rightclick != disabledActions.contains(ident))
|
|
|
|
|
return setPropertyDisabled(ident, rightclick);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean setPropertyDisabled(String ident, boolean disable) {
|
|
|
|
|
if (disable && NEIActions.base(ident).equals("time")) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
if (disabledActions.contains(NEIActions.timeZones[i]))
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
if (count == 3)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (hasSMPCounterPart())
|
|
|
|
|
NEICPH.sendSetPropertyDisabled(ident, disable);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-05-30 09:17:12 -07:00
|
|
|
|
|
|
|
|
public static void markItemsDirty() {
|
|
|
|
|
// If anything has modified data this depends on, we'll need to reload the item list
|
|
|
|
|
itemsLoaded = false;
|
|
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void load(GuiContainer gui) {
|
|
|
|
|
if (isEnabled()) {
|
|
|
|
|
setInputFocused(null);
|
|
|
|
|
|
2020-01-08 21:32:53 -08:00
|
|
|
if(!itemsLoaded) {
|
|
|
|
|
ItemList.loadItems.restart();
|
|
|
|
|
itemsLoaded = true;
|
|
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
overlayRenderer = null;
|
|
|
|
|
|
|
|
|
|
getLayoutStyle().init();
|
|
|
|
|
layout(gui);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NEIController.load(gui);
|
|
|
|
|
|
2014-07-03 15:26:48 +10:00
|
|
|
if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+
|
|
|
|
|
gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void refresh(GuiContainer gui) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean checkCreativeInv(GuiContainer gui) {
|
|
|
|
|
if (gui instanceof GuiContainerCreative && invCreativeMode()) {
|
|
|
|
|
NEICPH.sendCreativeInv(true);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (gui instanceof GuiExtendedCreativeInv && !invCreativeMode()) {
|
|
|
|
|
NEICPH.sendCreativeInv(false);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) {
|
2019-12-30 20:19:16 -08:00
|
|
|
drawWidgets = new TreeSet<>(new WidgetZOrder(false));
|
|
|
|
|
controlWidgets = new TreeSet<>(new WidgetZOrder(true));
|
2014-04-29 10:54:20 +10:00
|
|
|
|
|
|
|
|
if (!visiblity.showNEI)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
addWidget(options);
|
2021-03-20 22:38:46 -07:00
|
|
|
addWidget(bookmarksButton);
|
2014-04-29 10:54:20 +10:00
|
|
|
if (visiblity.showItemPanel) {
|
|
|
|
|
addWidget(itemPanel);
|
2019-12-24 13:37:41 -08:00
|
|
|
itemPanel.setVisible();
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
if (canPerformAction("item")) {
|
|
|
|
|
addWidget(more);
|
|
|
|
|
addWidget(less);
|
|
|
|
|
addWidget(quantity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
if (visiblity.showBookmarkPanel) {
|
|
|
|
|
addWidget(bookmarkPanel);
|
|
|
|
|
bookmarkPanel.setVisible();
|
2021-04-03 22:56:15 -07:00
|
|
|
}
|
2019-12-24 13:37:41 -08:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
if (visiblity.showSearchSection) {
|
|
|
|
|
addWidget(searchField);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (visiblity.showUtilityButtons) {
|
|
|
|
|
if (canPerformAction("time")) {
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
addWidget(timeButtons[i]);
|
|
|
|
|
}
|
|
|
|
|
if (canPerformAction("rain"))
|
|
|
|
|
addWidget(rain);
|
|
|
|
|
if (canPerformAction("heal"))
|
|
|
|
|
addWidget(heal);
|
|
|
|
|
if (canPerformAction("magnet"))
|
|
|
|
|
addWidget(magnet);
|
|
|
|
|
if (isValidGamemode("creative") ||
|
|
|
|
|
isValidGamemode("creative+") ||
|
|
|
|
|
isValidGamemode("adventure"))
|
|
|
|
|
addWidget(gamemode);
|
|
|
|
|
if (canPerformAction("delete"))
|
|
|
|
|
addWidget(delete);
|
|
|
|
|
}
|
2021-04-03 22:56:15 -07:00
|
|
|
|
|
|
|
|
if (!visiblity.showBookmarkPanel) {
|
|
|
|
|
// Bookmarks or Subset/dropdown
|
|
|
|
|
addWidget(dropDown);
|
|
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static LayoutStyle getLayoutStyle(int id) {
|
|
|
|
|
LayoutStyle style = layoutStyles.get(id);
|
|
|
|
|
if (style == null)
|
|
|
|
|
style = layoutStyles.get(0);
|
|
|
|
|
return style;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static LayoutStyle getLayoutStyle() {
|
2019-12-24 13:37:41 -08:00
|
|
|
return getLayoutStyle(0);
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
2019-12-24 13:37:41 -08:00
|
|
|
public static void addWidget(Widget widget) {
|
2014-04-29 10:54:20 +10:00
|
|
|
drawWidgets.add(widget);
|
|
|
|
|
controlWidgets.add(widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void guiTick(GuiContainer gui) {
|
|
|
|
|
if (checkCreativeInv(gui))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!isEnabled())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
widget.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
|
|
|
|
if (isHidden() || !isEnabled())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
for (Widget widget : controlWidgets)
|
|
|
|
|
if (widget.onMouseWheel(scrolled, mousex, mousey))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean shouldShowTooltip(GuiContainer gui) {
|
|
|
|
|
return itemPanel.draggedStack == null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Widget getInputFocused() {
|
|
|
|
|
return inputFocused;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setInputFocused(Widget widget) {
|
|
|
|
|
if (inputFocused != null)
|
|
|
|
|
inputFocused.loseFocus();
|
|
|
|
|
|
|
|
|
|
inputFocused = widget;
|
|
|
|
|
if (inputFocused != null)
|
|
|
|
|
inputFocused.gainFocus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void renderSlotUnderlay(GuiContainer gui, Slot slot) {
|
|
|
|
|
if (overlayRenderer != null)
|
|
|
|
|
overlayRenderer.renderOverlay(GuiContainerManager.getManager(gui), slot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void renderSlotOverlay(GuiContainer window, Slot slot) {
|
|
|
|
|
ItemStack item = slot.getStack();
|
2019-12-30 20:19:16 -08:00
|
|
|
if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) {
|
2014-04-29 10:54:20 +10:00
|
|
|
GL11.glDisable(GL11.GL_LIGHTING);
|
|
|
|
|
GL11.glTranslatef(0, 0, 150);
|
|
|
|
|
drawRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0x80000000);
|
|
|
|
|
GL11.glTranslatef(0, 0, -150);
|
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void drawIcon(int x, int y, Image image) {
|
2021-03-23 23:34:05 -07:00
|
|
|
final boolean isDrawableResource = image instanceof DrawableResource;
|
|
|
|
|
|
|
|
|
|
if (!isDrawableResource)
|
|
|
|
|
changeTexture("nei:textures/nei_sprites.png");
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
GL11.glColor4f(1, 1, 1, 1);
|
|
|
|
|
GL11.glEnable(GL11.GL_BLEND);
|
|
|
|
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
2021-03-23 23:34:05 -07:00
|
|
|
if(!isDrawableResource)
|
|
|
|
|
drawTexturedModalRect(x, y, image.x, image.y, image.width, image.height);
|
|
|
|
|
else
|
|
|
|
|
((DrawableResource)image).draw(x, y);
|
2014-04-29 10:54:20 +10:00
|
|
|
GL11.glDisable(GL11.GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void drawButtonBackground(int x, int y, int w, int h, boolean edges, int type) {
|
2021-03-15 22:31:36 -07:00
|
|
|
int wTiles = 0;
|
2014-04-29 10:54:20 +10:00
|
|
|
int ew = w;//end width
|
|
|
|
|
if (w / 2 > 100) {
|
2021-03-15 22:31:36 -07:00
|
|
|
wTiles = (w - 200) / 50 + 1;
|
2014-04-29 10:54:20 +10:00
|
|
|
ew = 200;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
final int w1 = ew / 2;
|
|
|
|
|
final int h1 = h / 2;
|
|
|
|
|
final int w2 = (ew + 1) / 2;
|
|
|
|
|
final int h2 = (h + 1) / 2;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
final int x2 = x + w - w2;
|
|
|
|
|
final int y2 = y + h - h2;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
final int ty = 46 + type * 20;
|
|
|
|
|
final int te = (edges ? 0 : 1);//tex edges
|
2014-04-29 10:54:20 +10:00
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
final int ty1 = ty + te;
|
|
|
|
|
final int tx1 = te;
|
|
|
|
|
final int tx3 = 75;
|
2014-04-29 10:54:20 +10:00
|
|
|
//halfway the 1 is for odd number adjustment
|
2021-03-15 22:31:36 -07:00
|
|
|
final int ty2 = ty + 20 - h2 - te;
|
|
|
|
|
final int tx2 = 200 - w2 - te;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
|
|
|
|
changeTexture("textures/gui/widgets.png");
|
|
|
|
|
drawTexturedModalRect(x, y, tx1, ty1, w1, h1);//top left
|
|
|
|
|
drawTexturedModalRect(x, y2, tx1, ty2, w1, h2);//bottom left
|
|
|
|
|
|
2021-03-15 22:31:36 -07:00
|
|
|
for (int tile = 0; tile < wTiles; tile++) {
|
|
|
|
|
final int tileX = x + w1 + 50 * tile;
|
|
|
|
|
drawTexturedModalRect(tileX, y, tx3, ty1, 50, h1);//top
|
|
|
|
|
drawTexturedModalRect(tileX, y2, tx3, ty2, 50, h2);//bottom
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drawTexturedModalRect(x2, y, tx2, ty1, w2, h1);//top right
|
|
|
|
|
drawTexturedModalRect(x2, y2, tx2, ty2, w2, h2);//bottom right
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-22 18:31:40 +01:00
|
|
|
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent) {
|
|
|
|
|
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
|
|
|
|
|
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
public static LayoutManager instance() {
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void tickKeyStates() {
|
|
|
|
|
if (Minecraft.getMinecraft().currentScreen != null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (KeyManager.keyStates.get("world.dawn").down)
|
|
|
|
|
timeButtons[0].onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.noon").down)
|
|
|
|
|
timeButtons[1].onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.dusk").down)
|
|
|
|
|
timeButtons[2].onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.midnight").down)
|
|
|
|
|
timeButtons[3].onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.rain").down)
|
|
|
|
|
rain.onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.heal").down)
|
|
|
|
|
heal.onButtonPress(false);
|
|
|
|
|
if (KeyManager.keyStates.get("world.creative").down)
|
|
|
|
|
gamemode.onButtonPress(false);
|
|
|
|
|
}
|
2019-12-24 13:37:41 -08:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
2019-12-24 13:37:41 -08:00
|
|
|
|