Graphical User Interfaces
This commit is contained in:
		| @@ -1,20 +1,17 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.google.common.primitives.Ints; | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerAmount; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageSlotFilterSet; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraftforge.items.ItemHandlerHelper; | ||||
|  | ||||
| public class GuiAmount extends GuiAmountSpecifying { | ||||
| public class GuiAmount extends GuiAmountSpecifying<ContainerAmount> { | ||||
|     private int containerSlot; | ||||
|     private ItemStack stack; | ||||
|     private int maxAmount; | ||||
|  | ||||
|     public GuiAmount(GuiBase parent, PlayerEntity player, int containerSlot, ItemStack stack, int maxAmount) { | ||||
|         super(parent, new ContainerAmount(player, stack), 172, 99); | ||||
|         super(parent, new ContainerAmount(player, stack), 172, 99, player.inventory); | ||||
|  | ||||
|         this.containerSlot = containerSlot; | ||||
|         this.stack = stack; | ||||
| @@ -42,7 +39,7 @@ public class GuiAmount extends GuiAmountSpecifying { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected String getTitle() { | ||||
|     protected String getGuiTitle() { | ||||
|         return t("gui.refinedstorage:item_amount"); | ||||
|     } | ||||
|  | ||||
| @@ -64,7 +61,7 @@ public class GuiAmount extends GuiAmountSpecifying { | ||||
|         Integer amount = Ints.tryParse(amountField.getText()); | ||||
|  | ||||
|         if (amount != null) { | ||||
|             RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(containerSlot, ItemHandlerHelper.copyStackWithSize(stack, amount))); | ||||
|             // TODO RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(containerSlot, ItemHandlerHelper.copyStackWithSize(stack, amount))); | ||||
|  | ||||
|             close(); | ||||
|         } | ||||
|   | ||||
| @@ -1,34 +1,30 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.google.common.primitives.Ints; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.gui.GuiTextField; | ||||
| import net.minecraft.inventory.Container; | ||||
| import net.minecraftforge.fml.client.FMLClientHandler; | ||||
| import net.minecraft.client.gui.widget.TextFieldWidget; | ||||
| import net.minecraft.client.gui.widget.button.Button; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.inventory.container.Container; | ||||
| import org.apache.commons.lang3.tuple.Pair; | ||||
| import org.lwjgl.input.Keyboard; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| public abstract class GuiAmountSpecifying extends GuiBase { | ||||
|     protected GuiTextField amountField; | ||||
| public abstract class GuiAmountSpecifying<T extends Container> extends GuiBase<T> { | ||||
|     protected TextFieldWidget amountField; | ||||
|  | ||||
|     private GuiBase parent; | ||||
|  | ||||
|     protected GuiButton okButton; | ||||
|     private GuiButton cancelButton; | ||||
|     protected Button okButton; | ||||
|     private Button cancelButton; | ||||
|  | ||||
|     private GuiButton[] incrementButtons = new GuiButton[6]; | ||||
|     private Button[] incrementButtons = new Button[6]; | ||||
|  | ||||
|     public GuiAmountSpecifying(GuiBase parent, Container container, int width, int height) { | ||||
|         super(container, width, height); | ||||
|     public GuiAmountSpecifying(GuiBase parent, T container, int width, int height, PlayerInventory playerInventory) { | ||||
|         super(container, width, height, playerInventory, null); | ||||
|  | ||||
|         this.parent = parent; | ||||
|     } | ||||
|  | ||||
|     protected abstract String getOkButtonText(); | ||||
|  | ||||
|     protected abstract String getTitle(); | ||||
|     protected abstract String getGuiTitle(); | ||||
|  | ||||
|     protected abstract String getTexture(); | ||||
|  | ||||
| @@ -55,13 +51,13 @@ public abstract class GuiAmountSpecifying extends GuiBase { | ||||
|         okButton = addButton(x + pos.getLeft(), y + pos.getRight(), 50, 20, getOkButtonText()); | ||||
|         cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, 50, 20, t("gui.cancel")); | ||||
|  | ||||
|         amountField = new GuiTextField(0, fontRenderer, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, fontRenderer.FONT_HEIGHT); | ||||
|         amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.FONT_HEIGHT, ""); | ||||
|         amountField.setEnableBackgroundDrawing(false); | ||||
|         amountField.setVisible(true); | ||||
|         amountField.setText(String.valueOf(getDefaultAmount())); | ||||
|         amountField.setTextColor(16777215); | ||||
|         amountField.setCanLoseFocus(false); | ||||
|         amountField.setFocused(true); | ||||
|         amountField.setFocused2(true); | ||||
|  | ||||
|         int[] increments = getIncrements(); | ||||
|  | ||||
| @@ -106,14 +102,15 @@ public abstract class GuiAmountSpecifying extends GuiBase { | ||||
|  | ||||
|         drawTexture(x, y, 0, 0, screenWidth, screenHeight); | ||||
|  | ||||
|         amountField.drawTextBox(); | ||||
|         amountField.renderButton(0, 0, 0); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void drawForeground(int mouseX, int mouseY) { | ||||
|         drawString(7, 7, getTitle()); | ||||
|         drawString(7, 7, getGuiTitle()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void keyTyped(char character, int keyCode) throws IOException { | ||||
|         if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode)) { | ||||
| @@ -172,14 +169,14 @@ public abstract class GuiAmountSpecifying extends GuiBase { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     protected void onOkButtonPressed(boolean shiftDown) { | ||||
|         // NO OP | ||||
|     } | ||||
|  | ||||
|     public void close() { | ||||
|         FMLClientHandler.instance().showGuiScreen(parent); | ||||
|         // TODO FMLClientHandler.instance().showGuiScreen(parent); | ||||
|     } | ||||
|  | ||||
|     public GuiBase getParent() { | ||||
|   | ||||
| @@ -75,7 +75,6 @@ public abstract class GuiBase<T extends Container> extends ContainerScreen { | ||||
|     public GuiBase(T container, int screenWidth, int screenHeight, PlayerInventory inventory, ITextComponent title) { | ||||
|         super(container, inventory, title); | ||||
|  | ||||
|  | ||||
|         this.screenWidth = screenWidth; | ||||
|         this.screenHeight = screenHeight; | ||||
|         this.xSize = screenWidth; | ||||
| @@ -329,7 +328,7 @@ public abstract class GuiBase<T extends Container> extends ContainerScreen { | ||||
|         return button; | ||||
|     } | ||||
|  | ||||
|     public boolean inBounds(int x, int y, int w, int h, int ox, int oy) { | ||||
|     public boolean inBounds(int x, int y, int w, int h, double ox, double oy) { | ||||
|         return ox >= x && ox <= x + w && oy >= y && oy <= y + h; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,17 +1,18 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerController; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.Scrollbar; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.ClientNode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileController; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.client.renderer.GlStateManager; | ||||
| import net.minecraft.client.renderer.RenderHelper; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| public class GuiController extends GuiBase { | ||||
| public class GuiController extends GuiBase<ContainerController> { | ||||
|     private static final int VISIBLE_ROWS = 2; | ||||
|  | ||||
|     private TileController controller; | ||||
| @@ -21,8 +22,8 @@ public class GuiController extends GuiBase { | ||||
|     private int barWidth = 16; | ||||
|     private int barHeight = 59; | ||||
|  | ||||
|     public GuiController(ContainerController container, TileController controller) { | ||||
|         super(container, 176, 181); | ||||
|     public GuiController(ContainerController container, PlayerInventory inventory, TileController controller) { | ||||
|         super(container, 176, 181, inventory, null); | ||||
|  | ||||
|         this.controller = controller; | ||||
|  | ||||
| @@ -75,12 +76,16 @@ public class GuiController extends GuiBase { | ||||
|  | ||||
|                 drawItem(x, y + 5, node.getStack()); | ||||
|  | ||||
|                 float scale = fontRenderer.getUnicodeFlag() ? 1F : 0.5F; | ||||
|                 float scale = /*TODO fontRenderer.getUnicodeFlag() ? 1F :*/ 0.5F; | ||||
|  | ||||
|                 GlStateManager.pushMatrix(); | ||||
|                 GlStateManager.scale(scale, scale, 1); | ||||
|                 GlStateManager.scalef(scale, scale, 1); | ||||
|  | ||||
|                 drawString(RenderUtils.getOffsetOnScale(x + 1, scale), RenderUtils.getOffsetOnScale(y - 2, scale), trimNameIfNeeded(!fontRenderer.getUnicodeFlag(), node.getStack().getDisplayName())); | ||||
|                 drawString( | ||||
|                     RenderUtils.getOffsetOnScale(x + 1, scale), | ||||
|                     RenderUtils.getOffsetOnScale(y - 2, scale), | ||||
|                     trimNameIfNeeded(/*TODO !fontRenderer.getUnicodeFlag()*/false, node.getStack().getDisplayName().getString()) // TODO | ||||
|                 ); | ||||
|                 drawString(RenderUtils.getOffsetOnScale(x + 21, scale), RenderUtils.getOffsetOnScale(y + 10, scale), node.getAmount() + "x"); | ||||
|  | ||||
|                 GlStateManager.popMatrix(); | ||||
|   | ||||
| @@ -3,10 +3,11 @@ package com.raoulvdberge.refinedstorage.gui; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerCrafter; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileCrafter; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiCrafter extends GuiBase { | ||||
|     public GuiCrafter(ContainerCrafter container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiCrafter extends GuiBase<ContainerCrafter> { | ||||
|     public GuiCrafter(ContainerCrafter container, PlayerInventory inventory) { | ||||
|         super(container, 211, 137, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafterManager; | ||||
| @@ -9,23 +10,21 @@ import com.raoulvdberge.refinedstorage.gui.control.*; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileCrafterManager; | ||||
| import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.client.renderer.GlStateManager; | ||||
| import net.minecraft.client.resources.I18n; | ||||
| import net.minecraft.inventory.Slot; | ||||
| import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.inventory.container.Slot; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.util.Map; | ||||
|  | ||||
| @MouseTweaksDisableWheelTweak | ||||
| public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
| // TODO @MouseTweaksDisableWheelTweak | ||||
| public class GuiCrafterManager extends GuiBase<ContainerCrafterManager> implements IResizableDisplay { | ||||
|     private ContainerCrafterManager container; | ||||
|     private NetworkNodeCrafterManager crafterManager; | ||||
|  | ||||
|     private TextFieldSearch searchField; | ||||
|  | ||||
|     public GuiCrafterManager(NetworkNodeCrafterManager crafterManager) { | ||||
|         super(null, 193, 0); | ||||
|     public GuiCrafterManager(PlayerInventory inventory, NetworkNodeCrafterManager crafterManager) { | ||||
|         super(null, 193, 0, inventory, null); | ||||
|  | ||||
|         this.crafterManager = crafterManager; | ||||
|     } | ||||
| @@ -36,7 +35,6 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
|  | ||||
|     public void setContainer(ContainerCrafterManager container) { | ||||
|         this.container = container; | ||||
|         this.inventorySlots = container; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -110,7 +108,7 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
|         int sy = y + 6 + 1; | ||||
|  | ||||
|         if (searchField == null) { | ||||
|             searchField = new TextFieldSearch(0, fontRenderer, sx, sy, 88 - 6); | ||||
|             searchField = new TextFieldSearch(font, sx, sy, 88 - 6); | ||||
|             searchField.addListener(() -> container.initSlots(null)); | ||||
|             searchField.setMode(crafterManager.getSearchBoxMode()); | ||||
|         } else { | ||||
| @@ -154,19 +152,22 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
|         } | ||||
|  | ||||
|         if (searchField != null) { | ||||
|             searchField.drawTextBox(); | ||||
|             // TODO render searchField.render(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException { | ||||
|         super.mouseClicked(mouseX, mouseY, clickedButton); | ||||
|     public boolean mouseClicked(double mouseX, double mouseY, int clickedButton) { | ||||
|         boolean clicked = searchField.mouseClicked(mouseX, mouseY, clickedButton); | ||||
|  | ||||
|         if (searchField != null) { | ||||
|             searchField.mouseClicked(mouseX, mouseY, clickedButton); | ||||
|         if (clicked) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         return super.mouseClicked(mouseX, mouseY, clickedButton); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void keyTyped(char character, int keyCode) throws IOException { | ||||
|         if (searchField == null) { | ||||
| @@ -180,7 +181,7 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
|         } else { | ||||
|             super.keyTyped(character, keyCode); | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public void drawForeground(int mouseX, int mouseY) { | ||||
| @@ -193,11 +194,11 @@ public class GuiCrafterManager extends GuiBase implements IResizableDisplay { | ||||
|  | ||||
|                 if (y >= getTopHeight() - 1 && y < getTopHeight() + getVisibleRows() * 18 - 1) { | ||||
|                     GlStateManager.disableLighting(); | ||||
|                     GlStateManager.color(1, 1, 1); | ||||
|                     GlStateManager.color3f(1, 1, 1); | ||||
|  | ||||
|                     bindTexture("gui/crafter_manager.png"); | ||||
|  | ||||
|                     drawTexturedModalRect(7, y, 0, 174, 18 * 9, 18); | ||||
|                     drawTexture(7, y, 0, 174, 18 * 9, 18); | ||||
|  | ||||
|                     drawString(7 + 4, y + 6, RenderUtils.shorten(I18n.format(heading.getKey()), 25)); | ||||
|                 } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.google.common.base.Optional; | ||||
| import com.google.common.collect.Lists; | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement; | ||||
| import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo; | ||||
| import com.raoulvdberge.refinedstorage.api.network.grid.IGridTab; | ||||
| @@ -14,33 +14,31 @@ import com.raoulvdberge.refinedstorage.container.ContainerCraftingMonitor; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.Scrollbar; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.TabList; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageCraftingMonitorCancel; | ||||
| import com.raoulvdberge.refinedstorage.tile.craftingmonitor.ICraftingMonitor; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.client.gui.FontRenderer; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.renderer.GlStateManager; | ||||
| import net.minecraft.client.gui.widget.button.Button; | ||||
| import net.minecraft.client.renderer.RenderHelper; | ||||
| import net.minecraft.client.resources.I18n; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraftforge.fluids.FluidStack; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.io.IOException; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
|  | ||||
| public class GuiCraftingMonitor extends GuiBase { | ||||
| public class GuiCraftingMonitor extends GuiBase<ContainerCraftingMonitor> { | ||||
|     public class CraftingMonitorElementDrawers extends ElementDrawers { | ||||
|         private IElementDrawer<Integer> overlayDrawer = (x, y, color) -> { | ||||
|             GlStateManager.color(1, 1, 1, 1); | ||||
|             GlStateManager.color4f(1, 1, 1, 1); | ||||
|             GlStateManager.disableLighting(); | ||||
|             drawRect(x, y, x + ITEM_WIDTH, y + ITEM_HEIGHT, color); | ||||
|             fill(x, y, x + ITEM_WIDTH, y + ITEM_HEIGHT, color); | ||||
|         }; | ||||
|  | ||||
|         private IElementDrawer errorDrawer = (x, y, nothing) -> { | ||||
|             GlStateManager.color(1, 1, 1, 1); | ||||
|             GlStateManager.color4f(1, 1, 1, 1); | ||||
|             GlStateManager.disableLighting(); | ||||
|  | ||||
|             bindTexture("gui/crafting_preview.png"); | ||||
| @@ -83,7 +81,7 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|  | ||||
|         @Override | ||||
|         public void drawTooltip(int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer) { | ||||
|             List<String> textLines = Lists.newArrayList(requested.getItem() != null ? requested.getItem().getDisplayName() : requested.getFluid().getLocalizedName()); | ||||
|             List<String> textLines = Lists.newArrayList(requested.getItem() != null ? requested.getItem().getDisplayName().getFormattedText() : requested.getFluid().getDisplayName().getFormattedText()); // TODO | ||||
|             List<String> smallTextLines = Lists.newArrayList(); | ||||
|  | ||||
|             int totalSecs = (int) (System.currentTimeMillis() - executionStarted) / 1000; | ||||
| @@ -106,7 +104,7 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|             } else { | ||||
|                 fluidDrawer.draw(x, y, requested.getFluid()); | ||||
|  | ||||
|                 GlStateManager.enableAlpha(); | ||||
|                 GlStateManager.enableAlphaTest(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @@ -116,8 +114,8 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|     private static final int ITEM_WIDTH = 73; | ||||
|     private static final int ITEM_HEIGHT = 29; | ||||
|  | ||||
|     private GuiButton cancelButton; | ||||
|     private GuiButton cancelAllButton; | ||||
|     private Button cancelButton; | ||||
|     private Button cancelAllButton; | ||||
|  | ||||
|     private ICraftingMonitor craftingMonitor; | ||||
|  | ||||
| @@ -126,8 +124,8 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|  | ||||
|     private IElementDrawers drawers = new CraftingMonitorElementDrawers(); | ||||
|  | ||||
|     public GuiCraftingMonitor(ContainerCraftingMonitor container, ICraftingMonitor craftingMonitor) { | ||||
|         super(container, 254, 201); | ||||
|     public GuiCraftingMonitor(ContainerCraftingMonitor container, ICraftingMonitor craftingMonitor, PlayerInventory inventory) { | ||||
|         super(container, 254, 201, inventory, null); | ||||
|  | ||||
|         this.craftingMonitor = craftingMonitor; | ||||
|  | ||||
| @@ -187,8 +185,8 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|         String cancel = t("gui.cancel"); | ||||
|         String cancelAll = t("misc.refinedstorage:cancel_all"); | ||||
|  | ||||
|         int cancelButtonWidth = 14 + fontRenderer.getStringWidth(cancel); | ||||
|         int cancelAllButtonWidth = 14 + fontRenderer.getStringWidth(cancelAll); | ||||
|         int cancelButtonWidth = 14 + font.getStringWidth(cancel); | ||||
|         int cancelAllButtonWidth = 14 + font.getStringWidth(cancelAll); | ||||
|  | ||||
|         this.cancelButton = addButton(x + 7, y + 201 - 20 - 7, cancelButtonWidth, 20, cancel, false, true); | ||||
|         this.cancelAllButton = addButton(x + 7 + cancelButtonWidth + 4, y + 201 - 20 - 7, cancelAllButtonWidth, 20, cancelAll, false, true); | ||||
| @@ -212,11 +210,11 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|         this.tabs.update(); | ||||
|  | ||||
|         if (cancelButton != null) { | ||||
|             cancelButton.enabled = hasValidTabSelected(); | ||||
|             cancelButton.active = hasValidTabSelected(); // TODO is it active? | ||||
|         } | ||||
|  | ||||
|         if (cancelAllButton != null) { | ||||
|             cancelAllButton.enabled = tasks.size() > 0; | ||||
|             cancelAllButton.active = tasks.size() > 0; // TODO is it active? | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -299,9 +297,10 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|             drawTooltip(mouseX, mouseY, I18n.format(itemSelectedTooltip)); | ||||
|         } | ||||
|  | ||||
|         tabs.drawTooltip(fontRenderer, mouseX, mouseY); | ||||
|         tabs.drawTooltip(font, mouseX, mouseY); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void actionPerformed(GuiButton button) throws IOException { | ||||
|         super.actionPerformed(button); | ||||
| @@ -313,12 +312,14 @@ public class GuiCraftingMonitor extends GuiBase { | ||||
|         } else if (button == cancelAllButton && tasks.size() > 0) { | ||||
|             RS.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(null)); | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { | ||||
|         super.mouseClicked(mouseX, mouseY, mouseButton); | ||||
|     public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { | ||||
|         if (super.mouseClicked(mouseX, mouseY, mouseButton)) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         this.tabs.mouseClicked(); | ||||
|         return this.tabs.mouseClicked(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,10 +4,11 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerDestructor; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.*; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDestructor; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiDestructor extends GuiBase { | ||||
|     public GuiDestructor(ContainerDestructor container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiDestructor extends GuiBase<ContainerDestructor> { | ||||
|     public GuiDestructor(ContainerDestructor container, PlayerInventory playerInventory) { | ||||
|         super(container, 211, 137, playerInventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -18,7 +19,6 @@ public class GuiDestructor extends GuiBase { | ||||
|  | ||||
|         addSideButton(new SideButtonMode(this, TileDestructor.MODE)); | ||||
|  | ||||
|         addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_NBT)); | ||||
|  | ||||
|         addSideButton(new SideButtonDestructorPickup(this)); | ||||
|   | ||||
| @@ -1,22 +1,19 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.google.common.primitives.Ints; | ||||
| import com.raoulvdberge.refinedstorage.api.util.IComparer; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerDetector; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonCompare; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonDetectorMode; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonType; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDetector; | ||||
| import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; | ||||
| import net.minecraft.client.gui.GuiTextField; | ||||
| import net.minecraft.client.gui.widget.TextFieldWidget; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| import java.io.IOException; | ||||
| public class GuiDetector extends GuiBase<ContainerDetector> { | ||||
|     private TextFieldWidget amount; | ||||
|  | ||||
| public class GuiDetector extends GuiBase { | ||||
|     private GuiTextField amount; | ||||
|  | ||||
|     public GuiDetector(ContainerDetector container) { | ||||
|         super(container, 176, 137); | ||||
|     public GuiDetector(ContainerDetector container, PlayerInventory inventory) { | ||||
|         super(container, 176, 137, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -25,16 +22,15 @@ public class GuiDetector extends GuiBase { | ||||
|  | ||||
|         addSideButton(new SideButtonDetectorMode(this)); | ||||
|  | ||||
|         addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_NBT)); | ||||
|  | ||||
|         amount = new GuiTextField(0, fontRenderer, x + 41 + 1, y + 23 + 1, 50, fontRenderer.FONT_HEIGHT); | ||||
|         amount = new TextFieldWidget(font, x + 41 + 1, y + 23 + 1, 50, font.FONT_HEIGHT, ""); | ||||
|         amount.setText(String.valueOf(TileDetector.AMOUNT.getValue())); | ||||
|         amount.setEnableBackgroundDrawing(false); | ||||
|         amount.setVisible(true); | ||||
|         amount.setTextColor(16777215); | ||||
|         amount.setCanLoseFocus(true); | ||||
|         amount.setFocused(false); | ||||
|         amount.setFocused2(false); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -47,7 +43,7 @@ public class GuiDetector extends GuiBase { | ||||
|  | ||||
|         drawTexture(x, y, 0, 0, screenWidth, screenHeight); | ||||
|  | ||||
|         amount.drawTextBox(); | ||||
|         amount.renderButton(0, 0, 0); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -56,6 +52,7 @@ public class GuiDetector extends GuiBase { | ||||
|         drawString(7, 43, t("container.inventory")); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void keyTyped(char character, int keyCode) throws IOException { | ||||
|         if (!checkHotbarKeys(keyCode) && amount.textboxKeyTyped(character, keyCode)) { | ||||
| @@ -74,9 +71,9 @@ public class GuiDetector extends GuiBase { | ||||
|         super.mouseClicked(mouseX, mouseY, mouseButton); | ||||
|  | ||||
|         amount.mouseClicked(mouseX, mouseY, mouseButton); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     public GuiTextField getAmount() { | ||||
|     public TextFieldWidget getAmount() { | ||||
|         return amount; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,10 +4,11 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerDiskManipulator; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.*; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiDiskManipulator extends GuiBase { | ||||
|     public GuiDiskManipulator(ContainerDiskManipulator container) { | ||||
|         super(container, 211, 211); | ||||
| public class GuiDiskManipulator extends GuiBase<ContainerDiskManipulator> { | ||||
|     public GuiDiskManipulator(ContainerDiskManipulator container, PlayerInventory playerInventory) { | ||||
|         super(container, 211, 211, playerInventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -16,7 +17,6 @@ public class GuiDiskManipulator extends GuiBase { | ||||
|         addSideButton(new SideButtonIOMode(this)); | ||||
|         addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE)); | ||||
|         addSideButton(new SideButtonMode(this, TileDiskManipulator.MODE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_NBT)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -6,10 +6,11 @@ import com.raoulvdberge.refinedstorage.gui.control.SideButtonCompare; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonType; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileExporter; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiExporter extends GuiBase { | ||||
|     public GuiExporter(ContainerExporter container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiExporter extends GuiBase<ContainerExporter> { | ||||
|     public GuiExporter(ContainerExporter container, PlayerInventory playerInventory) { | ||||
|         super(container, 211, 137, playerInventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -18,7 +19,6 @@ public class GuiExporter extends GuiBase { | ||||
|  | ||||
|         addSideButton(new SideButtonType(this, TileExporter.TYPE)); | ||||
|  | ||||
|         addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_NBT)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,21 +1,17 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.api.util.IComparer; | ||||
| import com.raoulvdberge.refinedstorage.api.util.IFilter; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerFilter; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonFilterType; | ||||
| import com.raoulvdberge.refinedstorage.item.ItemFilter; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageFilterUpdate; | ||||
| import com.raoulvdberge.refinedstorage.tile.config.IType; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.gui.GuiTextField; | ||||
| import net.minecraft.client.gui.widget.TextFieldWidget; | ||||
| import net.minecraft.client.gui.widget.button.Button; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraftforge.fml.client.config.GuiCheckBox; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| public class GuiFilter extends GuiBase { | ||||
| public class GuiFilter extends GuiBase<ContainerFilter> { | ||||
|     private ItemStack stack; | ||||
|  | ||||
|     private int compare; | ||||
| @@ -24,14 +20,13 @@ public class GuiFilter extends GuiBase { | ||||
|     private String name; | ||||
|     private int type; | ||||
|  | ||||
|     private GuiCheckBox compareDamage; | ||||
|     private GuiCheckBox compareNbt; | ||||
|     private GuiCheckBox toggleModFilter; | ||||
|     private GuiButton toggleMode; | ||||
|     private GuiTextField nameField; | ||||
|     private Button toggleMode; | ||||
|     private TextFieldWidget nameField; | ||||
|  | ||||
|     public GuiFilter(ContainerFilter container) { | ||||
|         super(container, 176, 231); | ||||
|     public GuiFilter(ContainerFilter container, PlayerInventory inventory) { | ||||
|         super(container, 176, 231, inventory, null); | ||||
|  | ||||
|         this.stack = container.getStack(); | ||||
|  | ||||
| @@ -45,20 +40,18 @@ public class GuiFilter extends GuiBase { | ||||
|     @Override | ||||
|     public void init(int x, int y) { | ||||
|         compareNbt = addCheckBox(x + 7, y + 77, t("gui.refinedstorage:filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT); | ||||
|         compareDamage = addCheckBox(x + 7 + compareNbt.getButtonWidth() + 4, y + 77, t("gui.refinedstorage:filter.compare_damage"), (compare & IComparer.COMPARE_DAMAGE) == IComparer.COMPARE_DAMAGE); | ||||
|         compareDamage.visible = type == IType.ITEMS; | ||||
|  | ||||
|         toggleModFilter = addCheckBox(0, y + 71 + 25, t("gui.refinedstorage:filter.mod_filter"), modFilter); | ||||
|         toggleMode = addButton(x + 7, y + 71 + 21, 0, 20, ""); | ||||
|  | ||||
|         updateModeButton(mode); | ||||
|  | ||||
|         nameField = new GuiTextField(0, fontRenderer, x + 34, y + 121, 137 - 6, fontRenderer.FONT_HEIGHT); | ||||
|         nameField = new TextFieldWidget(font, x + 34, y + 121, 137 - 6, font.FONT_HEIGHT, ""); | ||||
|         nameField.setText(name); | ||||
|         nameField.setEnableBackgroundDrawing(false); | ||||
|         nameField.setVisible(true); | ||||
|         nameField.setCanLoseFocus(true); | ||||
|         nameField.setFocused(false); | ||||
|         nameField.setFocused2(false); | ||||
|         nameField.setTextColor(16777215); | ||||
|  | ||||
|         addSideButton(new SideButtonFilterType(this)); | ||||
| @@ -67,9 +60,9 @@ public class GuiFilter extends GuiBase { | ||||
|     private void updateModeButton(int mode) { | ||||
|         String text = mode == IFilter.MODE_WHITELIST ? t("sidebutton.refinedstorage:mode.whitelist") : t("sidebutton.refinedstorage:mode.blacklist"); | ||||
|  | ||||
|         toggleMode.setWidth(fontRenderer.getStringWidth(text) + 12); | ||||
|         toggleMode.displayString = text; | ||||
|         toggleModFilter.x = toggleMode.x + toggleMode.getButtonWidth() + 4; | ||||
|         toggleMode.setWidth(font.getStringWidth(text) + 12); | ||||
|         toggleMode.setMessage(text); | ||||
|         toggleModFilter.x = toggleMode.x + toggleMode.getWidth() + 4; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -82,7 +75,7 @@ public class GuiFilter extends GuiBase { | ||||
|  | ||||
|         drawTexture(x, y, 0, 0, screenWidth, screenHeight); | ||||
|  | ||||
|         nameField.drawTextBox(); | ||||
|         nameField.renderButton(0, 0, 0); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -91,6 +84,7 @@ public class GuiFilter extends GuiBase { | ||||
|         drawString(7, 137, t("container.inventory")); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void keyTyped(char character, int keyCode) throws IOException { | ||||
|         if (!checkHotbarKeys(keyCode) && nameField.textboxKeyTyped(character, keyCode)) { | ||||
| @@ -108,7 +102,7 @@ public class GuiFilter extends GuiBase { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void actionPerformed(GuiButton button) throws IOException { | ||||
|     protected void actionPerformed(Button button) throws IOException { | ||||
|         super.actionPerformed(button); | ||||
|  | ||||
|         if (button == compareDamage) { | ||||
| @@ -124,7 +118,7 @@ public class GuiFilter extends GuiBase { | ||||
|         } | ||||
|  | ||||
|         sendUpdate(); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     public int getType() { | ||||
|         return type; | ||||
| @@ -134,11 +128,9 @@ public class GuiFilter extends GuiBase { | ||||
|         this.type = type; | ||||
|  | ||||
|         ItemFilter.setType(stack, type); | ||||
|  | ||||
|         compareDamage.visible = type == IType.ITEMS; | ||||
|     } | ||||
|  | ||||
|     public void sendUpdate() { | ||||
|         RS.INSTANCE.network.sendToServer(new MessageFilterUpdate(compare, mode, modFilter, nameField.getText(), type)); | ||||
|         // TODO RS.INSTANCE.network.sendToServer(new MessageFilterUpdate(compare, mode, modFilter, nameField.getText(), type)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,19 +1,17 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.google.common.primitives.Ints; | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerFluidAmount; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageSlotFilterFluidSetAmount; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraftforge.fluids.FluidStack; | ||||
|  | ||||
| public class GuiFluidAmount extends GuiAmountSpecifying { | ||||
| public class GuiFluidAmount extends GuiAmountSpecifying<ContainerFluidAmount> { | ||||
|     private int containerSlot; | ||||
|     private FluidStack stack; | ||||
|     private int maxAmount; | ||||
|  | ||||
|     public GuiFluidAmount(GuiBase parent, PlayerEntity player, int containerSlot, FluidStack stack, int maxAmount) { | ||||
|         super(parent, new ContainerFluidAmount(player, stack), 172, 99); | ||||
|         super(parent, new ContainerFluidAmount(player, stack), 172, 99, player.inventory); | ||||
|  | ||||
|         this.containerSlot = containerSlot; | ||||
|         this.stack = stack; | ||||
| @@ -22,7 +20,7 @@ public class GuiFluidAmount extends GuiAmountSpecifying { | ||||
|  | ||||
|     @Override | ||||
|     protected int getDefaultAmount() { | ||||
|         return stack.amount; | ||||
|         return stack.getAmount(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -41,7 +39,7 @@ public class GuiFluidAmount extends GuiAmountSpecifying { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected String getTitle() { | ||||
|     protected String getGuiTitle() { | ||||
|         return t("gui.refinedstorage:fluid_amount"); | ||||
|     } | ||||
|  | ||||
| @@ -63,7 +61,7 @@ public class GuiFluidAmount extends GuiAmountSpecifying { | ||||
|         Integer amount = Ints.tryParse(amountField.getText()); | ||||
|  | ||||
|         if (amount != null) { | ||||
|             RS.INSTANCE.network.sendToServer(new MessageSlotFilterFluidSetAmount(containerSlot, amount)); | ||||
|             // TODO RS.INSTANCE.network.sendToServer(new MessageSlotFilterFluidSetAmount(containerSlot, amount)); | ||||
|  | ||||
|             close(); | ||||
|         } | ||||
|   | ||||
| @@ -6,13 +6,14 @@ import com.raoulvdberge.refinedstorage.container.ContainerFluidInterface; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileFluidInterface; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.util.text.TextFormatting; | ||||
|  | ||||
| public class GuiFluidInterface extends GuiBase { | ||||
| public class GuiFluidInterface extends GuiBase<ContainerFluidInterface> { | ||||
|     private static final RenderUtils.FluidRenderer TANK_RENDERER = new RenderUtils.FluidRenderer(NetworkNodeFluidInterface.TANK_CAPACITY, 12, 47); | ||||
|  | ||||
|     public GuiFluidInterface(ContainerFluidInterface container) { | ||||
|         super(container, 211, 204); | ||||
|     public GuiFluidInterface(ContainerFluidInterface container, PlayerInventory inventory) { | ||||
|         super(container, 211, 204, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -31,11 +32,11 @@ public class GuiFluidInterface extends GuiBase { | ||||
|         drawTexture(x, y, 0, 0, screenWidth, screenHeight); | ||||
|  | ||||
|         if (TileFluidInterface.TANK_IN.getValue() != null) { | ||||
|             TANK_RENDERER.draw(mc, x + 46, y + 56, TileFluidInterface.TANK_IN.getValue()); | ||||
|             TANK_RENDERER.draw(minecraft, x + 46, y + 56, TileFluidInterface.TANK_IN.getValue()); | ||||
|         } | ||||
|  | ||||
|         if (TileFluidInterface.TANK_OUT.getValue() != null) { | ||||
|             TANK_RENDERER.draw(mc, x + 118, y + 56, TileFluidInterface.TANK_OUT.getValue()); | ||||
|             TANK_RENDERER.draw(minecraft, x + 118, y + 56, TileFluidInterface.TANK_OUT.getValue()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -46,12 +47,14 @@ public class GuiFluidInterface extends GuiBase { | ||||
|         drawString(115 + 1, 20, t("gui.refinedstorage:fluid_interface.out")); | ||||
|         drawString(7, 111, t("container.inventory")); | ||||
|  | ||||
|         // TODO getFormattedText | ||||
|         if (inBounds(46, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_IN.getValue() != null) { | ||||
|             drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_IN.getValue().getLocalizedName() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_IN.getValue().amount) + TextFormatting.RESET); | ||||
|             drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_IN.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_IN.getValue().getAmount()) + TextFormatting.RESET); | ||||
|         } | ||||
|  | ||||
|         // TODO getFormattedText | ||||
|         if (inBounds(118, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_OUT.getValue() != null) { | ||||
|             drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_OUT.getValue().getLocalizedName() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_OUT.getValue().amount) + TextFormatting.RESET); | ||||
|             drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_OUT.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(TileFluidInterface.TANK_OUT.getValue().getAmount()) + TextFormatting.RESET); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,10 +7,11 @@ import com.raoulvdberge.refinedstorage.gui.control.SideButtonMode; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonType; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileImporter; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiImporter extends GuiBase { | ||||
|     public GuiImporter(ContainerImporter container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiImporter extends GuiBase<ContainerImporter> { | ||||
|     public GuiImporter(ContainerImporter container, PlayerInventory inventory) { | ||||
|         super(container, 211, 137, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -21,7 +22,6 @@ public class GuiImporter extends GuiBase { | ||||
|  | ||||
|         addSideButton(new SideButtonMode(this, TileImporter.MODE)); | ||||
|  | ||||
|         addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_NBT)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -5,17 +5,17 @@ import com.raoulvdberge.refinedstorage.container.ContainerInterface; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonCompare; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileInterface; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiInterface extends GuiBase { | ||||
|     public GuiInterface(ContainerInterface container) { | ||||
|         super(container, 211, 217); | ||||
| public class GuiInterface extends GuiBase<ContainerInterface> { | ||||
|     public GuiInterface(ContainerInterface container, PlayerInventory inventory) { | ||||
|         super(container, 211, 217, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void init(int x, int y) { | ||||
|         addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE)); | ||||
|  | ||||
|         addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,12 +3,13 @@ package com.raoulvdberge.refinedstorage.gui; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerNetworkTransmitter; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiNetworkTransmitter extends GuiBase { | ||||
| public class GuiNetworkTransmitter extends GuiBase<ContainerNetworkTransmitter> { | ||||
|     private TileNetworkTransmitter networkTransmitter; | ||||
|  | ||||
|     public GuiNetworkTransmitter(ContainerNetworkTransmitter container, TileNetworkTransmitter networkTransmitter) { | ||||
|         super(container, 176, 137); | ||||
|     public GuiNetworkTransmitter(ContainerNetworkTransmitter container, TileNetworkTransmitter networkTransmitter, PlayerInventory inventory) { | ||||
|         super(container, 176, 137, inventory, null); | ||||
|  | ||||
|         this.networkTransmitter = networkTransmitter; | ||||
|     } | ||||
| @@ -37,7 +38,7 @@ public class GuiNetworkTransmitter extends GuiBase { | ||||
|  | ||||
|         if (networkTransmitter.getNode().getNetworkCard().getStackInSlot(0).isEmpty()) { | ||||
|             distance = t("gui.refinedstorage:network_transmitter.missing_card"); | ||||
|         } else if (TileNetworkTransmitter.RECEIVER_DIMENSION.getValue() != networkTransmitter.getWorld().provider.getDimension()) { | ||||
|         } else if (TileNetworkTransmitter.RECEIVER_DIMENSION.getValue() != networkTransmitter.getWorld().getDimension().getType().getId()) { | ||||
|             distance = t("gui.refinedstorage:network_transmitter.dimension", TileNetworkTransmitter.RECEIVER_DIMENSION.getValue()); | ||||
|         } else if (TileNetworkTransmitter.DISTANCE.getValue() != -1) { | ||||
|             distance = t("gui.refinedstorage:network_transmitter.distance", TileNetworkTransmitter.DISTANCE.getValue()); | ||||
|   | ||||
| @@ -4,19 +4,20 @@ import com.google.common.primitives.Ints; | ||||
| import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; | ||||
| import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.inventory.Container; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.inventory.container.Container; | ||||
| import org.apache.commons.lang3.tuple.Pair; | ||||
|  | ||||
| public class GuiPriority extends GuiAmountSpecifying { | ||||
| public class GuiPriority extends GuiAmountSpecifying<Container> { | ||||
|     private TileDataParameter<Integer, ?> priority; | ||||
|  | ||||
|     public GuiPriority(GuiBase parent, TileDataParameter<Integer, ?> priority) { | ||||
|         super(parent, new Container() { | ||||
|     public GuiPriority(GuiBase parent, TileDataParameter<Integer, ?> priority, PlayerInventory inventory) { | ||||
|         super(parent, new Container(null, 0) { // TODO ctor | ||||
|             @Override | ||||
|             public boolean canInteractWith(PlayerEntity player) { | ||||
|                 return false; | ||||
|             } | ||||
|         }, 164, 92); | ||||
|         }, 164, 92, inventory); | ||||
|  | ||||
|         this.priority = priority; | ||||
|     } | ||||
| @@ -32,7 +33,7 @@ public class GuiPriority extends GuiAmountSpecifying { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected String getTitle() { | ||||
|     protected String getGuiTitle() { | ||||
|         return t("misc.refinedstorage:priority"); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,24 +1,20 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiReaderWriter; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerReaderWriter; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.Scrollbar; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageReaderWriterChannelAdd; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageReaderWriterChannelRemove; | ||||
| import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.gui.GuiTextField; | ||||
| import net.minecraft.client.renderer.GlStateManager; | ||||
| import org.lwjgl.input.Keyboard; | ||||
| import net.minecraft.client.gui.widget.TextFieldWidget; | ||||
| import net.minecraft.client.gui.widget.button.Button; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
|  | ||||
| public class GuiReaderWriter extends GuiBase { | ||||
| public class GuiReaderWriter extends GuiBase<ContainerReaderWriter> { | ||||
|     private static final int VISIBLE_ROWS = 4; | ||||
|  | ||||
|     private static final int ITEM_WIDTH = 143; | ||||
| @@ -27,17 +23,17 @@ public class GuiReaderWriter extends GuiBase { | ||||
|     private List<String> channels = Collections.emptyList(); | ||||
|     private String currentChannelToSet; | ||||
|  | ||||
|     private GuiButton add; | ||||
|     private GuiButton remove; | ||||
|     private GuiTextField name; | ||||
|     private Button add; | ||||
|     private Button remove; | ||||
|     private TextFieldWidget name; | ||||
|     private IGuiReaderWriter readerWriter; | ||||
|  | ||||
|     private int itemSelected = -1; | ||||
|     private int itemSelectedX = -1; | ||||
|     private int itemSelectedY = -1; | ||||
|  | ||||
|     public GuiReaderWriter(ContainerReaderWriter container, IGuiReaderWriter readerWriter) { | ||||
|         super(container, 176, 209); | ||||
|     public GuiReaderWriter(ContainerReaderWriter container, IGuiReaderWriter readerWriter, PlayerInventory inventory) { | ||||
|         super(container, 176, 209, inventory, null); | ||||
|  | ||||
|         this.readerWriter = readerWriter; | ||||
|         this.scrollbar = new Scrollbar(157, 39, 12, 71); | ||||
| @@ -49,12 +45,12 @@ public class GuiReaderWriter extends GuiBase { | ||||
|  | ||||
|         add = addButton(x + 128, y + 15, 20, 20, "+"); | ||||
|         remove = addButton(x + 150, y + 15, 20, 20, "-"); | ||||
|         name = new GuiTextField(0, fontRenderer, x + 8 + 1, y + 20 + 1, 107, fontRenderer.FONT_HEIGHT); | ||||
|         name = new TextFieldWidget(font, x + 8 + 1, y + 20 + 1, 107, font.FONT_HEIGHT, ""); | ||||
|         name.setEnableBackgroundDrawing(false); | ||||
|         name.setVisible(true); | ||||
|         name.setTextColor(16777215); | ||||
|         name.setCanLoseFocus(true); | ||||
|         name.setFocused(false); | ||||
|         name.setFocused2(false); | ||||
|     } | ||||
|  | ||||
|     private List<String> getChannels() { | ||||
| @@ -99,7 +95,7 @@ public class GuiReaderWriter extends GuiBase { | ||||
|             drawTexture(x + itemSelectedX, y + itemSelectedY, 0, 216, ITEM_WIDTH, ITEM_HEIGHT); | ||||
|         } | ||||
|  | ||||
|         name.drawTextBox(); | ||||
|         name.renderButton(0, 0, 0); // TODO is still needed with the new widget stuffs? | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -112,7 +108,7 @@ public class GuiReaderWriter extends GuiBase { | ||||
|  | ||||
|         int item = scrollbar != null ? scrollbar.getOffset() : 0; | ||||
|  | ||||
|         float scale = fontRenderer.getUnicodeFlag() ? 1F : 0.5F; | ||||
|         float scale = /*TODO fontRenderer.getUnicodeFlag() ? 1F :*/ 0.5F; | ||||
|  | ||||
|         for (int i = 0; i < VISIBLE_ROWS; ++i) { | ||||
|             if (item < getChannels().size()) { | ||||
| @@ -122,7 +118,7 @@ public class GuiReaderWriter extends GuiBase { | ||||
|                 } | ||||
|  | ||||
|                 GlStateManager.pushMatrix(); | ||||
|                 GlStateManager.scale(scale, scale, 1); | ||||
|                 GlStateManager.scalef(scale, scale, 1); | ||||
|  | ||||
|                 drawString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 7, scale), getChannels().get(item)); | ||||
|  | ||||
| @@ -135,11 +131,16 @@ public class GuiReaderWriter extends GuiBase { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { | ||||
|         super.mouseClicked(mouseX, mouseY, mouseButton); | ||||
|  | ||||
|         name.mouseClicked(mouseX, mouseY, mouseButton); | ||||
|     @Override | ||||
|     public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { | ||||
|         if (super.mouseClicked(mouseX, mouseY, mouseButton)) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (name.mouseClicked(mouseX, mouseY, mouseButton)) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (inBounds(8, 39, 144, 73, mouseX - guiLeft, mouseY - guiTop)) { | ||||
|             if (mouseButton == 0) { | ||||
| @@ -158,9 +159,14 @@ public class GuiReaderWriter extends GuiBase { | ||||
|             } else if (itemSelected != -1) { | ||||
|                 TileDataManager.setParameter(readerWriter.getChannelParameter(), ""); | ||||
|             } | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void keyTyped(char character, int keyCode) throws IOException { | ||||
|         if (keyCode == Keyboard.KEY_DELETE) { | ||||
| @@ -183,13 +189,13 @@ public class GuiReaderWriter extends GuiBase { | ||||
|         } else if (button == remove) { | ||||
|             onRemove(); | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     private void onAdd() { | ||||
|         String name = this.name.getText().trim(); | ||||
|  | ||||
|         if (!name.isEmpty()) { | ||||
|             RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelAdd(name)); | ||||
|             // TODO RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelAdd(name)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -197,7 +203,7 @@ public class GuiReaderWriter extends GuiBase { | ||||
|         String name = this.name.getText().trim(); | ||||
|  | ||||
|         if (!name.isEmpty()) { | ||||
|             RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelRemove(name)); | ||||
|             // TODO RS.INSTANCE.network.sendToServer(new MessageReaderWriterChannelRemove(name)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,10 +3,11 @@ package com.raoulvdberge.refinedstorage.gui; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerRelay; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileRelay; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiRelay extends GuiBase { | ||||
|     public GuiRelay(ContainerRelay container) { | ||||
|         super(container, 176, 131); | ||||
| public class GuiRelay extends GuiBase<ContainerRelay> { | ||||
|     public GuiRelay(ContainerRelay container, PlayerInventory inventory) { | ||||
|         super(container, 176, 131, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -1,25 +1,21 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerSecurityManager; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.item.ItemSecurityCard; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageSecurityManagerUpdate; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileSecurityManager; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.resources.I18n; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraftforge.fml.client.config.GuiCheckBox; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| public class GuiSecurityManager extends GuiBase { | ||||
| public class GuiSecurityManager extends GuiBase<ContainerSecurityManager> { | ||||
|     private TileSecurityManager securityManager; | ||||
|     private GuiCheckBox[] permissions = new GuiCheckBox[Permission.values().length]; | ||||
|  | ||||
|     public GuiSecurityManager(ContainerSecurityManager container, TileSecurityManager securityManager) { | ||||
|         super(container, 176, 234); | ||||
|     public GuiSecurityManager(ContainerSecurityManager container, TileSecurityManager securityManager, PlayerInventory inventory) { | ||||
|         super(container, 176, 234, inventory, null); | ||||
|  | ||||
|         this.securityManager = securityManager; | ||||
|     } | ||||
| @@ -47,6 +43,7 @@ public class GuiSecurityManager extends GuiBase { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void actionPerformed(GuiButton button) throws IOException { | ||||
|         super.actionPerformed(button); | ||||
| @@ -56,7 +53,7 @@ public class GuiSecurityManager extends GuiBase { | ||||
|                 RS.INSTANCE.network.sendToServer(new MessageSecurityManagerUpdate(securityManager, Permission.values()[i], permissions[i].isChecked())); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public void drawBackground(int x, int y, int mouseX, int mouseY) { | ||||
| @@ -74,7 +71,7 @@ public class GuiSecurityManager extends GuiBase { | ||||
|         for (int i = 0; i < permissions.length; ++i) { | ||||
|             GuiCheckBox permission = permissions[i]; | ||||
|  | ||||
|             if (inBounds(permission.x - guiLeft, permission.y - guiTop, permission.width, permission.height, mouseX, mouseY)) { | ||||
|             if (inBounds(permission.x - guiLeft, permission.y - guiTop, permission.getWidth(), permission.getHeight(), mouseX, mouseY)) { | ||||
|                 drawTooltip(mouseX, mouseY, I18n.format("gui.refinedstorage:security_manager.permission." + i + ".tooltip")); | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -5,32 +5,30 @@ import com.raoulvdberge.refinedstorage.apiimpl.API; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiStorage; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerBase; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.*; | ||||
| import net.minecraft.client.gui.GuiButton; | ||||
| import net.minecraft.client.gui.widget.button.Button; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.util.text.TextFormatting; | ||||
| import net.minecraftforge.fml.common.FMLCommonHandler; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| public class GuiStorage extends GuiBase { | ||||
| public class GuiStorage extends GuiBase<ContainerBase> { | ||||
|     private IGuiStorage gui; | ||||
|     private String texture; | ||||
|  | ||||
|     private GuiButton priorityButton; | ||||
|     private Button priorityButton; | ||||
|  | ||||
|     private int barX = 8; | ||||
|     private int barY = 54; | ||||
|     private int barWidth = 16; | ||||
|     private int barHeight = 70; | ||||
|  | ||||
|     public GuiStorage(ContainerBase container, IGuiStorage gui, String texture) { | ||||
|         super(container, 176, 223); | ||||
|     public GuiStorage(ContainerBase container, IGuiStorage gui, String texture, PlayerInventory inventory) { | ||||
|         super(container, 176, 223, inventory, null); | ||||
|  | ||||
|         this.gui = gui; | ||||
|         this.texture = texture; | ||||
|     } | ||||
|  | ||||
|     public GuiStorage(ContainerBase container, IGuiStorage gui) { | ||||
|         this(container, gui, "gui/storage.png"); | ||||
|     public GuiStorage(ContainerBase container, IGuiStorage gui, PlayerInventory inventory) { | ||||
|         this(container, gui, "gui/storage.png", inventory); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -48,7 +46,6 @@ public class GuiStorage extends GuiBase { | ||||
|         } | ||||
|  | ||||
|         if (gui.getCompareParameter() != null) { | ||||
|             addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_DAMAGE)); | ||||
|             addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_NBT)); | ||||
|         } | ||||
|  | ||||
| @@ -56,7 +53,7 @@ public class GuiStorage extends GuiBase { | ||||
|             addSideButton(new SideButtonAccessType(this, gui.getAccessTypeParameter())); | ||||
|         } | ||||
|  | ||||
|         int buttonWidth = 10 + fontRenderer.getStringWidth(t("misc.refinedstorage:priority")); | ||||
|         int buttonWidth = 10 + font.getStringWidth(t("misc.refinedstorage:priority")); | ||||
|  | ||||
|         priorityButton = addButton(x + 169 - buttonWidth, y + 41, buttonWidth, 20, t("misc.refinedstorage:priority")); | ||||
|     } | ||||
| @@ -104,6 +101,7 @@ public class GuiStorage extends GuiBase { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     protected void actionPerformed(GuiButton button) throws IOException { | ||||
|         super.actionPerformed(button); | ||||
| @@ -111,5 +109,5 @@ public class GuiStorage extends GuiBase { | ||||
|         if (button == priorityButton) { | ||||
|             FMLCommonHandler.instance().showGuiScreen(new GuiPriority(this, gui.getPriorityParameter())); | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -4,15 +4,15 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerStorageMonitor; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonCompare; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiStorageMonitor extends GuiBase { | ||||
|     public GuiStorageMonitor(ContainerStorageMonitor container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiStorageMonitor extends GuiBase<ContainerStorageMonitor> { | ||||
|     public GuiStorageMonitor(ContainerStorageMonitor container, PlayerInventory inventory) { | ||||
|         super(container, 211, 137, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void init(int x, int y) { | ||||
|         addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_DAMAGE)); | ||||
|         addSideButton(new SideButtonCompare(this, TileStorageMonitor.COMPARE, IComparer.COMPARE_NBT)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,10 +3,11 @@ package com.raoulvdberge.refinedstorage.gui; | ||||
| import com.raoulvdberge.refinedstorage.container.ContainerWirelessTransmitter; | ||||
| import com.raoulvdberge.refinedstorage.gui.control.SideButtonRedstoneMode; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
|  | ||||
| public class GuiWirelessTransmitter extends GuiBase { | ||||
|     public GuiWirelessTransmitter(ContainerWirelessTransmitter container) { | ||||
|         super(container, 211, 137); | ||||
| public class GuiWirelessTransmitter extends GuiBase<ContainerWirelessTransmitter> { | ||||
|     public GuiWirelessTransmitter(ContainerWirelessTransmitter container, PlayerInventory inventory) { | ||||
|         super(container, 211, 137, inventory, null); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -1,22 +1,20 @@ | ||||
| package com.raoulvdberge.refinedstorage.gui; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSBlocks; | ||||
| import com.raoulvdberge.refinedstorage.RSItems; | ||||
| import com.raoulvdberge.refinedstorage.RSKeyBindings; | ||||
| import com.raoulvdberge.refinedstorage.network.MessageNetworkItemOpen; | ||||
| import net.minecraft.client.Minecraft; | ||||
| import net.minecraft.entity.player.InventoryPlayer; | ||||
| import net.minecraft.entity.player.PlayerInventory; | ||||
| import net.minecraft.inventory.IInventory; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||||
| import net.minecraftforge.fml.common.gameevent.InputEvent; | ||||
| import net.minecraftforge.client.event.InputEvent; | ||||
| import net.minecraftforge.eventbus.api.SubscribeEvent; | ||||
|  | ||||
| public class KeyInputListener { | ||||
|     @SubscribeEvent | ||||
|     public void onKeyInput(InputEvent.KeyInputEvent e) { | ||||
|         InventoryPlayer inv = Minecraft.getMinecraft().player.inventory; | ||||
|         PlayerInventory inv = Minecraft.getInstance().player.inventory; | ||||
|  | ||||
|         if (RSKeyBindings.OPEN_WIRELESS_GRID.isKeyDown()) { | ||||
|             findAndOpen(inv, RSItems.WIRELESS_GRID); | ||||
| @@ -34,7 +32,7 @@ public class KeyInputListener { | ||||
|             ItemStack slot = inv.getStackInSlot(i); | ||||
|  | ||||
|             if (slot.getItem() == search) { | ||||
|                 RS.INSTANCE.network.sendToServer(new MessageNetworkItemOpen(i)); | ||||
|                 // TODO RS.INSTANCE.network.sendToServer(new MessageNetworkItemOpen(i)); | ||||
|  | ||||
|                 return; | ||||
|             } | ||||
|   | ||||
| @@ -161,10 +161,14 @@ public class TabList { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void mouseClicked() { | ||||
|     public boolean mouseClicked() { | ||||
|         if (tabHovering >= 0 && tabHovering < tabs.get().size()) { | ||||
|             listeners.forEach(t -> t.onSelectionChanged(tabHovering)); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     public void actionPerformed(GuiButton button) { | ||||
|   | ||||
| @@ -2,18 +2,15 @@ package com.raoulvdberge.refinedstorage.gui.control; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSKeyBindings; | ||||
| import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; | ||||
| import com.raoulvdberge.refinedstorage.integration.jei.IntegrationJEI; | ||||
| import com.raoulvdberge.refinedstorage.integration.jei.RSJEIPlugin; | ||||
| import net.minecraft.client.gui.FontRenderer; | ||||
| import net.minecraft.client.gui.GuiTextField; | ||||
| import net.minecraft.client.gui.widget.TextFieldWidget; | ||||
| import net.minecraftforge.fml.common.ObfuscationReflectionHelper; | ||||
| import org.lwjgl.input.Keyboard; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.LinkedList; | ||||
| import java.util.List; | ||||
|  | ||||
| public class TextFieldSearch extends GuiTextField { | ||||
| public class TextFieldSearch extends TextFieldWidget { | ||||
|     private static final List<String> HISTORY = new ArrayList<>(); | ||||
|  | ||||
|     private int mode; | ||||
| @@ -21,24 +18,25 @@ public class TextFieldSearch extends GuiTextField { | ||||
|  | ||||
|     private List<Runnable> listeners = new LinkedList<>(); | ||||
|  | ||||
|     public TextFieldSearch(int componentId, FontRenderer fontRenderer, int x, int y, int width) { | ||||
|         super(componentId, fontRenderer, x, y, width, fontRenderer.FONT_HEIGHT); | ||||
|     public TextFieldSearch(FontRenderer fontRenderer, int x, int y, int width) { | ||||
|         super(fontRenderer, x, y, width, fontRenderer.FONT_HEIGHT, ""); | ||||
|  | ||||
|         this.setEnableBackgroundDrawing(false); | ||||
|         this.setVisible(true); | ||||
|         this.setTextColor(16777215); | ||||
|  | ||||
|         this.listeners.add(() -> { | ||||
|         /* TODO this.listeners.add(() -> { | ||||
|             if (IntegrationJEI.isLoaded() && (mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) { | ||||
|                 RSJEIPlugin.INSTANCE.getRuntime().getIngredientFilter().setFilterText(getText()); | ||||
|             } | ||||
|         }); | ||||
|         });*/ | ||||
|     } | ||||
|  | ||||
|     public void addListener(Runnable listener) { | ||||
|         listeners.add(listener); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) { | ||||
|         boolean wasFocused = isFocused(); | ||||
|   | ||||
| @@ -18,6 +18,7 @@ public class TileNetworkTransmitter extends TileNode<NetworkNodeNetworkTransmitt | ||||
|  | ||||
|         return (transmitter.getReceiver() != null && transmitter.isSameDimension()) ? transmitter.getDistance() : -1; | ||||
|     }); | ||||
|     // TODO Use dim here instead? | ||||
|     public static final TileDataParameter<Integer, TileNetworkTransmitter> RECEIVER_DIMENSION = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getReceiverDimension()); | ||||
|  | ||||
|     public TileNetworkTransmitter() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 raoulvdberge
					raoulvdberge