Moving to source sets

This commit is contained in:
Sebastian Hartte
2020-07-01 23:36:51 +02:00
parent f2e3d81fd7
commit 2642ced86b
2924 changed files with 794 additions and 796 deletions
@@ -1,113 +0,0 @@
package appeng.client.gui.implementations;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.ChestContainer;
import appeng.container.implementations.CraftingTermContainer;
import appeng.container.implementations.MEMonitorableContainer;
import appeng.container.implementations.PatternTermContainer;
import appeng.container.implementations.WirelessTermContainer;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.SwitchGuisPacket;
import appeng.helpers.IPriorityHost;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.CraftingTerminalPart;
import appeng.parts.reporting.PatternTerminalPart;
import appeng.parts.reporting.TerminalPart;
import appeng.tile.storage.ChestBlockEntity;
/**
* Utility class for sub-screens of other containers that allow returning to the
* primary container UI.
*/
final class AESubScreen {
private final AEBaseScreen<?> gui;
private final ScreenHandlerType<?> previousContainerType;
private final ItemStack previousContainerIcon;
/**
* Based on the container we're opening for, try to determine what it's
* "primary" GUI would be so that we can go back to it.
*/
public AESubScreen(AEBaseScreen<?> gui, Object containerTarget) {
this.gui = gui;
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if (containerTarget instanceof ChestBlockEntity) {
// A chest is also a priority host, but the priority _interface_ can only be
// opened from the
// chest ui that doesn't actually show the contents of the inserted cell.
IPriorityHost priorityHost = (IPriorityHost) containerTarget;
this.previousContainerIcon = priorityHost.getItemStackRepresentation();
this.previousContainerType = ChestContainer.TYPE;
}
else if (containerTarget instanceof IPriorityHost) {
IPriorityHost priorityHost = (IPriorityHost) containerTarget;
this.previousContainerIcon = priorityHost.getItemStackRepresentation();
this.previousContainerType = priorityHost.getContainerType();
}
else if (containerTarget instanceof WirelessTerminalGuiObject) {
this.previousContainerIcon = definitions.items().wirelessTerminal().maybeStack(1).orElse(ItemStack.EMPTY);
this.previousContainerType = WirelessTermContainer.TYPE;
}
else if (containerTarget instanceof TerminalPart) {
this.previousContainerIcon = parts.terminal().maybeStack(1).orElse(ItemStack.EMPTY);
this.previousContainerType = MEMonitorableContainer.TYPE;
}
else if (containerTarget instanceof CraftingTerminalPart) {
this.previousContainerIcon = parts.craftingTerminal().maybeStack(1).orElse(ItemStack.EMPTY);
this.previousContainerType = CraftingTermContainer.TYPE;
}
else if (containerTarget instanceof PatternTerminalPart) {
this.previousContainerIcon = parts.patternTerminal().maybeStack(1).orElse(ItemStack.EMPTY);
this.previousContainerType = PatternTermContainer.TYPE;
}
else {
this.previousContainerIcon = null;
this.previousContainerType = null;
}
}
public final TabButton addBackButton(Consumer<TabButton> buttonAdder, int x, int y) {
return addBackButton(buttonAdder, x, y, null);
}
public final TabButton addBackButton(Consumer<TabButton> buttonAdder, int x, int y, @Nullable String label) {
if (this.previousContainerType != null && !previousContainerIcon.isEmpty()) {
if (label == null) {
label = previousContainerIcon.getName().getString();
}
ItemRenderer itemRenderer = gui.getMinecraft().getItemRenderer();
TabButton button = new TabButton(gui.getGuiLeft() + x, gui.getGuiTop() + y, previousContainerIcon, label,
itemRenderer, btn -> goBack());
buttonAdder.accept(button);
return button;
}
return null;
}
public final void goBack() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(this.previousContainerType));
}
}
@@ -1,157 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.ActionItems;
import appeng.api.config.CopyMode;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.client.gui.widgets.ActionButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.client.gui.widgets.ToggleButton;
import appeng.container.implementations.CellWorkbenchContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContainer> {
private ToggleButton copyMode;
public CellWorkbenchScreen(CellWorkbenchContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.ySize = 251;
}
@Override
protected void addButtons() {
this.fuzzyMode = this.addButton(new SettingToggleButton<>(this.guiLeft - 18, this.guiTop + 68,
Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::toggleFuzzyMode));
this.addButton(
new ActionButton(this.guiLeft - 18, this.guiTop + 28, ActionItems.WRENCH, act1 -> action("Partition")));
this.addButton(new ActionButton(this.guiLeft - 18, this.guiTop + 8, ActionItems.CLOSE, act -> action("Clear")));
this.copyMode = this.addButton(new ToggleButton(this.guiLeft - 18, this.guiTop + 48, 11 * 16 + 5, 12 * 16 + 5,
GuiText.CopyMode.getLocal(), GuiText.CopyModeDesc.getLocal(), act -> action("CopyMode")));
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, this.ySize, getBlitOffset());
if (this.drawUpgrades()) {
if (this.container.availableUpgrades() <= 8) {
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35,
7 + this.container.availableUpgrades() * 18, getBlitOffset());
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY + (7 + (this.container.availableUpgrades()) * 18),
177, 151, 35, 7, getBlitOffset());
} else if (this.container.availableUpgrades() <= 16) {
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18, getBlitOffset());
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7,
getBlitOffset());
final int dx = this.container.availableUpgrades() - 8;
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18,
getBlitOffset());
if (dx == 8) {
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7,
getBlitOffset());
} else {
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
35 - 8, 7, getBlitOffset());
}
} else {
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18, getBlitOffset());
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7,
getBlitOffset());
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18,
getBlitOffset());
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27, offsetY + (7 + (8) * 18), 186, 151, 35 - 8, 7,
getBlitOffset());
final int dx = this.container.availableUpgrades() - 16;
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18,
getBlitOffset());
if (dx == 8) {
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8,
7, getBlitOffset());
} else {
GuiUtils.drawTexturedModalRect(offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
35 - 8, 7, getBlitOffset());
}
}
}
if (this.hasToolbox()) {
GuiUtils.drawTexturedModalRect(offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68, getBlitOffset());
}
}
@Override
protected void handleButtonVisibility() {
this.copyMode.setState(this.container.getCopyMode() == CopyMode.CLEAR_ON_REMOVE);
boolean hasFuzzy = false;
final FixedItemInv inv = this.container.getCellUpgradeInventory();
for (int x = 0; x < inv.getSlotCount(); x++) {
final ItemStack is = inv.getInvStack(x);
if (!is.isEmpty() && is.getItem() instanceof IUpgradeModule) {
if (((IUpgradeModule) is.getItem()).getType(is) == Upgrades.FUZZY) {
hasFuzzy = true;
}
}
}
this.fuzzyMode.setVisibility(hasFuzzy);
}
@Override
protected String getBackground() {
return "guis/cellworkbench.png";
}
@Override
protected boolean drawUpgrades() {
return this.container.availableUpgrades() > 0;
}
@Override
protected GuiText getName() {
return GuiText.CellWorkbench;
}
private void action(String type) {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("CellWorkbench.Action", type));
}
private void toggleFuzzyMode(SettingToggleButton<FuzzyMode> button, boolean backwards) {
FuzzyMode fz = button.getNextValue(backwards);
NetworkHandler.instance().sendToServer(new ConfigValuePacket("CellWorkbench.Fuzzy", fz.name()));
}
}
@@ -1,63 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.ChestContainer;
import appeng.container.implementations.PriorityContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.SwitchGuisPacket;
public class ChestScreen extends AEBaseScreen<ChestContainer> {
public ChestScreen(ChestContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
public void init() {
super.init();
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriority()));
}
private void openPriority() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(PriorityContainer.TYPE));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Chest.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/chest.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,71 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.CondenserOutput;
import appeng.api.config.Settings;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.container.implementations.CondenserContainer;
import appeng.core.localization.GuiText;
public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
private SettingToggleButton<CondenserOutput> mode;
public CondenserScreen(CondenserContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 197;
}
@Override
public void init() {
super.init();
this.mode = new ServerSettingToggleButton<>(128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT,
this.container.getOutput());
this.addButton(new ProgressBar(this.container, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178,
25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.getLocal()));
this.addButton(this.mode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Condenser.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.mode.set(this.container.getOutput());
this.mode.setFillVar(String.valueOf(this.container.getOutput().requiredPower));
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/condenser.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,193 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.NumberBox;
import appeng.container.implementations.CraftAmountContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.CraftRequestPacket;
public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
private final AESubScreen subGui;
private NumberBox amountToCraft;
private Button next;
public CraftAmountScreen(CraftAmountContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.subGui = new AESubScreen(this, container.getTarget());
}
@Override
public void init() {
super.init();
final int a = AEConfig.instance().craftItemsByStackAmounts(0);
final int b = AEConfig.instance().craftItemsByStackAmounts(1);
final int c = AEConfig.instance().craftItemsByStackAmounts(2);
final int d = AEConfig.instance().craftItemsByStackAmounts(3);
this.addButton(new Button(this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a, btn -> addQty(a)));
this.addButton(new Button(this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b, btn -> addQty(b)));
this.addButton(new Button(this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c, btn -> addQty(c)));
this.addButton(new Button(this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d, btn -> addQty(d)));
this.addButton(new Button(this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a, btn -> addQty(-a)));
this.addButton(new Button(this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b, btn -> addQty(-b)));
this.addButton(new Button(this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c, btn -> addQty(-c)));
this.addButton(new Button(this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d, btn -> addQty(-d)));
this.next = this.addButton(
new Button(this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal(), this::confirm));
subGui.addBackButton(this::addButton, 154, 0);
this.amountToCraft = new NumberBox(this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT,
Integer.class);
this.amountToCraft.setEnableBackgroundDrawing(false);
this.amountToCraft.setMaxStringLength(16);
this.amountToCraft.setTextColor(0xFFFFFF);
this.amountToCraft.setVisible(true);
this.amountToCraft.setFocused2(true);
this.amountToCraft.setText("1");
}
private void confirm(Button button) {
NetworkHandler.instance()
.sendToServer(new CraftRequestPacket(Integer.parseInt(this.amountToCraft.getText()), hasShiftDown()));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.next.setMessage(hasShiftDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal());
this.bindTexture("guis/craft_amt.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
try {
Long.parseLong(this.amountToCraft.getText());
this.next.active = !this.amountToCraft.getText().isEmpty();
} catch (final NumberFormatException e) {
this.next.active = false;
}
this.amountToCraft.render(offsetX, offsetY, partialTicks);
}
@Override
public boolean charTyped(char ch, int p_charTyped_2_) {
// Forward entered text to the craft amount text-field
return this.amountToCraft.charTyped(ch, p_charTyped_2_);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
if (!this.checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode))) {
if (keyCode == 28) {
this.next.onPress();
}
if ((keyCode == 211 || keyCode == 205 || keyCode == 203 || keyCode == 14)
&& this.amountToCraft.keyPressed(keyCode, scanCode, p_keyPressed_3_)) {
try {
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.amountToCraft.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
final long result = Long.parseLong(out);
if (result < 0) {
this.amountToCraft.setText("1");
}
} catch (final NumberFormatException e) {
// :P
}
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
private void addQty(final int i) {
try {
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.amountToCraft.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
long result = Integer.parseInt(out);
if (result == 1 && i > 1) {
result = 0;
}
result += i;
if (result < 1) {
result = 1;
}
out = Long.toString(result);
Integer.parseInt(out);
this.amountToCraft.setText(out);
} catch (final NumberFormatException e) {
// :P
}
}
protected String getBackground() {
return "guis/craftAmt.png";
}
}
@@ -1,460 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.Scrollbar;
import appeng.container.implementations.CraftConfirmContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.util.Platform;
public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
private final AESubScreen subGui;
private final int rows = 5;
private final IItemList<IAEItemStack> storage = AEApi.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
private final IItemList<IAEItemStack> pending = AEApi.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createList();
private final List<IAEItemStack> visual = new ArrayList<>();
private Button start;
private Button selectCPU;
private int tooltip = -1;
public CraftConfirmScreen(CraftConfirmContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.subGui = new AESubScreen(this, container.getTarget());
this.xSize = 238;
this.ySize = 206;
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
}
boolean isAutoStart() {
return this.container.isAutoStart();
}
@Override
public void init() {
super.init();
this.start = new Button(this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal(),
btn -> start());
this.start.active = false;
this.addButton(this.start);
this.selectCPU = new Button(this.guiLeft + (219 - 180) / 2, this.guiTop + this.ySize - 68, 180, 20,
GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic, btn -> selectNextCpu());
this.selectCPU.active = false;
this.addButton(this.selectCPU);
addButton(new Button(this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal(),
btn -> subGui.goBack()));
}
@Override
public void render(final int mouseX, final int mouseY, final float btn) {
this.updateCPUButtonText();
this.start.active = !(this.container.hasNoCPU() || this.isSimulation());
this.selectCPU.active = !this.isSimulation();
final int gx = (this.width - this.xSize) / 2;
final int gy = (this.height - this.ySize) / 2;
this.tooltip = -1;
final int offY = 23;
int y = 0;
int x = 0;
for (int z = 0; z <= 4 * 5; z++) {
final int minX = gx + 9 + x * 67;
final int minY = gy + 22 + y * offY;
if (minX < mouseX && minX + 67 > mouseX) {
if (minY < mouseY && minY + offY - 2 > mouseY) {
this.tooltip = z;
break;
}
}
x++;
if (x > 2) {
y++;
x = 0;
}
}
super.render(mouseX, mouseY, btn);
}
private void updateCPUButtonText() {
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if (this.container.getSelectedCpu() >= 0)// && status.selectedCpu < status.cpus.size() )
{
if (this.container.getName() != null) {
final String name = this.container.getName().getStringTruncated(20);
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
} else {
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.container.getSelectedCpu();
}
}
if (this.container.hasNoCPU()) {
btnTextText = GuiText.NoCraftingCPUs.getLocal();
}
this.selectCPU.setMessage(btnTextText);
}
private boolean isSimulation() {
return this.container.isSimulation();
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
final long BytesUsed = this.container.getUsedBytes();
final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
final String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal())
: GuiText.CalculatingWait.getLocal();
this.font.drawString(GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);
String dsp = null;
if (this.isSimulation()) {
dsp = GuiText.Simulation.getLocal();
} else {
dsp = this.container.getCpuAvailableBytes() > 0
? (GuiText.Bytes.getLocal() + ": " + this.container.getCpuAvailableBytes() + " : "
+ GuiText.CoProcessors.getLocal() + ": " + this.container.getCpuCoProcessors())
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
}
final int offset = (219 - this.font.getStringWidth(dsp)) / 2;
this.font.drawString(dsp, offset, 165, 4210752);
final int sectionLength = 67;
int x = 0;
int y = 0;
final int xo = 9;
final int yo = 22;
final int viewStart = this.getScrollBar().getCurrentScroll() * 3;
final int viewEnd = viewStart + 3 * this.rows;
String dspToolTip = "";
final List<String> lineList = new ArrayList<>();
int toolPosX = 0;
int toolPosY = 0;
final int offY = 23;
for (int z = viewStart; z < Math.min(viewEnd, this.visual.size()); z++) {
final IAEItemStack refStack = this.visual.get(z);// repo.getReferenceItem( z );
if (refStack != null) {
RenderSystem.pushMatrix();
RenderSystem.scalef(0.5f, 0.5f, 0.5f);
final IAEItemStack stored = this.storage.findPrecise(refStack);
final IAEItemStack pendingStack = this.pending.findPrecise(refStack);
final IAEItemStack missingStack = this.missing.findPrecise(refStack);
int lines = 0;
if (stored != null && stored.getStackSize() > 0) {
lines++;
}
if (missingStack != null && missingStack.getStackSize() > 0) {
lines++;
}
if (pendingStack != null && pendingStack.getStackSize() > 0) {
lines++;
}
final int negY = ((lines - 1) * 5) / 2;
int downY = 0;
if (stored != null && stored.getStackSize() > 0) {
String str = Long.toString(stored.getStackSize());
if (stored.getStackSize() >= 10000) {
str = Long.toString(stored.getStackSize() / 1000) + 'k';
}
if (stored.getStackSize() >= 10000000) {
str = Long.toString(stored.getStackSize() / 1000000) + 'm';
}
str = GuiText.FromStorage.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.FromStorage.getLocal() + ": " + Long.toString(stored.getStackSize()));
}
downY += 5;
}
boolean red = false;
if (missingStack != null && missingStack.getStackSize() > 0) {
String str = Long.toString(missingStack.getStackSize());
if (missingStack.getStackSize() >= 10000) {
str = Long.toString(missingStack.getStackSize() / 1000) + 'k';
}
if (missingStack.getStackSize() >= 10000000) {
str = Long.toString(missingStack.getStackSize() / 1000000) + 'm';
}
str = GuiText.Missing.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.Missing.getLocal() + ": " + Long.toString(missingStack.getStackSize()));
}
red = true;
downY += 5;
}
if (pendingStack != null && pendingStack.getStackSize() > 0) {
String str = Long.toString(pendingStack.getStackSize());
if (pendingStack.getStackSize() >= 10000) {
str = Long.toString(pendingStack.getStackSize() / 1000) + 'k';
}
if (pendingStack.getStackSize() >= 10000000) {
str = Long.toString(pendingStack.getStackSize() / 1000000) + 'm';
}
str = GuiText.ToCraft.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.ToCraft.getLocal() + ": " + Long.toString(pendingStack.getStackSize()));
}
}
RenderSystem.popMatrix();
final int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
final int posY = y * offY + yo;
final ItemStack is = refStack.asItemStackRepresentation();
if (this.tooltip == z - viewStart) {
dspToolTip = Platform.getItemDisplayName(refStack).getFormattedText();
if (lineList.size() > 0) {
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
}
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
}
this.drawItem(posX, posY, is);
if (red) {
final int startX = x * (1 + sectionLength) + xo;
final int startY = posY - 4;
fill(startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000);
}
x++;
if (x > 2) {
y++;
x = 0;
}
}
}
if (this.tooltip >= 0 && !dspToolTip.isEmpty()) {
this.drawTooltip(toolPosX, toolPosY + 10, dspToolTip);
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.setScrollBar();
this.bindTexture("guis/craftingreport.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
private void setScrollBar() {
final int size = this.visual.size();
this.getScrollBar().setTop(19).setLeft(218).setHeight(114);
this.getScrollBar().setRange(0, (size + 2) / 3 - this.rows, 1);
}
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
switch (ref) {
case 0:
for (final IAEItemStack l : list) {
this.handleInput(this.storage, l);
}
break;
case 1:
for (final IAEItemStack l : list) {
this.handleInput(this.pending, l);
}
break;
case 2:
for (final IAEItemStack l : list) {
this.handleInput(this.missing, l);
}
break;
}
for (final IAEItemStack l : list) {
final long amt = this.getTotal(l);
if (amt <= 0) {
this.deleteVisualStack(l);
} else {
final IAEItemStack is = this.findVisualStack(l);
is.setStackSize(amt);
}
}
this.setScrollBar();
}
private void handleInput(final IItemList<IAEItemStack> s, final IAEItemStack l) {
IAEItemStack a = s.findPrecise(l);
if (l.getStackSize() <= 0) {
if (a != null) {
a.reset();
}
} else {
if (a == null) {
s.add(l.copy());
a = s.findPrecise(l);
}
if (a != null) {
a.setStackSize(l.getStackSize());
}
}
}
private long getTotal(final IAEItemStack is) {
final IAEItemStack a = this.storage.findPrecise(is);
final IAEItemStack c = this.pending.findPrecise(is);
final IAEItemStack m = this.missing.findPrecise(is);
long total = 0;
if (a != null) {
total += a.getStackSize();
}
if (c != null) {
total += c.getStackSize();
}
if (m != null) {
total += m.getStackSize();
}
return total;
}
private void deleteVisualStack(final IAEItemStack l) {
final Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext()) {
final IAEItemStack o = i.next();
if (o.equals(l)) {
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack(final IAEItemStack l) {
for (final IAEItemStack o : this.visual) {
if (o.equals(l)) {
return o;
}
}
final IAEItemStack stack = l.copy();
this.visual.add(stack);
return stack;
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
if (!this.checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode))) {
if (keyCode == 28) {
this.start();
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
private void selectNextCpu() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer(new ConfigValuePacket("Terminal.Cpu", backwards ? "Prev" : "Next"));
}
private void start() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("Terminal.Start", "Start"));
}
}
@@ -1,429 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.systems.RenderSystem;
import org.apache.commons.lang3.time.DurationFormatUtils;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.AEApi;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.Scrollbar;
import appeng.container.implementations.CraftingCPUContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScreen<T> implements ISortSource {
private static final int GUI_HEIGHT = 184;
private static final int GUI_WIDTH = 238;
private static final int DISPLAYED_ROWS = 6;
private static final int TEXT_COLOR = 0x404040;
private static final int BACKGROUND_ALPHA = 0x5A000000;
private static final int SECTION_LENGTH = 67;
private static final int SCROLLBAR_TOP = 19;
private static final int SCROLLBAR_LEFT = 218;
private static final int SCROLLBAR_HEIGHT = 137;
private static final int CANCEL_LEFT_OFFSET = 163;
private static final int CANCEL_TOP_OFFSET = 25;
private static final int CANCEL_HEIGHT = 20;
private static final int CANCEL_WIDTH = 50;
private static final int TITLE_TOP_OFFSET = 7;
private static final int TITLE_LEFT_OFFSET = 8;
private static final int ITEMSTACK_LEFT_OFFSET = 9;
private static final int ITEMSTACK_TOP_OFFSET = 22;
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private List<IAEItemStack> visual = new ArrayList<>();
private Button cancel;
private int tooltip = -1;
public CraftingCPUScreen(T container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = GUI_HEIGHT;
this.xSize = GUI_WIDTH;
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
}
public void clearItems() {
this.storage = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.active = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.pending = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
this.visual = new ArrayList<>();
}
private void cancel() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("TileCrafting.Cancel", "Cancel"));
}
@Override
public void init() {
super.init();
this.setScrollBar();
this.cancel = new Button(this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET,
CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel.getLocal(), btn -> cancel());
this.addButton(this.cancel);
}
private void setScrollBar() {
final int size = this.visual.size();
this.getScrollBar().setTop(SCROLLBAR_TOP).setLeft(SCROLLBAR_LEFT).setHeight(SCROLLBAR_HEIGHT);
this.getScrollBar().setRange(0, (size + 2) / 3 - DISPLAYED_ROWS, 1);
}
@Override
public void render(final int mouseX, final int mouseY, final float btn) {
this.cancel.active = !this.visual.isEmpty();
final int gx = (this.width - this.xSize) / 2;
final int gy = (this.height - this.ySize) / 2;
this.tooltip = -1;
final int offY = 23;
int y = 0;
int x = 0;
for (int z = 0; z <= 4 * 5; z++) {
final int minX = gx + 9 + x * 67;
final int minY = gy + 22 + y * offY;
if (minX < mouseX && minX + 67 > mouseX) {
if (minY < mouseY && minY + offY - 2 > mouseY) {
this.tooltip = z;
break;
}
}
x++;
if (x > 2) {
y++;
x = 0;
}
}
super.render(mouseX, mouseY, btn);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
String title = this.getGuiDisplayName(GuiText.CraftingStatus.getLocal());
if (this.container.getEstimatedTime() > 0 && !this.visual.isEmpty()) {
final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert(this.container.getEstimatedTime(),
TimeUnit.NANOSECONDS);
final String etaTimeText = DurationFormatUtils.formatDuration(etaInMilliseconds,
GuiText.ETAFormat.getLocal());
title += " - " + etaTimeText;
}
this.font.drawString(title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR);
int x = 0;
int y = 0;
final int viewStart = this.getScrollBar().getCurrentScroll() * 3;
final int viewEnd = viewStart + 3 * 6;
String dspToolTip = "";
final List<String> lineList = new ArrayList<>();
int toolPosX = 0;
int toolPosY = 0;
final int offY = 23;
final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
for (int z = viewStart; z < Math.min(viewEnd, this.visual.size()); z++) {
final IAEItemStack refStack = this.visual.get(z);// repo.getReferenceItem( z );
if (refStack != null) {
RenderSystem.pushMatrix();
RenderSystem.scalef(0.5f, 0.5f, 0.5f);
final IAEItemStack stored = this.storage.findPrecise(refStack);
final IAEItemStack activeStack = this.active.findPrecise(refStack);
final IAEItemStack pendingStack = this.pending.findPrecise(refStack);
int lines = 0;
if (stored != null && stored.getStackSize() > 0) {
lines++;
}
boolean active = false;
if (activeStack != null && activeStack.getStackSize() > 0) {
lines++;
active = true;
}
boolean scheduled = false;
if (pendingStack != null && pendingStack.getStackSize() > 0) {
lines++;
scheduled = true;
}
if (AEConfig.instance().isUseColoredCraftingStatus() && (active || scheduled)) {
final int bgColor = (active ? AEColor.GREEN.blackVariant : AEColor.YELLOW.blackVariant)
| BACKGROUND_ALPHA;
final int startX = (x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET) * 2;
final int startY = ((y * offY + ITEMSTACK_TOP_OFFSET) - 3) * 2;
fill(startX, startY, startX + (SECTION_LENGTH * 2), startY + (offY * 2) - 2, bgColor);
}
final int negY = ((lines - 1) * 5) / 2;
int downY = 0;
if (stored != null && stored.getStackSize() > 0) {
final String str = GuiText.Stored.getLocal() + ": "
+ converter.toWideReadableForm(stored.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.Stored.getLocal() + ": " + Long.toString(stored.getStackSize()));
}
downY += 5;
}
if (activeStack != null && activeStack.getStackSize() > 0) {
final String str = GuiText.Crafting.getLocal() + ": "
+ converter.toWideReadableForm(activeStack.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.Crafting.getLocal() + ": " + Long.toString(activeStack.getStackSize()));
}
downY += 5;
}
if (pendingStack != null && pendingStack.getStackSize() > 0) {
final String str = GuiText.Scheduled.getLocal() + ": "
+ converter.toWideReadableForm(pendingStack.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
if (this.tooltip == z - viewStart) {
lineList.add(GuiText.Scheduled.getLocal() + ": " + Long.toString(pendingStack.getStackSize()));
}
}
RenderSystem.popMatrix();
final int posX = x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
final ItemStack is = refStack.asItemStackRepresentation();
if (this.tooltip == z - viewStart) {
dspToolTip = Platform.getItemDisplayName(refStack).getFormattedText();
if (lineList.size() > 0) {
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
}
toolPosX = x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 8;
toolPosY = y * offY + ITEMSTACK_TOP_OFFSET;
}
this.drawItem(posX, posY, is);
x++;
if (x > 2) {
y++;
x = 0;
}
}
}
if (this.tooltip >= 0 && !dspToolTip.isEmpty()) {
this.drawTooltip(toolPosX, toolPosY + 10, dspToolTip);
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/craftingcpu.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
switch (ref) {
case 0:
for (final IAEItemStack l : list) {
this.handleInput(this.storage, l);
}
break;
case 1:
for (final IAEItemStack l : list) {
this.handleInput(this.active, l);
}
break;
case 2:
for (final IAEItemStack l : list) {
this.handleInput(this.pending, l);
}
break;
}
for (final IAEItemStack l : list) {
final long amt = this.getTotal(l);
if (amt <= 0) {
this.deleteVisualStack(l);
} else {
final IAEItemStack is = this.findVisualStack(l);
is.setStackSize(amt);
}
}
this.setScrollBar();
}
private void handleInput(final IItemList<IAEItemStack> s, final IAEItemStack l) {
IAEItemStack a = s.findPrecise(l);
if (l.getStackSize() <= 0) {
if (a != null) {
a.reset();
}
} else {
if (a == null) {
s.add(l.copy());
a = s.findPrecise(l);
}
if (a != null) {
a.setStackSize(l.getStackSize());
}
}
}
private long getTotal(final IAEItemStack is) {
final IAEItemStack a = this.storage.findPrecise(is);
final IAEItemStack b = this.active.findPrecise(is);
final IAEItemStack c = this.pending.findPrecise(is);
long total = 0;
if (a != null) {
total += a.getStackSize();
}
if (b != null) {
total += b.getStackSize();
}
if (c != null) {
total += c.getStackSize();
}
return total;
}
private void deleteVisualStack(final IAEItemStack l) {
final Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext()) {
final IAEItemStack o = i.next();
if (o.equals(l)) {
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack(final IAEItemStack l) {
for (final IAEItemStack o : this.visual) {
if (o.equals(l)) {
return o;
}
}
final IAEItemStack stack = l.copy();
this.visual.add(stack);
return stack;
}
@Override
public SortOrder getSortBy() {
return SortOrder.NAME;
}
@Override
public SortDir getSortDir() {
return SortDir.ASCENDING;
}
@Override
public ViewItems getSortDisplay() {
return ViewItems.ALL;
}
}
@@ -1,97 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
/**
*
*/
package appeng.client.gui.implementations;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.container.implementations.CraftingStatusContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContainer> {
private final AESubScreen subGui;
private Button selectCPU;
public CraftingStatusScreen(CraftingStatusContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.subGui = new AESubScreen(this, container.getTarget());
}
@Override
public void init() {
super.init();
this.selectCPU = new Button(this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20,
GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs, btn -> selectNextCpu());
this.addButton(this.selectCPU);
subGui.addBackButton(btn -> {
addButton(btn);
btn.setHideEdge(13);
}, 213, -4);
}
@Override
public void render(final int mouseX, final int mouseY, final float btn) {
this.updateCPUButtonText();
super.render(mouseX, mouseY, btn);
}
private void updateCPUButtonText() {
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if (this.container.selectedCpu >= 0)// && status.selectedCpu < status.cpus.size() )
{
if (this.container.myName != null) {
final String name = this.container.myName.getStringTruncated(20);
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
} else {
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.container.selectedCpu;
}
}
if (this.container.noCPU) {
btnTextText = GuiText.NoCraftingJobs.getLocal();
}
this.selectCPU.setMessage(btnTextText);
}
@Override
protected String getGuiDisplayName(final String in) {
return in; // the cup name is on the button
}
// FIXME: Extract to separate class? Shared with GuiCraftConfirm
private void selectNextCpu() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer(new ConfigValuePacket("Terminal.Cpu", backwards ? "Prev" : "Next"));
}
}
@@ -1,74 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.text.Text;
import appeng.api.config.ActionItems;
import appeng.client.gui.widgets.ActionButton;
import appeng.container.implementations.CraftingTermContainer;
import appeng.container.slot.CraftingMatrixSlot;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.InventoryActionPacket;
import appeng.helpers.InventoryAction;
public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContainer> {
public CraftingTermScreen(CraftingTermContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.setReservedSpace(73);
}
private void clear() {
Slot s = null;
for (final Object j : this.container.inventorySlots) {
if (j instanceof CraftingMatrixSlot) {
s = (Slot) j;
}
}
if (s != null) {
final InventoryActionPacket p = new InventoryActionPacket(InventoryAction.MOVE_REGION, s.slotNumber, 0);
NetworkHandler.instance().sendToServer(p);
}
}
@Override
public void init() {
super.init();
ActionButton clearBtn = this.addButton(
new ActionButton(this.guiLeft + 92, this.guiTop + this.ySize - 156, ActionItems.STASH, btn -> clear()));
clearBtn.setHalfSize(true);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(),
4210752);
}
@Override
protected String getBackground() {
return "guis/crafting.png";
}
}
@@ -1,63 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.DriveContainer;
import appeng.container.implementations.PriorityContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.SwitchGuisPacket;
public class DriveScreen extends AEBaseScreen<DriveContainer> {
public DriveScreen(DriveContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 199;
}
@Override
public void init() {
super.init();
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(PriorityContainer.TYPE));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Drive.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/drive.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,83 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.FormationPlaneContainer;
import appeng.container.implementations.PriorityContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.SwitchGuisPacket;
public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContainer> {
private SettingToggleButton<YesNo> placeMode;
public FormationPlaneScreen(FormationPlaneContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.ySize = 251;
}
@Override
protected void addButtons() {
this.placeMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK,
YesNo.YES);
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(this.placeMode);
this.addButton(this.fuzzyMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.FormationPlane.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
}
if (this.placeMode != null) {
this.placeMode.set(((FormationPlaneContainer) this.cvb).getPlaceMode());
}
}
@Override
protected String getBackground() {
return "guis/storagebus.png";
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(PriorityContainer.TYPE));
}
}
@@ -1,47 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.GrinderContainer;
import appeng.core.localization.GuiText;
public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
public GrinderScreen(GrinderContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 176;
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.GrindStone.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/grinder.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,95 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.AEApi;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.api.definitions.IDefinitions;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.container.implementations.IOPortContainer;
import appeng.core.localization.GuiText;
public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
private SettingToggleButton<FullnessMode> fullMode;
private SettingToggleButton<OperationMode> operationMode;
public IOPortScreen(IOPortContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
protected void addButtons() {
this.fullMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8, Settings.FULLNESS_MODE,
FullnessMode.EMPTY);
this.operationMode = new ServerSettingToggleButton<>(this.guiLeft + 80, this.guiTop + 17,
Settings.OPERATION_MODE, OperationMode.EMPTY);
this.addButton(this.operationMode);
this.addButton(this.fullMode);
this.redstoneMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 28,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
addButton(this.redstoneMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.IOPort.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
}
if (this.operationMode != null) {
this.operationMode.set(((IOPortContainer) this.cvb).getOperationMode());
}
if (this.fullMode != null) {
this.fullMode.set(((IOPortContainer) this.cvb).getFullMode());
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
final IDefinitions definitions = AEApi.instance().definitions();
definitions.items().cell1k().maybeStack(1)
.ifPresent(cell1kStack -> this.drawItem(offsetX + 66 - 8, offsetY + 17, cell1kStack));
definitions.blocks().drive().maybeStack(1)
.ifPresent(driveStack -> this.drawItem(offsetX + 94 + 8, offsetY + 17, driveStack));
}
@Override
protected String getBackground() {
return "guis/io_port.png";
}
}
@@ -1,82 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
import appeng.container.implementations.InscriberContainer;
import appeng.core.localization.GuiText;
public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
private ProgressBar pb;
public InscriberScreen(InscriberContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 176;
this.xSize = this.hasToolbox() ? 246 : 211;
}
private boolean hasToolbox() {
return this.container.hasToolbox();
}
@Override
public void init() {
super.init();
this.pb = new ProgressBar(this.container, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL);
this.addButton(this.pb);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.pb.setFullMsg(this.container.getCurrentProgress() * 100 / this.container.getMaxProgress() + "%");
this.font.drawString(this.getGuiDisplayName(GuiText.Inscriber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/inscriber.png");
this.pb.x = 135 + this.guiLeft;
this.pb.y = 39 + this.guiTop;
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, this.ySize, getBlitOffset());
if (this.drawUpgrades()) {
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35,
14 + this.container.availableUpgrades() * 18, getBlitOffset());
}
if (this.hasToolbox()) {
GuiUtils.drawTexturedModalRect(offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68,
getBlitOffset());
}
}
private boolean drawUpgrades() {
return true;
}
}
@@ -1,94 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.client.gui.widgets.TabButton;
import appeng.client.gui.widgets.ToggleButton;
import appeng.container.implementations.InterfaceContainer;
import appeng.container.implementations.PriorityContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigButtonPacket;
import appeng.core.sync.packets.SwitchGuisPacket;
public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
private SettingToggleButton<YesNo> blockMode;
private ToggleButton interfaceMode;
public InterfaceScreen(InterfaceContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 211;
}
@Override
protected void addButtons() {
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.blockMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
this.addButton(this.blockMode);
this.interfaceMode = new ToggleButton(this.guiLeft - 18, this.guiTop + 26, 84, 85,
GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal(),
btn -> selectNextInterfaceMode());
this.addButton(this.interfaceMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.blockMode != null) {
this.blockMode.set(((InterfaceContainer) this.cvb).getBlockingMode());
}
if (this.interfaceMode != null) {
this.interfaceMode.setState(((InterfaceContainer) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
this.font.drawString(this.getGuiDisplayName(GuiText.Interface.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752);
this.font.drawString(GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752);
this.font.drawString(GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
protected String getBackground() {
return "guis/interface.png";
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(PriorityContainer.TYPE));
}
private void selectNextInterfaceMode() {
final boolean backwards = getMinecraft().mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer(new ConfigButtonPacket(Settings.INTERFACE_TERMINAL, backwards));
}
}
@@ -1,381 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import com.google.common.collect.HashMultimap;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.ActionKey;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.AETextField;
import appeng.client.gui.widgets.Scrollbar;
import appeng.client.me.ClientDCInternalInv;
import appeng.client.me.SlotDisconnected;
import appeng.container.implementations.InterfaceTerminalContainer;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalContainer> {
private static final int LINES_ON_PAGE = 6;
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<Object> lines = new ArrayList<>();
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
private boolean refreshList = false;
private AETextField searchField;
public InterfaceTerminalScreen(InterfaceTerminalContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
this.xSize = 195;
this.ySize = 222;
}
@Override
public void init() {
super.init();
this.getScrollBar().setLeft(175);
this.getScrollBar().setHeight(106);
this.getScrollBar().setTop(18);
this.searchField = new AETextField(this.font, this.guiLeft + 104, this.guiTop + 4, 65, 12);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setMaxStringLength(25);
this.searchField.setTextColor(0xFFFFFF);
this.searchField.setVisible(true);
this.searchField.setFocused2(true);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll();
this.container.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
int offset = 17;
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSlotCount(); z++) {
this.container.inventorySlots.add(new SlotDisconnected(inv, z, z * 18 + 8, 1 + offset));
}
} else if (lineObj instanceof String) {
String name = (String) lineObj;
final int rows = this.byName.get(name).size();
if (rows > 1) {
name = name + " (" + rows + ')';
}
while (name.length() > 2 && this.font.getStringWidth(name) > 155) {
name = name.substring(0, name.length() - 1);
}
this.font.drawString(name, 10, 6 + offset, 4210752);
}
offset += 18;
}
}
@Override
public boolean mouseClicked(final double xCoord, final double yCoord, final int btn) {
if (this.searchField.mouseClicked(xCoord, yCoord, btn)) {
if (btn == 1 && this.searchField.isMouseOver(xCoord, yCoord)) {
this.searchField.setText("");
this.refreshList();
}
return true;
}
return super.mouseClicked(xCoord, yCoord, btn);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/interfaceterminal.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
int offset = 17;
final int ex = this.getScrollBar().getCurrentScroll();
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
RenderSystem.color4f(1, 1, 1, 1);
final int width = inv.getInventory().getSlotCount() * 18;
GuiUtils.drawTexturedModalRect(offsetX + 7, offsetY + offset, 7, 139, width, 18, getBlitOffset());
}
offset += 18;
}
if (this.searchField != null) {
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
@Override
public boolean charTyped(char character, int key) {
if (character == ' ' && this.searchField.getText().isEmpty()) {
return true;
}
if (this.searchField.charTyped(character, key)) {
this.refreshList();
return true;
}
return false;
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
InputUtil.Key input = InputMappings.getInputByCode(keyCode, scanCode);
if (keyCode != GLFW.GLFW_KEY_ESCAPE) {
if (AppEng.instance().isActionKey(ActionKey.TOGGLE_FOCUS, input)) {
this.searchField.setFocused2(!this.searchField.isFocused());
return true;
}
// Forward keypresses to the search field
if (this.searchField.isFocused()) {
if (keyCode == GLFW.GLFW_KEY_ENTER) {
this.searchField.setFocused2(false);
return true;
}
this.searchField.keyPressed(keyCode, scanCode, p_keyPressed_3_);
// We need to swallow key presses if the field is focused because typing 'e'
// would otherwise close the screen
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
public void postUpdate(final CompoundTag in) {
if (in.getBoolean("clear")) {
this.byId.clear();
this.refreshList = true;
}
for (final Object oKey : in.getKeys()) {
final String key = (String) oKey;
if (key.startsWith("=")) {
try {
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
final CompoundTag invData = in.getCompound(key);
Text un = Text.Serializer.fromJson(invData.getString("un"));
final ClientDCInternalInv current = this.getById(id, invData.getLong("sortBy"), un);
for (int x = 0; x < current.getInventory().getSlotCount(); x++) {
final String which = Integer.toString(x);
if (invData.contains(which)) {
current.getInventory().setInvStack(x, ItemStack.fromTag(invData.getCompound(which)));
}
}
} catch (final NumberFormatException ignored) {
}
}
}
if (this.refreshList) {
this.refreshList = false;
// invalid caches on refresh
this.cachedSearches.clear();
this.refreshList();
}
}
/**
* Rebuilds the list of interfaces.
*
* Respects a search term if present (ignores case) and adding only matching
* patterns.
*/
private void refreshList() {
this.byName.clear();
final String searchFilterLowerCase = this.searchField.getText().toLowerCase();
final Set<Object> cachedSearch = this.getCacheForSearchTerm(searchFilterLowerCase);
final boolean rebuild = cachedSearch.isEmpty();
for (final ClientDCInternalInv entry : this.byId.values()) {
// ignore inventory if not doing a full rebuild or cache already marks it as
// miss.
if (!rebuild && !cachedSearch.contains(entry)) {
continue;
}
// Shortcut to skip any filter if search term is ""/empty
boolean found = searchFilterLowerCase.isEmpty();
// Search if the current inventory holds a pattern containing the search term.
if (!found && !searchFilterLowerCase.isEmpty()) {
for (final ItemStack itemStack : entry.getInventory()) {
found = this.itemStackMatchesSearchTerm(itemStack, searchFilterLowerCase);
if (found) {
break;
}
}
}
// if found, filter skipped or machine name matching the search term, add it
if (found || entry.getSearchName().contains(searchFilterLowerCase)) {
this.byName.put(entry.getFormattedName(), entry);
cachedSearch.add(entry);
} else {
cachedSearch.remove(entry);
}
}
this.names.clear();
this.names.addAll(this.byName.keySet());
Collections.sort(this.names);
this.lines.clear();
this.lines.ensureCapacity(this.getMaxRows());
for (final String n : this.names) {
this.lines.add(n);
List<ClientDCInternalInv> clientInventories = new ArrayList<>(this.byName.get(n));
Collections.sort(clientInventories);
this.lines.addAll(clientInventories);
}
this.getScrollBar().setRange(0, this.lines.size() - LINES_ON_PAGE, 2);
}
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm) {
if (itemStack.isEmpty()) {
return false;
}
final CompoundTag encodedValue = itemStack.getTag();
if (encodedValue == null) {
return false;
}
// Potential later use to filter by input
// ListNBT inTag = encodedValue.getTagList( "in", 10 );
final ListTag outTag = encodedValue.getList("out", 10);
for (int i = 0; i < outTag.size(); i++) {
final ItemStack parsedItemStack = ItemStack.fromTag(outTag.getCompound(i));
if (!parsedItemStack.isEmpty()) {
final String displayName = Platform.getItemDisplayName(AEApi.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack)).getString()
.toLowerCase();
if (displayName.contains(searchTerm)) {
return true;
}
}
}
return false;
}
/**
* Tries to retrieve a cache for a with search term as keyword.
*
* If this cache should be empty, it will populate it with an earlier cache if
* available or at least the cache for the empty string.
*
* @param searchTerm the corresponding search
*
* @return a Set matching a superset of the search term
*/
private Set<Object> getCacheForSearchTerm(final String searchTerm) {
if (!this.cachedSearches.containsKey(searchTerm)) {
this.cachedSearches.put(searchTerm, new HashSet<>());
}
final Set<Object> cache = this.cachedSearches.get(searchTerm);
if (cache.isEmpty() && searchTerm.length() > 1) {
cache.addAll(this.getCacheForSearchTerm(searchTerm.substring(0, searchTerm.length() - 1)));
return cache;
}
return cache;
}
/**
* The max amount of unique names and each inv row. Not affected by the
* filtering.
*
* @return max amount of unique names and each inv row
*/
private int getMaxRows() {
return this.names.size() + this.byId.size();
}
private ClientDCInternalInv getById(final long id, final long sortBy, final Text name) {
ClientDCInternalInv o = this.byId.get(id);
if (o == null) {
this.byId.put(id, o = new ClientDCInternalInv(9, id, sortBy, name));
this.refreshList = true;
}
return o;
}
}
@@ -1,229 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.FuzzyMode;
import appeng.api.config.LevelType;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.NumberBox;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.container.implementations.LevelEmitterContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer> {
private NumberBox level;
private Button plus1;
private Button plus10;
private Button plus100;
private Button plus1000;
private Button minus1;
private Button minus10;
private Button minus100;
private Button minus1000;
private SettingToggleButton<LevelType> levelMode;
private SettingToggleButton<YesNo> craftingMode;
public LevelEmitterScreen(LevelEmitterContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
}
@Override
public void init() {
super.init();
this.level = new NumberBox(this.font, this.guiLeft + 24, this.guiTop + 43, 79, this.font.FONT_HEIGHT,
Long.class);
this.level.setEnableBackgroundDrawing(false);
this.level.setMaxStringLength(16);
this.level.setTextColor(0xFFFFFF);
this.level.setVisible(true);
this.level.setFocused2(true);
container.setTextField(this.level);
}
@Override
protected void addButtons() {
this.levelMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8, Settings.LEVEL_TYPE,
LevelType.ITEM_LEVEL);
this.redstoneMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 28,
Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL);
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.craftingMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48,
Settings.CRAFT_VIA_REDSTONE, YesNo.NO);
final int a = AEConfig.instance().levelByStackAmounts(0);
final int b = AEConfig.instance().levelByStackAmounts(1);
final int c = AEConfig.instance().levelByStackAmounts(2);
final int d = AEConfig.instance().levelByStackAmounts(3);
this.addButton(this.plus1 = new Button(this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a, btn -> addQty(a)));
this.addButton(
this.plus10 = new Button(this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b, btn -> addQty(b)));
this.addButton(
this.plus100 = new Button(this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c, btn -> addQty(c)));
this.addButton(
this.plus1000 = new Button(this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d, btn -> addQty(d)));
this.addButton(
this.minus1 = new Button(this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a, btn -> addQty(-a)));
this.addButton(
this.minus10 = new Button(this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b, btn -> addQty(-b)));
this.addButton(
this.minus100 = new Button(this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c, btn -> addQty(-c)));
this.addButton(
this.minus1000 = new Button(this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d, btn -> addQty(-d)));
this.addButton(this.levelMode);
this.addButton(this.redstoneMode);
this.addButton(this.craftingMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
final boolean notCraftingMode = this.bc.getInstalledUpgrades(Upgrades.CRAFTING) == 0;
// configure enabled status...
this.level.setEnabled(notCraftingMode);
this.plus1.active = notCraftingMode;
this.plus10.active = notCraftingMode;
this.plus100.active = notCraftingMode;
this.plus1000.active = notCraftingMode;
this.minus1.active = notCraftingMode;
this.minus10.active = notCraftingMode;
this.minus100.active = notCraftingMode;
this.minus1000.active = notCraftingMode;
this.levelMode.active = notCraftingMode;
this.redstoneMode.active = notCraftingMode;
super.drawFG(offsetX, offsetY, mouseX, mouseY);
if (this.craftingMode != null) {
this.craftingMode.set(this.cvb.getCraftingMode());
}
if (this.levelMode != null) {
this.levelMode.set(((LevelEmitterContainer) this.cvb).getLevelMode());
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
this.level.render(mouseX, mouseY, partialTicks);
}
@Override
protected void handleButtonVisibility() {
this.craftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.CRAFTING) > 0);
this.fuzzyMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0);
}
@Override
protected String getBackground() {
return "guis/lvlemitter.png";
}
@Override
protected GuiText getName() {
return GuiText.LevelEmitter;
}
private void addQty(final long i) {
try {
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
long result = Long.parseLong(Out);
result += i;
if (result < 0) {
result = 0;
}
this.level.setText(Out = Long.toString(result));
NetworkHandler.instance().sendToServer(new ConfigValuePacket("LevelEmitter.Value", Out));
} catch (final NumberFormatException e) {
// nope..
this.level.setText("0");
}
}
@Override
public boolean charTyped(char character, int key) {
// Forward entered characters to the number-text-field
return level.charTyped(character, key);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
if (!this.checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode))) {
if (keyCode == 211 || keyCode == 205 || keyCode == 203 || keyCode == 14) {
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
NetworkHandler.instance().sendToServer(new ConfigValuePacket("LevelEmitter.Value", Out));
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
}
@@ -1,512 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import java.util.List;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import appeng.api.config.*;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IMEChest;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.ActionKey;
import appeng.client.gui.AEBaseMEScreen;
import appeng.client.gui.widgets.*;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.container.implementations.CraftingStatusContainer;
import appeng.container.implementations.MEMonitorableContainer;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.CraftingMatrixSlot;
import appeng.container.slot.FakeCraftingMatrixSlot;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.core.sync.packets.SwitchGuisPacket;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.abstraction.JEIFacade;
import appeng.parts.reporting.AbstractTerminalPart;
import appeng.tile.misc.SecurityStationBlockEntity;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBaseMEScreen<T>
implements ISortSource, IConfigManagerHost {
private static int craftingGridOffsetX;
private static int craftingGridOffsetY;
private static String memoryText = "";
private final ItemRepo repo;
private final int offsetX = 9;
private final int lowerTextureOffset = 0;
private final IConfigManager configSrc;
private final boolean viewCell;
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
private TabButton craftingStatusBtn;
private AETextField searchField;
private GuiText myName;
private int perRow = 9;
private int reservedSpace = 0;
private boolean customSortOrder = true;
private int rows = 0;
private int maxRows = Integer.MAX_VALUE;
private int standardSize;
private SettingToggleButton<ViewItems> viewModeToggle;
private SettingToggleButton<SortOrder> sortByToggle;
private SettingToggleButton<SortDir> sortDirToggle;
private boolean isAutoFocus = false;
private int currentMouseX = 0;
private int currentMouseY = 0;
public MEMonitorableScreen(T container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
this.repo = new ItemRepo(scrollbar, this);
setScrollBar();
this.xSize = 185;
this.ySize = 204;
Object te = container.getTarget();
if (te instanceof IViewCellStorage) {
this.xSize += 33;
}
this.standardSize = this.xSize;
this.configSrc = ((IConfigurableObject) this.container).getConfigManager();
this.container.setGui(this);
this.viewCell = te instanceof IViewCellStorage;
if (te instanceof SecurityStationBlockEntity) {
this.myName = GuiText.Security;
} else if (te instanceof WirelessTerminalGuiObject) {
this.myName = GuiText.WirelessTerminal;
} else if (te instanceof IPortableCell) {
this.myName = GuiText.PortableCell;
} else if (te instanceof IMEChest) {
this.myName = GuiText.Chest;
} else if (te instanceof AbstractTerminalPart) {
this.myName = GuiText.Terminal;
} else {
throw new IllegalArgumentException("Invalid GUI target given: " + te);
}
}
public void postUpdate(final List<IAEItemStack> list) {
for (final IAEItemStack is : list) {
this.repo.postUpdate(is);
}
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar() {
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
this.getScrollBar().setRange(0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
Math.max(1, this.rows / 6));
}
private void showCraftingStatus() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(CraftingStatusContainer.TYPE));
}
@Override
public void init() {
getMinecraft().keyboardListener.enableRepeatEvents(true);
this.maxRows = this.getMaxRows();
TerminalStyle terminalStyle = AEConfig.instance().getTerminalStyle();
if (terminalStyle != TerminalStyle.FULL) {
this.perRow = 9;
} else {
this.perRow = 9 + ((this.width - this.standardSize) / 18);
}
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
final int magicNumber = 114 + 1;
final int extraSpace = this.height - magicNumber - this.reservedSpace;
this.rows = extraSpace / 18;
if (this.rows > this.maxRows) {
this.rows = this.maxRows;
}
if (this.rows < 3) {
this.rows = 3;
}
// Size the container according to the number of rows we decided to have
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
this.getMeSlots().clear();
for (int y = 0; y < this.rows; y++) {
for (int x = 0; x < this.perRow; x++) {
this.getMeSlots()
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
}
}
super.init();
// full size : 204
// extra slots : 72
// slot 18
int offset = this.guiTop + 8;
if (this.customSortOrder) {
this.sortByToggle = this.addButton(new SettingToggleButton<>(this.guiLeft - 18, offset, Settings.SORT_BY,
getSortBy(), Platform::isSortOrderAvailable, this::toggleServerSetting));
offset += 20;
}
if (this.viewCell || this instanceof WirelessTermScreen) {
this.viewModeToggle = this.addButton(new SettingToggleButton<>(this.guiLeft - 18, offset,
Settings.VIEW_MODE, getSortDisplay(), this::toggleServerSetting));
offset += 20;
}
this.addButton(this.sortDirToggle = new SettingToggleButton<>(this.guiLeft - 18, offset,
Settings.SORT_DIRECTION, getSortDir(), this::toggleServerSetting));
offset += 20;
SearchBoxMode searchMode = AEConfig.instance().getTerminalSearchMode();
this.addButton(new SettingToggleButton<>(this.guiLeft - 18, offset, Settings.SEARCH_MODE, searchMode,
Platform::isSearchModeAvailable, this::toggleTerminalSearchMode));
offset += 20;
if (!(this instanceof MEPortableCellScreen) || this instanceof WirelessTermScreen) {
this.addButton(new SettingToggleButton<>(this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, terminalStyle,
this::toggleTerminalStyle));
}
this.searchField = new AETextField(this.font, this.guiLeft + Math.max(80, this.offsetX), this.guiTop + 4, 90,
12);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setMaxStringLength(25);
this.searchField.setTextColor(0xFFFFFF);
this.searchField.setSelectionColor(0xFF008000);
this.searchField.setVisible(true);
if (this.viewCell || this instanceof WirelessTermScreen) {
this.craftingStatusBtn = this.addButton(new TabButton(this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16,
GuiText.CraftingStatus.getLocal(), this.itemRenderer, btn -> showCraftingStatus()));
this.craftingStatusBtn.setHideEdge(13);
}
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchMode || SearchBoxMode.JEI_AUTOSEARCH == searchMode
|| SearchBoxMode.AUTOSEARCH_KEEP == searchMode || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchMode;
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchMode
|| SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchMode || SearchBoxMode.MANUAL_SEARCH_KEEP == searchMode
|| SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchMode;
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchMode
|| SearchBoxMode.JEI_MANUAL_SEARCH == searchMode;
this.searchField.setFocused2(this.isAutoFocus);
if (isJEIEnabled) {
memoryText = JEIFacade.instance().getSearchText();
}
if (isKeepFilter && memoryText != null && !memoryText.isEmpty()) {
this.searchField.setText(memoryText);
this.searchField.selectAll();
this.repo.setSearchString(memoryText);
this.repo.updateView();
this.setScrollBar();
}
craftingGridOffsetX = Integer.MAX_VALUE;
craftingGridOffsetY = Integer.MAX_VALUE;
for (final Slot s : this.container.inventorySlots) {
if (s instanceof AppEngSlot) {
if (s.xPos < 197) {
this.repositionSlot((AppEngSlot) s);
}
}
if (s instanceof CraftingMatrixSlot || s instanceof FakeCraftingMatrixSlot) {
if (s.xPos > 0 && s.yPos > 0) {
craftingGridOffsetX = Math.min(craftingGridOffsetX, s.xPos);
craftingGridOffsetY = Math.min(craftingGridOffsetY, s.yPos);
}
}
}
craftingGridOffsetX -= 25;
craftingGridOffsetY -= 6;
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(this.myName.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
}
@Override
public boolean mouseClicked(final double xCoord, final double yCoord, final int btn) {
if (this.searchField.mouseClicked(xCoord, yCoord, btn)) {
if (btn == 1 && this.searchField.isMouseOver(xCoord, yCoord)) {
this.searchField.setText("");
this.repo.setSearchString("");
this.repo.updateView();
this.setScrollBar();
}
return true;
}
return super.mouseClicked(xCoord, yCoord, btn);
}
@Override
public void removed() {
super.removed();
getMinecraft().keyboardListener.enableRepeatEvents(false);
memoryText = this.searchField.getText();
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture(this.getBackground());
final int x_width = 197;
blit(offsetX, offsetY, 0, 0, x_width, 18);
if (this.viewCell || (this instanceof SecurityStationScreen)) {
blit(offsetX + x_width, offsetY, x_width, 0, 46, 128);
}
for (int x = 0; x < this.rows; x++) {
blit(offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
}
blit(offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width,
99 + this.reservedSpace - this.lowerTextureOffset);
if (this.viewCell) {
boolean update = false;
for (int i = 0; i < 5; i++) {
if (this.myCurrentViewCells[i] != this.container.getCellViewSlot(i).getStack()) {
update = true;
this.myCurrentViewCells[i] = this.container.getCellViewSlot(i).getStack();
}
}
if (update) {
this.repo.setViewCell(this.myCurrentViewCells);
}
}
if (this.searchField != null) {
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
protected String getBackground() {
return "guis/terminal.png";
}
@Override
protected boolean isPowered() {
return this.repo.hasPower();
}
int getMaxRows() {
return AEConfig.instance().getTerminalStyle() == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
protected void repositionSlot(final AppEngSlot s) {
s.yPos = s.getY() + this.ySize - 78 - 5;
}
@Override
public boolean charTyped(char character, int p_charTyped_2_) {
if (character == ' ' && this.searchField.getText().isEmpty()) {
return true;
}
if (this.isAutoFocus && !this.searchField.isFocused() && isHovered()) {
this.searchField.setFocused2(true);
}
if (this.searchField.isFocused() && this.searchField.charTyped(character, p_charTyped_2_)) {
this.repo.setSearchString(this.searchField.getText());
this.repo.updateView();
this.setScrollBar();
return true;
}
return false;
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
InputUtil.Key input = InputMappings.getInputByCode(keyCode, scanCode);
if (keyCode != GLFW.GLFW_KEY_ESCAPE && !this.checkHotbarKeys(input)) {
if (AppEng.instance().isActionKey(ActionKey.TOGGLE_FOCUS, input)) {
this.searchField.setFocused2(!this.searchField.isFocused());
return true;
}
if (!this.searchField.isFocused() && this.isAutoFocus && isHovered()) {
this.searchField.setFocused2(true);
}
if (this.searchField.isFocused()) {
if (keyCode == GLFW.GLFW_KEY_ENTER) {
this.searchField.setFocused2(false);
return true;
}
if (this.searchField.keyPressed(keyCode, scanCode, p_keyPressed_3_)) {
this.repo.setSearchString(this.searchField.getText());
this.repo.updateView();
this.setScrollBar();
}
// We need to swallow key presses if the field is focused because typing 'e'
// would otherwise close
// the screen
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
private boolean isHovered() {
return isPointInRegion(0, 0, this.xSize, this.ySize, currentMouseX, currentMouseY);
}
@Override
public void tick() {
this.repo.setPower(this.container.isPowered());
super.tick();
}
@Override
public SortOrder getSortBy() {
return (SortOrder) this.configSrc.getSetting(Settings.SORT_BY);
}
@Override
public SortDir getSortDir() {
return (SortDir) this.configSrc.getSetting(Settings.SORT_DIRECTION);
}
@Override
public ViewItems getSortDisplay() {
return (ViewItems) this.configSrc.getSetting(Settings.VIEW_MODE);
}
@Override
public void updateSetting(final IConfigManager manager, final Settings settingName, final Enum<?> newValue) {
if (this.sortByToggle != null) {
this.sortByToggle.set(getSortBy());
}
if (this.sortDirToggle != null) {
this.sortDirToggle.set(getSortDir());
}
if (this.viewModeToggle != null) {
this.viewModeToggle.set(getSortDisplay());
}
this.repo.updateView();
}
int getReservedSpace() {
return this.reservedSpace;
}
void setReservedSpace(final int reservedSpace) {
this.reservedSpace = reservedSpace;
}
public boolean isCustomSortOrder() {
return this.customSortOrder;
}
void setCustomSortOrder(final boolean customSortOrder) {
this.customSortOrder = customSortOrder;
}
public int getStandardSize() {
return this.standardSize;
}
void setStandardSize(final int standardSize) {
this.standardSize = standardSize;
}
private void toggleTerminalSearchMode(SettingToggleButton<SearchBoxMode> btn, boolean backwards) {
SearchBoxMode next = btn.getNextValue(backwards);
AEConfig.instance().setTerminalSearchMode(next);
btn.set(next);
this.reinitalize();
}
private void toggleTerminalStyle(SettingToggleButton<TerminalStyle> btn, boolean backwards) {
TerminalStyle next = btn.getNextValue(backwards);
AEConfig.instance().setTerminalStyle(next);
btn.set(next);
this.reinitalize();
}
private <S extends Enum<S>> void toggleServerSetting(SettingToggleButton<S> btn, boolean backwards) {
S next = btn.getNextValue(backwards);
NetworkHandler.instance().sendToServer(new ConfigValuePacket(btn.getSetting().name(), next.name()));
btn.set(next);
}
private void reinitalize() {
this.children.removeAll(this.buttons);
this.buttons.clear();
this.init();
}
}
@@ -1,37 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.container.implementations.MEPortableCellContainer;
public class MEPortableCellScreen extends MEMonitorableScreen<MEPortableCellContainer> {
public MEPortableCellScreen(MEPortableCellContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
}
@Override
int getMaxRows() {
return 3;
}
}
@@ -1,80 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.container.implementations.MolecularAssemblerContainer;
import appeng.core.localization.GuiText;
public class MolecularAssemblerScreen extends UpgradeableScreen<MolecularAssemblerContainer> {
private ProgressBar pb;
public MolecularAssemblerScreen(MolecularAssemblerContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.ySize = 197;
}
@Override
public void init() {
super.init();
this.pb = new ProgressBar(this.container, "guis/molecular_assembler.png", 139, 36, 148, 201, 6, 18,
Direction.VERTICAL);
this.addButton(this.pb);
}
@Override
protected void addButtons() {
this.redstoneMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
addButton(this.redstoneMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.pb.setFullMsg(this.container.getCurrentProgress() + "%");
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.pb.x = 148 + this.guiLeft;
this.pb.y = 48 + this.guiTop;
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
}
@Override
protected String getBackground() {
return "guis/molecular_assembler.png";
}
@Override
protected GuiText getName() {
return GuiText.MolecularAssembler;
}
}
@@ -1,248 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import java.util.List;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.CommonButtons;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.Scrollbar;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotME;
import appeng.container.implementations.NetworkStatusContainer;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> implements ISortSource {
private final ItemRepo repo;
private final int rows = 4;
private int tooltip = -1;
public NetworkStatusScreen(NetworkStatusContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
this.repo = new ItemRepo(scrollbar, this);
this.ySize = 153;
this.xSize = 195;
this.repo.setRowSize(5);
}
@Override
public void init() {
super.init();
this.addButton(CommonButtons.togglePowerUnit(this.guiLeft - 18, this.guiTop + 8));
}
@Override
public void render(final int mouseX, final int mouseY, final float btn) {
final int gx = (this.width - this.xSize) / 2;
final int gy = (this.height - this.ySize) / 2;
this.tooltip = -1;
int y = 0;
int x = 0;
for (int z = 0; z <= 4 * 5; z++) {
final int minX = gx + 14 + x * 31;
final int minY = gy + 41 + y * 18;
if (minX < mouseX && minX + 28 > mouseX) {
if (minY < mouseY && minY + 20 > mouseY) {
this.tooltip = z;
break;
}
}
x++;
if (x > 4) {
y++;
x = 0;
}
}
super.render(mouseX, mouseY, btn);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.NetworkDetails.getLocal(), 8, 6, 4210752);
this.font.drawString(
GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong(container.getCurrentPower(), false),
13, 16, 4210752);
this.font.drawString(
GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong(container.getMaxPower(), false), 13, 26,
4210752);
this.font.drawString(GuiText.PowerInputRate.getLocal() + ": "
+ Platform.formatPowerLong(container.getAverageAddition(), true), 13, 143 - 10, 4210752);
this.font.drawString(
GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong(container.getPowerUsage(), true),
13, 143 - 20, 4210752);
final int sectionLength = 30;
int x = 0;
int y = 0;
final int xo = 12;
final int yo = 42;
final int viewStart = 0;// myScrollBar.getCurrentScroll() * 5;
final int viewEnd = viewStart + 5 * 4;
String toolTip = "";
int toolPosX = 0;
int toolPosY = 0;
for (int z = viewStart; z < Math.min(viewEnd, this.repo.size()); z++) {
final IAEItemStack refStack = this.repo.getReferenceItem(z);
if (refStack != null) {
RenderSystem.pushMatrix();
RenderSystem.scalef(0.5f, 0.5f, 0.5f);
String str = Long.toString(refStack.getStackSize());
if (refStack.getStackSize() >= 10000) {
str = Long.toString(refStack.getStackSize() / 1000) + 'k';
}
final int w = this.font.getStringWidth(str);
this.font.drawString(str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * 18 + yo + 6) * 2, 4210752);
RenderSystem.popMatrix();
final int posX = x * sectionLength + xo + sectionLength - 18;
final int posY = y * 18 + yo;
if (this.tooltip == z - viewStart) {
toolTip = Platform.getItemDisplayName(refStack).getFormattedText();
toolTip += ('\n' + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
if (refStack.getCountRequestable() > 0) {
toolTip += ('\n' + GuiText.EnergyDrain.getLocal() + ": "
+ Platform.formatPowerLong(refStack.getCountRequestable(), true));
}
toolPosX = x * sectionLength + xo + sectionLength - 8;
toolPosY = y * 18 + yo;
}
this.drawItem(posX, posY, refStack.asItemStackRepresentation());
x++;
if (x > 4) {
y++;
x = 0;
}
}
}
if (this.tooltip >= 0 && toolTip.length() > 0) {
this.drawTooltip(toolPosX, toolPosY + 10, toolTip);
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/networkstatus.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
public void postUpdate(final List<IAEItemStack> list) {
this.repo.clear();
for (final IAEItemStack is : list) {
this.repo.postUpdate(is);
}
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar() {
final int size = this.repo.size();
this.getScrollBar().setTop(39).setLeft(175).setHeight(78);
this.getScrollBar().setRange(0, (size + 4) / 5 - this.rows, 1);
}
@Override
protected void renderTooltip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && !stack.isEmpty()) {
IAEItemStack myStack = null;
try {
final SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
} catch (final Throwable ignore) {
}
if (myStack != null) {
List<String> currentToolTip = getTooltipFromItem(stack);
while (currentToolTip.size() > 1) {
currentToolTip.remove(1);
}
currentToolTip.add(GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()));
currentToolTip.add(GuiText.EnergyDrain.getLocal() + ": "
+ Platform.formatPowerLong(myStack.getCountRequestable(), true));
this.drawTooltip(x, y, currentToolTip);
}
}
super.renderTooltip(stack, x, y);
}
@Override
public SortOrder getSortBy() {
return SortOrder.NAME;
}
@Override
public SortDir getSortDir() {
return SortDir.ASCENDING;
}
@Override
public ViewItems getSortDisplay() {
return ViewItems.ALL;
}
}
@@ -1,71 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ToggleButton;
import appeng.container.implementations.NetworkToolContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
private ToggleButton tFacades;
public NetworkToolScreen(NetworkToolContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
public void init() {
super.init();
this.tFacades = new ToggleButton(this.guiLeft - 18, this.guiTop + 8, 23, 22,
GuiText.TransparentFacades.getLocal(), GuiText.TransparentFacadesHint.getLocal(),
btn -> toggleFacades());
this.addButton(this.tFacades);
}
private void toggleFacades() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("NetworkTool", "Toggle"));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.tFacades != null) {
this.tFacades.setState(container.isFacadeMode());
}
this.font.drawString(this.getGuiDisplayName(GuiText.NetworkTool.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/toolbox.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,147 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import appeng.api.config.ActionItems;
import appeng.client.gui.widgets.ActionButton;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.PatternTermContainer;
import appeng.container.slot.AppEngSlot;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer> {
private static final String BACKGROUND_CRAFTING_MODE = "guis/pattern.png";
private static final String BACKGROUND_PROCESSING_MODE = "guis/pattern2.png";
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
private TabButton tabCraftButton;
private TabButton tabProcessButton;
private ActionButton substitutionsEnabledBtn;
private ActionButton substitutionsDisabledBtn;
public PatternTermScreen(PatternTermContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.setReservedSpace(81);
}
@Override
public void init() {
super.init();
this.tabCraftButton = new TabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177,
new ItemStack(Blocks.CRAFTING_TABLE), GuiText.CraftingPattern.getLocal(), this.itemRenderer,
btn -> toggleCraftMode(CRAFTMODE_PROCESSING));
this.addButton(this.tabCraftButton);
this.tabProcessButton = new TabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177,
new ItemStack(Blocks.FURNACE), GuiText.ProcessingPattern.getLocal(), this.itemRenderer,
btn -> toggleCraftMode(CRAFTMODE_CRFTING));
this.addButton(this.tabProcessButton);
this.substitutionsEnabledBtn = new ActionButton(this.guiLeft + 84, this.guiTop + this.ySize - 163,
ActionItems.ENABLE_SUBSTITUTION, act -> toggleSubstitutions(SUBSITUTION_DISABLE));
this.substitutionsEnabledBtn.setHalfSize(true);
this.addButton(this.substitutionsEnabledBtn);
this.substitutionsDisabledBtn = new ActionButton(this.guiLeft + 84, this.guiTop + this.ySize - 163,
ActionItems.DISABLE_SUBSTITUTION, act -> toggleSubstitutions(SUBSITUTION_ENABLE));
this.substitutionsDisabledBtn.setHalfSize(true);
this.addButton(this.substitutionsDisabledBtn);
ActionButton clearBtn = new ActionButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, ActionItems.CLOSE,
act -> clear());
clearBtn.setHalfSize(true);
this.addButton(clearBtn);
ActionButton encodeBtn = new ActionButton(this.guiLeft + 147, this.guiTop + this.ySize - 142,
ActionItems.ENCODE, act -> encode());
this.addButton(encodeBtn);
}
private void toggleCraftMode(String mode) {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PatternTerminal.CraftMode", mode));
}
private void toggleSubstitutions(String mode) {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PatternTerminal.Substitute", mode));
}
private void encode() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PatternTerminal.Encode", "1"));
}
private void clear() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PatternTerminal.Clear", "1"));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.container.isCraftingMode()) {
this.tabCraftButton.visible = true;
this.tabProcessButton.visible = false;
if (this.container.substitute) {
this.substitutionsEnabledBtn.visible = true;
this.substitutionsDisabledBtn.visible = false;
} else {
this.substitutionsEnabledBtn.visible = false;
this.substitutionsDisabledBtn.visible = true;
}
} else {
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
this.substitutionsEnabledBtn.visible = false;
this.substitutionsDisabledBtn.visible = false;
}
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.getReservedSpace(),
4210752);
}
@Override
protected String getBackground() {
if (this.container.isCraftingMode()) {
return BACKGROUND_CRAFTING_MODE;
}
return BACKGROUND_PROCESSING_MODE;
}
@Override
protected void repositionSlot(final AppEngSlot s) {
final int offsetPlayerSide = s.isPlayerSide() ? 5 : 3;
s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
}
}
@@ -1,176 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.NumberBox;
import appeng.container.implementations.PriorityContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
private final AESubScreen subGui;
private NumberBox priority;
public PriorityScreen(PriorityContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.subGui = new AESubScreen(this, container.getPriorityHost());
}
@Override
public void init() {
super.init();
final int a = AEConfig.instance().priorityByStacksAmounts(0);
final int b = AEConfig.instance().priorityByStacksAmounts(1);
final int c = AEConfig.instance().priorityByStacksAmounts(2);
final int d = AEConfig.instance().priorityByStacksAmounts(3);
this.addButton(new Button(this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a, btn -> addQty(a)));
this.addButton(new Button(this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b, btn -> addQty(b)));
this.addButton(new Button(this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c, btn -> addQty(c)));
this.addButton(new Button(this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d, btn -> addQty(d)));
this.addButton(new Button(this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a, btn -> addQty(-a)));
this.addButton(new Button(this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b, btn -> addQty(-b)));
this.addButton(new Button(this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c, btn -> addQty(-c)));
this.addButton(new Button(this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d, btn -> addQty(-d)));
this.subGui.addBackButton(this::addButton, 154, 0);
this.priority = new NumberBox(this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT,
Long.class);
this.priority.setEnableBackgroundDrawing(false);
this.priority.setMaxStringLength(16);
this.priority.setTextColor(0xFFFFFF);
this.priority.setVisible(true);
this.priority.setFocused2(true);
container.setTextField(this.priority);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.Priority.getLocal(), 8, 6, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture(getBackground());
blit(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
this.priority.render(mouseX, mouseY, partialTicks);
}
private void addQty(final int i) {
try {
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.priority.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
long result = Long.parseLong(out);
result += i;
this.priority.setText(out = Long.toString(result));
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PriorityHost.Priority", out));
} catch (final NumberFormatException e) {
// nope..
this.priority.setText("0");
}
}
@Override
public boolean charTyped(char character, int key) {
if (priority.charTyped(character, key)) {
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.priority.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PriorityHost.Priority", out));
return true;
}
return false;
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
if (!this.checkHotbarKeys(InputMappings.getInputByCode(keyCode, scanCode))) {
if ((keyCode == 211 || keyCode == 205 || keyCode == 203 || keyCode == 14)
&& this.priority.keyPressed(keyCode, scanCode, p_keyPressed_3_)) {
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.priority.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PriorityHost.Priority", out));
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
protected String getBackground() {
return "guis/priority.png";
}
}
@@ -1,47 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.QNBContainer;
import appeng.core.localization.GuiText;
public class QNBScreen extends AEBaseScreen<QNBContainer> {
public QNBScreen(QNBContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.QuantumLinkChamber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/chest.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,117 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.ActionKey;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.QuartzKnifeContainer;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
private TextFieldWidget name;
public QuartzKnifeScreen(QuartzKnifeContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 184;
}
@Override
public void init() {
super.init();
this.name = new TextFieldWidget(this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT, "");
this.name.setEnableBackgroundDrawing(false);
this.name.setMaxStringLength(32);
this.name.setTextColor(0xFFFFFF);
this.name.setVisible(true);
this.name.setFocused2(true);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.QuartzCuttingKnife.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/quartzknife.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
this.name.render(mouseX, mouseY, partialTicks);
}
@Override
public boolean charTyped(char character, int key) {
if (this.name.isFocused() && this.name.charTyped(character, key)) {
final String Out = this.name.getText();
container.setName(Out);
NetworkHandler.instance().sendToServer(new ConfigValuePacket("QuartzKnife.Name", Out));
return true;
}
return super.charTyped(character, key);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
InputUtil.Key input = InputMappings.getInputByCode(keyCode, scanCode);
if (keyCode != GLFW.GLFW_KEY_ESCAPE && !this.checkHotbarKeys(input)) {
if (AppEng.instance().isActionKey(ActionKey.TOGGLE_FOCUS, input)) {
this.name.setFocused2(!this.name.isFocused());
return true;
}
if (this.name.isFocused()) {
if (keyCode == GLFW.GLFW_KEY_ENTER) {
this.name.setFocused2(false);
return true;
}
if (this.name.keyPressed(keyCode, scanCode, p_keyPressed_3_)) {
final String Out = this.name.getText();
container.setName(Out);
NetworkHandler.instance().sendToServer(new ConfigValuePacket("QuartzKnife.Name", Out));
return true;
}
// We need to swallow key presses if the field is focused because typing 'e'
// would otherwise close
// the screen
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
}
@@ -1,104 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.SortOrder;
import appeng.client.gui.widgets.ToggleButton;
import appeng.container.implementations.SecurityStationContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationContainer> {
private ToggleButton inject;
private ToggleButton extract;
private ToggleButton craft;
private ToggleButton build;
private ToggleButton security;
public SecurityStationScreen(SecurityStationContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.setCustomSortOrder(false);
this.setReservedSpace(33);
// increase size so that the slot is over the gui.
this.xSize += 56;
this.setStandardSize(this.xSize);
}
private void toggleOption(SecurityPermissions permission) {
NetworkHandler.instance()
.sendToServer(new ConfigValuePacket("TileSecurityStation.ToggleOption", permission.name()));
}
@Override
public void init() {
super.init();
final int top = this.guiTop + this.ySize - 116;
this.inject = this.addButton(new ToggleButton(this.guiLeft + 56, top, 11 * 16, 12 * 16,
SecurityPermissions.INJECT.getTranslatedName(), SecurityPermissions.INJECT.getTranslatedTip(),
btn -> toggleOption(SecurityPermissions.INJECT)));
this.extract = this.addButton(new ToggleButton(this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1,
SecurityPermissions.EXTRACT.getTranslatedName(), SecurityPermissions.EXTRACT.getTranslatedTip(),
btn -> toggleOption(SecurityPermissions.EXTRACT)));
this.craft = this.addButton(new ToggleButton(this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2,
SecurityPermissions.CRAFT.getTranslatedName(), SecurityPermissions.CRAFT.getTranslatedTip(),
btn -> toggleOption(SecurityPermissions.CRAFT)));
this.build = this.addButton(new ToggleButton(this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3,
SecurityPermissions.BUILD.getTranslatedName(), SecurityPermissions.BUILD.getTranslatedTip(),
btn -> toggleOption(SecurityPermissions.BUILD)));
this.security = this.addButton(new ToggleButton(this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4,
SecurityPermissions.SECURITY.getTranslatedName(), SecurityPermissions.SECURITY.getTranslatedTip(),
btn -> toggleOption(SecurityPermissions.SECURITY)));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(),
4210752);
}
@Override
protected String getBackground() {
this.inject.setState((container.getPermissionMode() & (1 << SecurityPermissions.INJECT.ordinal())) > 0);
this.extract.setState((container.getPermissionMode() & (1 << SecurityPermissions.EXTRACT.ordinal())) > 0);
this.craft.setState((container.getPermissionMode() & (1 << SecurityPermissions.CRAFT.ordinal())) > 0);
this.build.setState((container.getPermissionMode() & (1 << SecurityPermissions.BUILD.ordinal())) > 0);
this.security.setState((container.getPermissionMode() & (1 << SecurityPermissions.SECURITY.ordinal())) > 0);
return "guis/security_station.png";
}
@Override
public SortOrder getSortBy() {
return SortOrder.NAME;
}
}
@@ -1,57 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.Identifier;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.SkyChestContainer;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
public class SkyChestScreen extends AEBaseScreen<SkyChestContainer> {
private static final Identifier TEXTURE = new Identifier(AppEng.MOD_ID, "textures/guis/skychest.png");
public SkyChestScreen(SkyChestContainer container, PlayerInventory playerInv, Text title) {
super(container, playerInv, title);
this.ySize = 195;
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.SkyChest.getLocal()), 8, 8, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
bindTexture(TEXTURE);
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0);
}
@Override
protected boolean enableSpaceClicking() {
// NOTE: previously checked for inventory tweaks mod (which no longer exists)
return true;
}
}
@@ -1,76 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.CommonButtons;
import appeng.container.implementations.SpatialIOPortContainer;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
public SpatialIOPortScreen(SpatialIOPortContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.ySize = 199;
}
@Override
public void init() {
super.init();
this.addButton(CommonButtons.togglePowerUnit(this.guiLeft - 18, this.guiTop + 8));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.StoredPower.getLocal() + ": "
+ Platform.formatPowerLong(this.container.getCurrentPower(), false), 13, 21, 4210752);
this.font.drawString(
GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong(this.container.getMaxPower(), false), 13,
31, 4210752);
this.font.drawString(GuiText.RequiredPower.getLocal() + ": "
+ Platform.formatPowerLong(this.container.getRequiredPower(), false), 13, 73, 4210752);
this.font.drawString(
GuiText.Efficiency.getLocal() + ": " + (((float) this.container.getEfficency()) / 100) + '%', 13, 83,
4210752);
this.font.drawString(this.getGuiDisplayName(GuiText.SpatialIOPort.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752);
if (this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0) {
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize
+ "x" + this.container.zSize;
this.font.drawString(text, 13, 93, 4210752);
} else {
this.font.drawString(GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752);
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/spatialio.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,104 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.client.gui.widgets.ActionButton;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.PriorityContainer;
import appeng.container.implementations.StorageBusContainer;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.core.sync.packets.SwitchGuisPacket;
public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
private SettingToggleButton<AccessRestriction> rwMode;
private SettingToggleButton<StorageFilter> storageFilter;
public StorageBusScreen(StorageBusContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 251;
}
@Override
protected void addButtons() {
addButton(new ActionButton(this.guiLeft - 18, this.guiTop + 8, ActionItems.CLOSE, btn -> clear()));
addButton(new ActionButton(this.guiLeft - 18, this.guiTop + 28, ActionItems.WRENCH, btn -> partition()));
this.rwMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS,
AccessRestriction.READ_WRITE);
this.storageFilter = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 68,
Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(this.storageFilter);
this.addButton(this.fuzzyMode);
this.addButton(this.rwMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.StorageBus.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
}
if (this.storageFilter != null) {
this.storageFilter.set(((StorageBusContainer) this.cvb).getStorageFilter());
}
if (this.rwMode != null) {
this.rwMode.set(((StorageBusContainer) this.cvb).getReadWriteMode());
}
}
@Override
protected String getBackground() {
return "guis/storagebus.png";
}
private void partition() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("StorageBus.Action", "Partition"));
}
private void clear() {
NetworkHandler.instance().sendToServer(new ConfigValuePacket("StorageBus.Action", "Clear"));
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer(new SwitchGuisPacket(PriorityContainer.TYPE));
}
}
@@ -1,150 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SchedulingMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.api.implementations.IUpgradeableHost;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.container.implementations.UpgradeableContainer;
import appeng.core.localization.GuiText;
import appeng.parts.automation.ExportBusPart;
import appeng.parts.automation.ImportBusPart;
public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScreen<T> {
protected final UpgradeableContainer cvb;
protected final IUpgradeableHost bc;
protected SettingToggleButton<RedstoneMode> redstoneMode;
protected SettingToggleButton<FuzzyMode> fuzzyMode;
protected SettingToggleButton<YesNo> craftMode;
protected SettingToggleButton<SchedulingMode> schedulingMode;
public UpgradeableScreen(T container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.cvb = container;
this.bc = (IUpgradeableHost) container.getTarget();
this.xSize = this.hasToolbox() ? 246 : 211;
this.ySize = 184;
}
protected boolean hasToolbox() {
return (this.container).hasToolbox();
}
@Override
public void init() {
super.init();
this.addButtons();
}
protected void addButtons() {
this.redstoneMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
addButton(this.redstoneMode);
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 28, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
addButton(this.fuzzyMode);
this.craftMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_ONLY,
YesNo.NO);
addButton(this.craftMode);
this.schedulingMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 68,
Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
addButton(this.schedulingMode);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(this.getName().getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
}
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
}
if (this.craftMode != null) {
this.craftMode.set(this.cvb.getCraftingMode());
}
if (this.schedulingMode != null) {
this.schedulingMode.set(this.cvb.getSchedulingMode());
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, this.ySize, getBlitOffset());
if (this.drawUpgrades()) {
GuiUtils.drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18,
getBlitOffset());
}
if (this.hasToolbox()) {
GuiUtils.drawTexturedModalRect(offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68,
getBlitOffset());
}
}
protected void handleButtonVisibility() {
if (this.redstoneMode != null) {
this.redstoneMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.REDSTONE) > 0);
}
if (this.fuzzyMode != null) {
this.fuzzyMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0);
}
if (this.craftMode != null) {
this.craftMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.CRAFTING) > 0);
}
if (this.schedulingMode != null) {
this.schedulingMode.setVisibility(
this.bc.getInstalledUpgrades(Upgrades.CAPACITY) > 0 && this.bc instanceof ExportBusPart);
}
}
protected String getBackground() {
return "guis/bus.png";
}
protected boolean drawUpgrades() {
return true;
}
protected GuiText getName() {
return this.bc instanceof ImportBusPart ? GuiText.ImportBus : GuiText.ExportBus;
}
}
@@ -1,77 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
import appeng.container.implementations.VibrationChamberContainer;
import appeng.core.localization.GuiText;
import appeng.tile.misc.VibrationChamberBlockEntity;
public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContainer> {
private ProgressBar pb;
public VibrationChamberScreen(VibrationChamberContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
public void init() {
super.init();
this.pb = new ProgressBar(this.container, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL);
this.addButton(this.pb);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.VibrationChamber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.pb.setFullMsg(VibrationChamberBlockEntity.POWER_PER_TICK * this.container.getCurrentProgress()
/ VibrationChamberBlockEntity.DILATION_SCALING + " AE/t");
if (this.container.getRemainingBurnTime() > 0) {
final int i1 = this.container.getRemainingBurnTime() * 12 / 100;
this.bindTexture("guis/vibchamber.png");
RenderSystem.color3f(1, 1, 1);
final int l = -15;
final int k = 25;
GuiUtils.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2, getBlitOffset());
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/vibchamber.png");
this.pb.x = 99 + this.guiLeft;
this.pb.y = 36 + this.guiTop;
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,68 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.CommonButtons;
import appeng.container.implementations.WirelessContainer;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
public WirelessScreen(WirelessContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.ySize = 166;
}
@Override
public void init() {
super.init();
this.addButton(CommonButtons.togglePowerUnit(this.guiLeft - 18, this.guiTop + 8));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Wireless.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (container.getRange() > 0) {
final String firstMessage = GuiText.Range.getLocal() + ": " + (container.getRange() / 10.0) + " m";
final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": "
+ Platform.formatPowerLong(container.getDrain(), true);
final int strWidth = Math.max(this.font.getStringWidth(firstMessage),
this.font.getStringWidth(secondMessage));
final int cOffset = (this.xSize / 2) - (strWidth / 2);
this.font.drawString(firstMessage, cOffset, 20, 4210752);
this.font.drawString(secondMessage, cOffset, 20 + 12, 4210752);
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/wireless.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
}
@@ -1,34 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.container.implementations.MEPortableCellContainer;
// FIXME: Extended from GuiPortableCell before... Why?
public class WirelessTermScreen extends MEMonitorableScreen<MEPortableCellContainer> {
public WirelessTermScreen(MEPortableCellContainer container, PlayerInventory playerInventory,
Text title) {
super(container, playerInventory, title);
}
}