All GUI compile errors fixed, switched to excludes over includes in gradle build and lots, LOTS of more fixes.

This commit is contained in:
Sebastian Hartte
2020-06-06 21:16:05 +02:00
parent bb453b0d35
commit ff042a394b
209 changed files with 4527 additions and 4479 deletions
@@ -0,0 +1,100 @@
package appeng.client.gui.implementations;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingTerm;
import appeng.container.implementations.ContainerMEMonitorable;
import appeng.container.implementations.ContainerPatternTerm;
import appeng.container.implementations.ContainerWirelessTerm;
import appeng.core.Api;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.IPriorityHost;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import java.util.function.Consumer;
final class AESubGui {
private final AEBaseGui<?> gui;
private final ContainerType<?> originalGui;
private final ItemStack originalGuiIcon;
/**
* 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 AESubGui(AEBaseGui<?> gui, Object containerTarget) {
this.gui = gui;
final IDefinitions definitions = Api.INSTANCE.definitions();
final IParts parts = definitions.parts();
if (containerTarget instanceof IPriorityHost) {
IPriorityHost priorityHost = (IPriorityHost) containerTarget;
this.originalGuiIcon = priorityHost.getItemStackRepresentation();
this.originalGui = priorityHost.getContainerType();
}
else if( containerTarget instanceof WirelessTerminalGuiObject)
{
this.originalGuiIcon = definitions.items().wirelessTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = ContainerWirelessTerm.TYPE;
}
else if( containerTarget instanceof PartTerminal)
{
this.originalGuiIcon = parts.terminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = ContainerMEMonitorable.TYPE;
}
else if( containerTarget instanceof PartCraftingTerminal)
{
this.originalGuiIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = ContainerCraftingTerm.TYPE;
}
else if( containerTarget instanceof PartPatternTerminal)
{
this.originalGuiIcon = parts.patternTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = ContainerPatternTerm.TYPE;
}
else {
this.originalGuiIcon = null;
this.originalGui = null;
}
}
public final GuiTabButton addBackButton(Consumer<GuiTabButton> buttonAdder, int x, int y) {
return addBackButton(buttonAdder, x, y, null);
}
public final GuiTabButton addBackButton(Consumer<GuiTabButton> buttonAdder, int x, int y, @Nullable String label) {
if( this.originalGui != null && !originalGuiIcon.isEmpty() )
{
if (label == null) {
label = originalGuiIcon.getDisplayName().getString();
}
ItemRenderer itemRenderer = gui.getMinecraft().getItemRenderer();
GuiTabButton button = new GuiTabButton( gui.getGuiLeft() + x, gui.getGuiTop() + y, originalGuiIcon, label, itemRenderer, btn -> goBack() );
buttonAdder.accept(button);
return button;
}
return null;
}
public final void goBack() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
}
@@ -21,12 +21,10 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import appeng.api.implementations.IUpgradeableHost;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -43,7 +41,6 @@ import appeng.container.implementations.ContainerCellWorkbench;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
@@ -62,11 +59,11 @@ public class GuiCellWorkbench extends GuiUpgradeable<ContainerCellWorkbench>
@Override
protected void addButtons()
{
this.clear = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
this.partition = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
this.clear = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE, this::actionPerformed );
this.partition = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH, this::actionPerformed );
this.copyMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 48, 11 * 16 + 5, 12 * 16 + 5, GuiText.CopyMode.getLocal(), GuiText.CopyModeDesc
.getLocal() );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
.getLocal(), this::actionPerformed );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::actionPerformed );
this.addButton( this.fuzzyMode );
this.addButton( this.partition );
@@ -75,7 +72,7 @@ public class GuiCellWorkbench extends GuiUpgradeable<ContainerCellWorkbench>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.handleButtonVisibility();
@@ -86,7 +83,7 @@ public class GuiCellWorkbench extends GuiUpgradeable<ContainerCellWorkbench>
if( this.container.availableUpgrades() <= 8 )
{
GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.container.availableUpgrades() * 18, 0 /* FIXME this.zlevel was used */ );
GuiUtilsGuiUtils.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.container.availableUpgrades() ) * 18 ), 177, 151, 35, 7, 0 /* FIXME this.zlevel was used */ );
GuiUtils.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.container.availableUpgrades() ) * 18 ), 177, 151, 35, 7, 0 /* FIXME this.zlevel was used */ );
}
else if( this.container.availableUpgrades() <= 16 )
{
@@ -170,38 +167,32 @@ public class GuiCellWorkbench extends GuiUpgradeable<ContainerCellWorkbench>
}
@Override
protected void actionPerformed( final GuiButton btn )
protected void actionPerformed( final Button btn )
{
try
if( btn == this.copyMode )
{
if( btn == this.copyMode )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
else if( btn == this.partition )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if( btn == this.clear )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if( btn == this.fuzzyMode )
{
final boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) this.fuzzyMode.getCurrentValue();
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) );
}
else
{
super.actionPerformed( btn );
}
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
catch( final IOException ignored )
else if( btn == this.partition )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if( btn == this.clear )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if( btn == this.fuzzyMode )
{
final boolean backwards = minecraft.mouseHelper.isRightDown();
FuzzyMode fz = (FuzzyMode) this.fuzzyMode.getCurrentValue();
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
NetworkHandler.instance().sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) );
}
else
{
super.actionPerformed( btn );
}
}
}
@@ -19,9 +19,8 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import appeng.container.implementations.ContainerPriority;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.AEBaseGui;
@@ -31,7 +30,6 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileChest;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -46,14 +44,11 @@ public class GuiChest extends AEBaseGui<ContainerChest>
this.ySize = 166;
}
@Override
protected void actionPerformed( final GuiButton par1GuiButton ) throws IOException
protected void actionPerformed( final Button button )
{
super.actionPerformed( par1GuiButton );
if( par1GuiButton == this.priority )
if( button == this.priority )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( ContainerPriority.TYPE ) );
}
}
@@ -62,7 +57,7 @@ public class GuiChest extends AEBaseGui<ContainerChest>
{
super.init();
this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRenderer, this::actionPerformed ) );
}
@Override
@@ -73,7 +68,7 @@ public class GuiChest extends AEBaseGui<ContainerChest>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -19,13 +19,9 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.Settings;
@@ -37,7 +33,6 @@ import appeng.container.implementations.ContainerCondenser;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.misc.TileCondenser;
public class GuiCondenser extends AEBaseGui<ContainerCondenser>
@@ -51,19 +46,6 @@ public class GuiCondenser extends AEBaseGui<ContainerCondenser>
this.ySize = 197;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( this.mode == btn )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
}
}
@Override
public void init()
{
@@ -72,7 +54,10 @@ public class GuiCondenser extends AEBaseGui<ContainerCondenser>
this.pb = new GuiProgressBar( this.container, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy
.getLocal() );
this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.container.getOutput() );
this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.container.getOutput(), btn -> {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
} );
this.addButton( this.pb );
this.addButton( this.mode );
@@ -89,7 +74,7 @@ public class GuiCondenser extends AEBaseGui<ContainerCondenser>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.bindTexture( "guis/condenser.png" );
@@ -19,56 +19,31 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import appeng.core.Api;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.Reflected;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
{
private final AESubGui subGui;
private GuiNumberBox amountToCraft;
private GuiTabButton originalGuiBtn;
private GuiButton next;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
private GuiButton plus1000;
private GuiButton minus1;
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
private GuiBridge originalGui;
private Button next;
public GuiCraftAmount(ContainerCraftAmount container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.subGui = new AESubGui(this, container.getTarget());
}
@Override
@@ -81,52 +56,19 @@ public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
final int c = AEConfig.instance().craftItemsByStackAmounts( 2 );
final int d = AEConfig.instance().craftItemsByStackAmounts( 3 );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) );
this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) );
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( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) );
this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + 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.addButton( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
this.next = this.addButton(new Button(this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal(), this::confirm ));
ItemStack myIcon = null;
final Object target = this.container.getTarget();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IParts parts = definitions.parts();
if( target instanceof WirelessTerminalGuiObject )
{
myIcon = definitions.items().wirelessTerminal().maybeStack( 1 ).orElse( myIcon );
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if( target instanceof PartTerminal )
{
myIcon = parts.terminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_ME;
}
if( target instanceof PartCraftingTerminal )
{
myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if( target instanceof PartPatternTerminal )
{
myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if( this.originalGui != null && !myIcon.isEmpty() )
{
this.addButton( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
}
subGui.addBackButton(this::addButton, 154, 0);
this.amountToCraft = new GuiNumberBox( this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT, Integer.class );
this.amountToCraft.setEnableBackgroundDrawing( false );
@@ -137,6 +79,10 @@ public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
this.amountToCraft.setText( "1" );
}
private void confirm(Button button) {
NetworkHandler.instance().sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), hasShiftDown() ) );
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
@@ -144,9 +90,9 @@ public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.next.displayString = hasShiftDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
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, 0 /* FIXME this.zlevel was used */ );
@@ -154,27 +100,32 @@ public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
try
{
Long.parseLong( this.amountToCraft.getText() );
this.next.enabled = !this.amountToCraft.getText().isEmpty();
this.next.active = !this.amountToCraft.getText().isEmpty();
}
catch( final NumberFormatException e )
{
this.next.enabled = false;
this.next.active = false;
}
this.amountToCraft.drawTextBox();
this.amountToCraft.render(offsetX, offsetY, partialTicks);
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
{
if( !this.checkHotbarKeys( key ) )
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( key == 28 )
if( keyCode == 28 )
{
this.actionPerformed( this.next );
this.next.onPress();
}
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.amountToCraft
.textboxKeyTyped( character, key ) )
if( ( keyCode == 211 || keyCode == 205 || keyCode == 203 || keyCode == 14 )
&& this.amountToCraft.keyPressed( keyCode, scanCode, p_keyPressed_3_ ) )
{
try
{
@@ -207,45 +158,11 @@ public class GuiCraftAmount extends AEBaseGui<ContainerCraftAmount>
{
// :P
}
}
else
{
super.keyTyped( character, key );
return true;
}
}
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
try
{
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if( btn == this.next )
{
NetworkHandler.instance().sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), hasShiftDown() ) );
}
}
catch( final NumberFormatException e )
{
// nope..
this.amountToCraft.setText( "1" );
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
{
this.addQty( this.getQty( btn ) );
}
return super.keyPressed( keyCode, scanCode, p_keyPressed_3_ );
}
private void addQty( final int i )
@@ -19,26 +19,6 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import appeng.core.Api;
import com.google.common.base.Joiner;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -46,21 +26,32 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
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.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
{
private final AESubGui subGui;
private final int rows = 5;
private final IItemList<IAEItemStack> storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
@@ -69,45 +60,24 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
private final List<IAEItemStack> visual = new ArrayList<>();
private GuiBridge OriginalGui;
private GuiButton cancel;
private GuiButton start;
private GuiButton selectCPU;
private Button cancel;
private Button start;
private Button selectCPU;
private int tooltip = -1;
public GuiCraftConfirm(ContainerCraftConfirm container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.subGui = new AESubGui(this, container.getTarget());
this.xSize = 238;
this.ySize = 206;
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar( scrollbar );
Object te = container.getTarget();
if( te instanceof WirelessTerminalGuiObject )
{
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if( te instanceof PartTerminal )
{
this.OriginalGui = GuiBridge.GUI_ME;
}
if( te instanceof PartCraftingTerminal )
{
this.OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if( te instanceof PartPatternTerminal )
{
this.OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
}
boolean isAutoStart()
{
return ( (ContainerCraftConfirm) this.container ).isAutoStart();
return this.container.isAutoStart();
}
@Override
@@ -115,30 +85,26 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
{
super.init();
this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() );
this.start.enabled = false;
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 GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU
.getLocal() + ": " + GuiText.Automatic );
this.selectCPU.enabled = false;
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 );
if( this.OriginalGui != null )
{
this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
}
subGui.addBackButton(this::addButton, 6, this.ySize - 25, GuiText.Cancel.getLocal());
this.addButton( this.cancel );
}
@Override
public void render(final int mouseX, final int mouseY, final float btn )
{
this.updateCPUButtonText();
this.start.enabled = !( this.container.hasNoCPU() || this.isSimulation() );
this.selectCPU.enabled = !this.isSimulation();
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;
@@ -195,12 +161,12 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
btnTextText = GuiText.NoCraftingCPUs.getLocal();
}
this.selectCPU.displayString = btnTextText;
this.selectCPU.setMessage(btnTextText);
}
private boolean isSimulation()
{
return ( (ContainerCraftConfirm) this.container ).isSimulation();
return this.container.isSimulation();
}
@Override
@@ -247,8 +213,8 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
final IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if( refStack != null )
{
GlStateManager.pushMatrix();
GlStateManager.scale( 0.5, 0.5, 0.5 );
RenderSystem.pushMatrix();
RenderSystem.scalef( 0.5f, 0.5f, 0.5f );
final IAEItemStack stored = this.storage.findPrecise( refStack );
final IAEItemStack pendingStack = this.pending.findPrecise( refStack );
@@ -347,7 +313,7 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
}
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
final int posY = y * offY + yo;
@@ -355,7 +321,7 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( refStack );
dspToolTip = Platform.getItemDisplayName( refStack ).getFormattedText();
if( lineList.size() > 0 )
{
@@ -392,7 +358,7 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.setScrollBar();
this.bindTexture( "guis/craftingreport.png" );
@@ -533,52 +499,25 @@ public class GuiCraftConfirm extends AEBaseGui<ContainerCraftConfirm>
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
{
if( !this.checkHotbarKeys( key ) )
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_) {
if( !this.checkHotbarKeys( InputMappings.getInputByCode(keyCode, scanCode) ) )
{
if( key == 28 )
if( keyCode == 28 )
{
this.actionPerformed( this.start );
this.start();
return true;
}
super.keyTyped( character, key );
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
if( btn == this.cancel )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
if( btn == this.start )
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
catch( final Throwable e )
{
AELog.debug( e );
}
}
private void selectNextCpu() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
private void start() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
}
@@ -19,24 +19,6 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import appeng.core.Api;
import com.google.common.base.Joiner;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
@@ -50,11 +32,26 @@ import appeng.client.gui.widgets.ISortSource;
import appeng.container.implementations.ContainerCraftingCPU;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements ISortSource
@@ -89,7 +86,7 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
private IItemList<IAEItemStack> pending = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private List<IAEItemStack> visual = new ArrayList<>();
private GuiButton cancel;
private Button cancel;
private int tooltip = -1;
public GuiCraftingCPU(ContainerCraftingCPU container, PlayerInventory playerInventory, ITextComponent title) {
@@ -109,22 +106,8 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
this.visual = new ArrayList<>();
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
if( this.cancel == btn )
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
private void cancel() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
}
@Override
@@ -132,8 +115,8 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
{
super.init();
this.setScrollBar();
this.cancel = new GuiButton( 0, this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET, CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel
.getLocal() );
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 );
}
@@ -148,7 +131,7 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
@Override
public void render(final int mouseX, final int mouseY, final float btn )
{
this.cancel.enabled = !this.visual.isEmpty();
this.cancel.active = !this.visual.isEmpty();
final int gx = ( this.width - this.xSize ) / 2;
final int gy = ( this.height - this.ySize ) / 2;
@@ -216,8 +199,8 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
final IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if( refStack != null )
{
GlStateManager.pushMatrix();
GlStateManager.scale( 0.5, 0.5, 0.5 );
RenderSystem.pushMatrix();
RenderSystem.scalef( 0.5f, 0.5f, 0.5f );
final IAEItemStack stored = this.storage.findPrecise( refStack );
final IAEItemStack activeStack = this.active.findPrecise( refStack );
@@ -298,7 +281,7 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
}
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
@@ -306,7 +289,7 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( refStack );
dspToolTip = Platform.getItemDisplayName( refStack ).getFormattedText();
if( lineList.size() > 0 )
{
@@ -336,7 +319,7 @@ public class GuiCraftingCPU extends AEBaseGui<ContainerCraftingCPU> implements I
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -23,102 +23,31 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import appeng.container.implementations.ContainerCraftingCPU;
import appeng.core.Api;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import java.io.IOException;
public class GuiCraftingStatus extends GuiCraftingCPU
{
private GuiButton selectCPU;
private final ContainerCraftingStatus craftingStatus;
private GuiTabButton originalGuiBtn;
private GuiBridge originalGui;
private ItemStack myIcon = ItemStack.EMPTY;
private final AESubGui subGui;
public GuiCraftingStatus(ContainerCraftingCPU container, PlayerInventory playerInventory, ITextComponent title) {
private Button selectCPU;
public GuiCraftingStatus(ContainerCraftingStatus container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
final Object target = this.container.getTarget();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IParts parts = definitions.parts();
if( target instanceof WirelessTerminalGuiObject )
{
this.myIcon = definitions.items().wirelessTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if( target instanceof PartTerminal )
{
this.myIcon = parts.terminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_ME;
}
if( target instanceof PartCraftingTerminal )
{
this.myIcon = parts.craftingTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if( target instanceof PartPatternTerminal )
{
this.myIcon = parts.patternTerminal().maybeStack( 1 ).orElse( ItemStack.EMPTY );
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
this.craftingStatus = container;
this.subGui = new AESubGui(this, container.getTarget());
}
@Override
@@ -126,17 +55,14 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
super.init();
this.selectCPU = new GuiButton( 0, this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20, GuiText.CraftingCPU
.getLocal() + ": " + GuiText.NoCraftingCPUs );
// selectCPU.enabled = false;
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 );
if( !this.myIcon.isEmpty() )
{
this.addButton(
this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), this.itemRender ) );
this.originalGuiBtn.setHideEdge( 13 );
}
subGui.addBackButton(btn -> {
addButton(btn);
btn.setHideEdge( 13 );
}, 213, -4);
}
@Override
@@ -150,25 +76,25 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if( this.container.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
if( this.craftingStatus.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if( this.container.myName.length() > 0 )
if( this.craftingStatus.myName.length() > 0 )
{
final String name = this.container.myName.substring( 0, Math.min( 20, this.container.myName.length() ) );
final String name = this.craftingStatus.myName.substring( 0, Math.min( 20, this.craftingStatus.myName.length() ) );
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
}
else
{
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.container.selectedCpu;
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.craftingStatus.selectedCpu;
}
}
if( this.container.noCPU )
if( this.craftingStatus.noCPU )
{
btnTextText = GuiText.NoCraftingJobs.getLocal();
}
this.selectCPU.displayString = btnTextText;
this.selectCPU.setMessage(btnTextText);
}
@Override
@@ -176,4 +102,11 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
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 PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
}
@@ -19,14 +19,10 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerCraftingTerm;
import appeng.container.slot.SlotCraftingMatrix;
@@ -41,34 +37,25 @@ import net.minecraft.util.text.ITextComponent;
public class GuiCraftingTerm extends GuiMEMonitorable<ContainerCraftingTerm>
{
private GuiImgButton clearBtn;
public GuiCraftingTerm(ContainerCraftingTerm container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.setReservedSpace( 73 );
}
@Override
protected void actionPerformed( final GuiButton btn )
{
super.actionPerformed( btn );
if( this.clearBtn == btn )
private void clear() {
Slot s = null;
for( final Object j : this.container.inventorySlots )
{
Slot s = null;
for( final Object j : this.container.inventorySlots )
if( j instanceof SlotCraftingMatrix )
{
if( j instanceof SlotCraftingMatrix )
{
s = (Slot) j;
}
s = (Slot) j;
}
}
if( s != null )
{
final PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance().sendToServer( p );
}
if( s != null )
{
final PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance().sendToServer( p );
}
}
@@ -76,8 +63,8 @@ public class GuiCraftingTerm extends GuiMEMonitorable<ContainerCraftingTerm>
public void init()
{
super.init();
this.addButton( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
this.clearBtn.setHalfSize( true );
GuiImgButton clearBtn = this.addButton( new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH, btn -> clear() ));
clearBtn.setHalfSize( true );
}
@Override
@@ -19,19 +19,14 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerPriority;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileDrive;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -39,30 +34,21 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiDrive extends AEBaseGui<ContainerDrive>
{
private GuiTabButton priority;
public GuiDrive(ContainerDrive container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.ySize = 199;
}
@Override
protected void actionPerformed( final GuiButton par1GuiButton ) throws IOException
{
super.actionPerformed( par1GuiButton );
if( par1GuiButton == this.priority )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
}
@Override
public void init()
{
super.init();
this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.addButton( new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRenderer, btn -> openPriorityGui() ) );
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( ContainerPriority.TYPE ) );
}
@Override
@@ -73,7 +59,7 @@ public class GuiDrive extends AEBaseGui<ContainerDrive>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -19,32 +19,24 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerFormationPlane;
import appeng.container.implementations.ContainerPriority;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.parts.automation.PartFormationPlane;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class GuiFormationPlane extends GuiUpgradeable<ContainerFormationPlane>
{
private GuiTabButton priority;
private GuiImgButton placeMode;
public GuiFormationPlane(ContainerFormationPlane container, PlayerInventory playerInventory, ITextComponent title) {
@@ -55,10 +47,10 @@ public class GuiFormationPlane extends GuiUpgradeable<ContainerFormationPlane>
@Override
protected void addButtons()
{
this.placeMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK, YesNo.YES );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.placeMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK, YesNo.YES, btn -> selectNextPlaceMode() );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::actionPerformed );
this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.addButton( new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRenderer, btn -> openPriorityGui() ) );
this.addButton( this.placeMode );
this.addButton( this.fuzzyMode );
@@ -87,20 +79,13 @@ public class GuiFormationPlane extends GuiUpgradeable<ContainerFormationPlane>
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if( btn == this.placeMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( ContainerPriority.TYPE ) );
}
private void selectNextPlaceMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
}
@@ -24,7 +24,6 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerGrinder;
import appeng.core.localization.GuiText;
import appeng.tile.grindstone.TileGrinder;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -45,7 +44,7 @@ public class GuiGrinder extends AEBaseGui<ContainerGrinder>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -19,16 +19,6 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import appeng.core.Api;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.AEApi;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
@@ -36,10 +26,12 @@ import appeng.api.config.Settings;
import appeng.api.definitions.IDefinitions;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerIOPort;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.storage.TileIOPort;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class GuiIOPort extends GuiUpgradeable<ContainerIOPort>
@@ -56,9 +48,9 @@ public class GuiIOPort extends GuiUpgradeable<ContainerIOPort>
@Override
protected void addButtons()
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.fullMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY );
this.operationMode = new GuiImgButton( this.guiLeft + 80, this.guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, this::actionPerformed);
this.fullMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY, btn -> selectNextFullMode() );
this.operationMode = new GuiImgButton( this.guiLeft + 80, this.guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY, btn -> selectNextOperationMode() );
this.addButton( this.operationMode );
this.addButton( this.redstoneMode );
@@ -88,9 +80,9 @@ public class GuiIOPort extends GuiUpgradeable<ContainerIOPort>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
super.drawBG( offsetX, offsetY, mouseX, mouseY, partialTicks);
final IDefinitions definitions = Api.INSTANCE.definitions();
@@ -105,21 +97,14 @@ public class GuiIOPort extends GuiUpgradeable<ContainerIOPort>
return "guis/io_port.png";
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.fullMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
}
if( btn == this.operationMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
}
private void selectNextFullMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
}
private void selectNextOperationMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
}
}
@@ -25,9 +25,7 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiProgressBar;
import appeng.client.gui.widgets.GuiProgressBar.Direction;
import appeng.container.implementations.ContainerInscriber;
import appeng.container.implementations.ContainerUpgradeable;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileInscriber;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -67,7 +65,7 @@ public class GuiInscriber extends AEBaseGui<ContainerInscriber>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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;
@@ -19,33 +19,25 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerInterface;
import appeng.container.implementations.ContainerPriority;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.IInterfaceHost;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class GuiInterface extends GuiUpgradeable<ContainerInterface>
{
private GuiTabButton priority;
private GuiImgButton BlockMode;
private GuiImgButton blockMode;
private GuiToggleButton interfaceMode;
public GuiInterface(ContainerInterface container, PlayerInventory playerInventory, ITextComponent title) {
@@ -56,23 +48,22 @@ public class GuiInterface extends GuiUpgradeable<ContainerInterface>
@Override
protected void addButtons()
{
this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender );
this.addButton( this.priority );
this.addButton( new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRenderer, btn -> openPriorityGui() ) );
this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO );
this.addButton( this.BlockMode );
this.blockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO, btn -> selectNextBlockMode() );
this.addButton( this.blockMode);
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal
.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
.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 )
if( this.blockMode != null )
{
this.BlockMode.set( ( (ContainerInterface) this.cvb ).getBlockingMode() );
this.blockMode.set( ( (ContainerInterface) this.cvb ).getBlockingMode() );
}
if( this.interfaceMode != null )
@@ -95,26 +86,18 @@ public class GuiInterface extends GuiUpgradeable<ContainerInterface>
return "guis/interface.png";
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
if( btn == this.interfaceMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
}
if( btn == this.BlockMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( ContainerPriority.TYPE ) );
}
private void selectNextBlockMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.blockMode.getSetting(), backwards ) );
}
private void selectNextInterfaceMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
}
}
@@ -19,27 +19,6 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
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.renderer.GlStateManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -47,12 +26,21 @@ import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.me.ClientDCInternalInv;
import appeng.client.me.SlotDisconnected;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.util.Platform;
import com.google.common.collect.HashMultimap;
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.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.util.*;
public class GuiInterfaceTerminal extends AEBaseGui<ContainerInterfaceTerminal>
{
@@ -147,21 +135,21 @@ public class GuiInterfaceTerminal extends AEBaseGui<ContainerInterfaceTerminal>
}
@Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
public boolean mouseClicked( final double xCoord, final double yCoord, final int btn )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.refreshList();
if (this.searchField.mouseClicked( xCoord, yCoord, btn )) {
if (btn == 1 && this.searchField.isMouseOver(xCoord, yCoord)) {
this.searchField.setText("");
this.refreshList();
}
return true;
}
super.mouseClicked( xCoord, yCoord, btn );
return super.mouseClicked( xCoord, yCoord, btn );
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -185,29 +173,22 @@ public class GuiInterfaceTerminal extends AEBaseGui<ContainerInterfaceTerminal>
if( this.searchField != null )
{
this.searchField.drawTextBox();
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
{
if( !this.checkHotbarKeys( key ) )
public boolean charTyped(char character, int key) {
if( character == ' ' && this.searchField.getText().isEmpty() )
{
if( character == ' ' && this.searchField.getText().isEmpty() )
{
return;
}
if( this.searchField.textboxKeyTyped( character, key ) )
{
this.refreshList();
}
else
{
super.keyTyped( character, key );
}
return true;
}
if( this.searchField.charTyped( character, key ) )
{
this.refreshList();
return true;
}
return false;
}
public void postUpdate( final CompoundNBT in )
@@ -341,16 +322,17 @@ public class GuiInterfaceTerminal extends AEBaseGui<ContainerInterfaceTerminal>
// Potential later use to filter by input
// ListNBT inTag = encodedValue.getTagList( "in", 10 );
final ListNBT outTag = encodedValue.getTagList( "out", 10 );
final ListNBT outTag = encodedValue.getList( "out", 10 );
for( int i = 0; i < outTag.tagCount(); i++ )
for( int i = 0; i < outTag.size(); i++ )
{
final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) );
final ItemStack parsedItemStack = ItemStack.read( outTag.getCompound( i ) );
if( !parsedItemStack.isEmpty() )
{
final String displayName = Platform
.getItemDisplayName( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
.getString()
.toLowerCase();
if( displayName.contains( searchTerm ) )
{
@@ -21,10 +21,10 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.FuzzyMode;
@@ -42,7 +42,6 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.automation.PartLevelEmitter;
public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
@@ -50,14 +49,14 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
private GuiNumberBox level;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
private GuiButton plus1000;
private GuiButton minus1;
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
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 GuiImgButton levelMode;
private GuiImgButton craftingMode;
@@ -83,25 +82,25 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
@Override
protected void addButtons()
{
this.levelMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.craftingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_VIA_REDSTONE, YesNo.NO );
this.levelMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, btn -> selectNextLevelMode() );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL, this::actionPerformed );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::actionPerformed );
this.craftingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_VIA_REDSTONE, YesNo.NO, btn -> selectNextCraftingMode() );
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 GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
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 GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + 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 );
@@ -116,22 +115,22 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
// configure enabled status...
this.level.setEnabled( notCraftingMode );
this.plus1.enabled = notCraftingMode;
this.plus10.enabled = notCraftingMode;
this.plus100.enabled = notCraftingMode;
this.plus1000.enabled = notCraftingMode;
this.minus1.enabled = notCraftingMode;
this.minus10.enabled = notCraftingMode;
this.minus100.enabled = notCraftingMode;
this.minus1000.enabled = notCraftingMode;
this.levelMode.enabled = notCraftingMode;
this.redstoneMode.enabled = 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( ( (ContainerLevelEmitter) this.cvb ).getCraftingMode() );
this.craftingMode.set( this.cvb.getCraftingMode() );
}
if( this.levelMode != null )
@@ -141,10 +140,10 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.level.drawTextBox();
super.drawBG( offsetX, offsetY, mouseX, mouseY, partialTicks);
this.level.render(mouseX, mouseY, partialTicks);
}
@Override
@@ -166,30 +165,14 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
return GuiText.LevelEmitter;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
private void selectNextCraftingMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
}
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.craftingMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
}
if( btn == this.levelMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
{
this.addQty( this.getQty( btn ) );
}
private void selectNextLevelMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
}
private void addQty( final long i )
@@ -231,51 +214,45 @@ public class GuiLevelEmitter extends GuiUpgradeable<ContainerLevelEmitter>
// nope..
this.level.setText( "0" );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
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( key ) )
if( !this.checkHotbarKeys( InputMappings.getInputByCode(keyCode, scanCode) ) )
{
if( ( key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit( character ) ) && this.level.textboxKeyTyped( character, key ) )
if( keyCode == 211 || keyCode == 205 || keyCode == 203 || keyCode == 14 )
{
try
String Out = this.level.getText();
boolean Fixed = false;
while( Out.startsWith( "0" ) && Out.length() > 1 )
{
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 PacketValueConfig( "LevelEmitter.Value", Out ) );
Out = Out.substring( 1 );
Fixed = true;
}
catch( final IOException e )
if( Fixed )
{
AELog.debug( e );
this.level.setText( Out );
}
}
else
{
super.keyTyped( character, key );
if( Out.isEmpty() )
{
Out = "0";
}
NetworkHandler.instance().sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
return true;
}
}
return super.keyPressed( keyCode, scanCode, p_keyPressed_3_ );
}
}
@@ -28,7 +28,6 @@ import appeng.client.gui.widgets.GuiProgressBar;
import appeng.client.gui.widgets.GuiProgressBar.Direction;
import appeng.container.implementations.ContainerMAC;
import appeng.core.localization.GuiText;
import appeng.tile.crafting.TileMolecularAssembler;
import net.minecraft.util.text.ITextComponent;
@@ -54,7 +53,7 @@ public class GuiMAC extends GuiUpgradeable<ContainerMAC>
@Override
protected void addButtons()
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, this::actionPerformed );
this.addButton( this.redstoneMode );
}
@@ -66,11 +65,11 @@ public class GuiMAC extends GuiUpgradeable<ContainerMAC>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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 );
super.drawBG( offsetX, offsetY, mouseX, mouseY, partialTicks);
}
@Override
@@ -22,14 +22,14 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
import appeng.container.implementations.ContainerCraftingStatus;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.inventory.container.Slot;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.config.SearchBoxMode;
@@ -38,7 +38,6 @@ import appeng.api.config.TerminalStyle;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IMEChest;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
@@ -64,11 +63,11 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.Integrations;
import appeng.parts.reporting.AbstractPartTerminal;
import appeng.tile.misc.TileSecurityStation;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import org.lwjgl.glfw.GLFW;
public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseMEGui<T> implements ISortSource, IConfigManagerHost
@@ -164,17 +163,15 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
this.getScrollBar().setRange( 0, ( this.repo.size() + this.perRow - 1 ) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) );
}
@Override
protected void actionPerformed( final GuiButton btn )
{
if( btn == this.craftingStatusBtn )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
}
private void showCraftingStatus() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis(ContainerCraftingStatus.TYPE) );
}
protected void actionPerformed( final Button btn )
{
if( btn instanceof GuiImgButton )
{
final boolean backwards = Mouse.isButtonDown( 1 );
final boolean backwards = minecraft.mouseHelper.isRightDown();
final GuiImgButton iBtn = (GuiImgButton) btn;
if( iBtn.getSetting() != Settings.ACTIONS )
@@ -192,14 +189,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
}
else
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
NetworkHandler.instance().sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
}
iBtn.set( next );
@@ -221,7 +211,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
@Override
public void init()
{
Keyboard.enableRepeatEvents( true );
minecraft.keyboardListener.enableRepeatEvents( true );
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance()
@@ -275,27 +265,25 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
if( this.customSortOrder )
{
this.buttonList
.add( this.SortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) );
this.SortByBox = this.addButton( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ), this::actionPerformed ) );
offset += 20;
}
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.buttonList
.add( this.ViewBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting( Settings.VIEW_MODE ) ) );
this.ViewBox = this.addButton( new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting( Settings.VIEW_MODE ), this::actionPerformed ) );
offset += 20;
}
this.addButton( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
.getSetting( Settings.SORT_DIRECTION ) ) );
.getSetting( Settings.SORT_DIRECTION ), this::actionPerformed ) );
offset += 20;
this.addButton(
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
.getConfigManager()
.getSetting(
Settings.SEARCH_MODE ) ) );
Settings.SEARCH_MODE ), this::actionPerformed ) );
offset += 20;
@@ -303,7 +291,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
{
this.addButton( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance()
.getConfigManager()
.getSetting( Settings.TERMINAL_STYLE ) ) );
.getSetting( Settings.TERMINAL_STYLE ), this::actionPerformed ) );
}
this.searchField = new MEGuiTextField( this.font, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
@@ -315,8 +303,8 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.addButton( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus
.getLocal(), this.itemRender ) );
this.craftingStatusBtn = this.addButton( new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus
.getLocal(), this.itemRenderer, btn -> showCraftingStatus() ) );
this.craftingStatusBtn.setHideEdge( 13 );
}
@@ -326,11 +314,11 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting;
this.searchField.setFocused( this.isAutoFocus );
this.searchField.setFocused2( this.isAutoFocus );
if( isJEIEnabled )
{
memoryText = Integrations.jei().getSearchText();
memoryText = null; // FIXME Integrations.jei().getSearchText();
}
if( isKeepFilter && memoryText != null && !memoryText.isEmpty() )
@@ -382,31 +370,31 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
}
@Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
public boolean mouseClicked( final double xCoord, final double yCoord, final int btn )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.repo.setSearchString( "" );
this.repo.updateView();
this.setScrollBar();
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;
}
super.mouseClicked( xCoord, yCoord, btn );
return super.mouseClicked( xCoord, yCoord, btn );
}
@Override
public void removed()
{
super.removed();
Keyboard.enableRepeatEvents( false );
minecraft.keyboardListener.enableRepeatEvents( false );
memoryText = this.searchField.getText();
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.bindTexture( this.getBackground() );
@@ -447,7 +435,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
if( this.searchField != null )
{
this.searchField.drawTextBox();
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
@@ -469,59 +457,71 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
protected void repositionSlot( final AppEngSlot s )
{
s.yPos = s.getY() + this.ySize - 78 - 5;
// FIXME .... it's final now, WHAT DO WE DO ARGH
// s.yPos = s.getY() + this.ySize - 78 - 5;
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
public boolean charTyped(char character, int p_charTyped_2_) {
if( character == ' ' && this.searchField.getText().isEmpty() )
{
return true;
}
final boolean mouseInGui = this.isMouseOver( this.currentMouseX, this.currentMouseY );
if( this.isAutoFocus && !this.searchField.isFocused() && mouseInGui )
{
this.searchField.setFocused2( true );
}
if (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_)
{
if( !this.checkHotbarKeys( key ) )
InputMappings.Input input = InputMappings.getInputByCode(keyCode, scanCode);
if( !this.checkHotbarKeys(input) )
{
if( AppEng.proxy.isActionKey( ActionKey.TOGGLE_FOCUS, key ) )
if( AppEng.proxy.isActionKey( ActionKey.TOGGLE_FOCUS, input ) )
{
this.searchField.setFocused( !this.searchField.isFocused() );
return;
this.searchField.setFocused2( !this.searchField.isFocused() );
return true;
}
if( this.searchField.isFocused() && key == Keyboard.KEY_RETURN )
if( this.searchField.isFocused() && keyCode == GLFW.GLFW_KEY_ENTER )
{
this.searchField.setFocused( false );
return;
this.searchField.setFocused2( false );
return true;
}
if( character == ' ' && this.searchField.getText().isEmpty() )
{
return;
}
final boolean mouseInGui = this.isPointInRegion( 0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY );
if( this.isAutoFocus && !this.searchField.isFocused() && mouseInGui )
{
this.searchField.setFocused( true );
}
if( this.searchField.textboxKeyTyped( character, key ) )
if( this.searchField.keyPressed( keyCode, scanCode, p_keyPressed_3_ ) )
{
this.repo.setSearchString( this.searchField.getText() );
this.repo.updateView();
this.setScrollBar();
// tell forge the key event is handled and should not be sent out
this.keyHandled = mouseInGui;
}
else
{
super.keyTyped( character, key );
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
@Override
public void updateScreen()
public void tick()
{
this.repo.setPower( this.container.isPowered() );
super.updateScreen();
super.tick();
}
@Override
@@ -19,25 +19,10 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
@@ -49,6 +34,14 @@ import appeng.container.implementations.ContainerNetworkStatus;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
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.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.util.List;
public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implements ISortSource
@@ -70,29 +63,21 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
this.repo.setRowSize( 5 );
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.units )
{
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
}
@Override
public void init()
{
super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit(), btn -> selectNextUnit() );
this.addButton( this.units );
}
private void selectNextUnit() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
@Override
public void render(final int mouseX, final int mouseY, final float btn )
{
@@ -160,8 +145,8 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
final IAEItemStack refStack = this.repo.getReferenceItem( z );
if( refStack != null )
{
GlStateManager.pushMatrix();
GlStateManager.scale( 0.5, 0.5, 0.5 );
RenderSystem.pushMatrix();
RenderSystem.scalef( 0.5f, 0.5f, 0.5f );
String str = Long.toString( refStack.getStackSize() );
if( refStack.getStackSize() >= 10000 )
@@ -173,13 +158,13 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
this.font.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2,
4210752 );
GlStateManager.popMatrix();
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 );
toolTip = Platform.getItemDisplayName( refStack ).getFormattedText();
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
if( refStack.getCountRequestable() > 0 )
@@ -210,7 +195,7 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -237,11 +222,11 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
}
@Override
protected void renderToolTip( final ItemStack stack, final int x, final int y )
protected void renderTooltip( final ItemStack stack, final int x, final int y )
{
final Slot s = this.getSlot( x, y );
if( s instanceof SlotME && stack != null )
if( s instanceof SlotME && !stack.isEmpty() )
{
IAEItemStack myStack = null;
@@ -256,8 +241,7 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
if( myStack != null )
{
ITooltipFlag.TooltipFlags tooltipFlag = this.minecraft.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
List<String> currentToolTip = stack.getTooltip( this.minecraft.player, tooltipFlag );
List<String> currentToolTip = getTooltipFromItem(stack);
while( currentToolTip.size() > 1 )
{
@@ -271,7 +255,7 @@ public class GuiNetworkStatus extends AEBaseGui<ContainerNetworkStatus> implemen
}
}
super.renderToolTip( stack, x, y );
super.renderTooltip( stack, x, y );
}
@Override
@@ -19,19 +19,13 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerNetworkTool;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -46,35 +40,21 @@ public class GuiNetworkTool extends AEBaseGui<ContainerNetworkTool>
this.ySize = 166;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
try
{
if( btn == this.tFacades )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "NetworkTool", "Toggle" ) );
}
}
catch( final IOException e )
{
AELog.debug( e );
}
}
@Override
public void init()
{
super.init();
this.tFacades = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 8, 23, 22, GuiText.TransparentFacades.getLocal(), GuiText.TransparentFacadesHint
.getLocal() );
.getLocal(), btn -> toggleFacades() );
this.addButton( this.tFacades );
}
private void toggleFacades() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "NetworkTool", "Toggle" ) );
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
@@ -88,7 +68,7 @@ public class GuiNetworkTool extends AEBaseGui<ContainerNetworkTool>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -19,25 +19,19 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerPatternTerm;
import appeng.container.slot.AppEngSlot;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
@@ -57,79 +51,55 @@ public class GuiPatternTerm extends GuiMEMonitorable<ContainerPatternTerm>
private GuiTabButton tabProcessButton;
private GuiImgButton substitutionsEnabledBtn;
private GuiImgButton substitutionsDisabledBtn;
private GuiImgButton encodeBtn;
private GuiImgButton clearBtn;
public GuiPatternTerm(ContainerPatternTerm container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.setReservedSpace( 81 );
}
@Override
protected void actionPerformed( final GuiButton btn )
{
super.actionPerformed( btn );
try
{
if( this.tabCraftButton == btn || this.tabProcessButton == btn )
{
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) );
}
if( this.encodeBtn == btn )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.Encode", "1" ) );
}
if( this.clearBtn == btn )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.Clear", "1" ) );
}
if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
{
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
}
}
catch( final IOException e )
{
AELog.error( e );
}
}
@Override
public void init()
{
super.init();
this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.CRAFTING_TABLE ), GuiText.CraftingPattern
.getLocal(), this.itemRender );
.getLocal(), this.itemRenderer, btn -> toggleCraftMode(CRAFTMODE_PROCESSING) );
this.addButton( this.tabCraftButton );
this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.FURNACE ), GuiText.ProcessingPattern
.getLocal(), this.itemRender );
.getLocal(), this.itemRenderer, btn -> toggleCraftMode(CRAFTMODE_CRFTING) );
this.addButton( this.tabProcessButton );
this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED );
this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED, btn -> toggleSubstitutions(SUBSITUTION_DISABLE) );
this.substitutionsEnabledBtn.setHalfSize( true );
this.addButton( this.substitutionsEnabledBtn );
this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED );
this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED, btn -> toggleSubstitutions(SUBSITUTION_ENABLE) );
this.substitutionsDisabledBtn.setHalfSize( true );
this.addButton( this.substitutionsDisabledBtn );
this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE );
this.clearBtn.setHalfSize( true );
this.addButton( this.clearBtn );
GuiImgButton clearBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE, btn -> clear());
clearBtn.setHalfSize( true );
this.addButton(clearBtn);
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
this.addButton( this.encodeBtn );
GuiImgButton encodeBtn = new GuiImgButton(this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE, btn -> encode());
this.addButton(encodeBtn);
}
private void toggleCraftMode(String mode) {
NetworkHandler.instance().sendToServer(new PacketValueConfig( "PatternTerminal.CraftMode", mode ) );
}
private void toggleSubstitutions(String mode) {
NetworkHandler.instance().sendToServer(new PacketValueConfig( "PatternTerminal.Substitute", mode ) );
}
private void encode() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.Encode", "1" ) );
}
private void clear() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.Clear", "1" ) );
}
@Override
@@ -179,6 +149,6 @@ public class GuiPatternTerm extends GuiMEMonitorable<ContainerPatternTerm>
{
final int offsetPlayerSide = s.isPlayerSide() ? 5 : 3;
s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
// FIXME OH NOOOOO WE CANNOT, ITS FINAL s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
}
}
@@ -19,47 +19,33 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerPriority;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IPriorityHost;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.io.IOException;
public class GuiPriority extends AEBaseGui<ContainerPriority>
{
private final AESubGui subGui;
private GuiNumberBox priority;
private GuiTabButton originalGuiBtn;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
private GuiButton plus1000;
private GuiButton minus1;
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
private GuiBridge OriginalGui;
public GuiPriority(ContainerPriority container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.subGui = new AESubGui(this, container.getPriorityHost());
}
@Override
@@ -72,23 +58,17 @@ public class GuiPriority extends AEBaseGui<ContainerPriority>
final int c = AEConfig.instance().priorityByStacksAmounts( 2 );
final int d = AEConfig.instance().priorityByStacksAmounts( 3 );
this.addButton( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
this.addButton( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
this.addButton( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
this.addButton( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
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( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
this.addButton( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
this.addButton( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
this.addButton( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + 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) ) );
final ItemStack myIcon = container.getPriorityHost().getItemStackRepresentation();
this.OriginalGui = container.getPriorityHost().getGuiBridge();
if( this.OriginalGui != null && !myIcon.isEmpty() )
{
this.addButton( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
}
this.subGui.addBackButton(this::addButton, 154, 0);
this.priority = new GuiNumberBox( this.font, this.guiLeft + 62, this.guiTop + 57, 59, this.font.FONT_HEIGHT, Long.class );
this.priority.setEnableBackgroundDrawing( false );
@@ -106,31 +86,12 @@ public class GuiPriority extends AEBaseGui<ContainerPriority>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.bindTexture( "guis/priority.png" );
GuiUtils.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0 /* FIXME this.zlevel was used */ );
this.priority.drawTextBox();
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
{
this.addQty( this.getQty( btn ) );
}
this.priority.render(mouseX, mouseY, partialTicks);
}
private void addQty( final int i )
@@ -168,53 +129,69 @@ public class GuiPriority extends AEBaseGui<ContainerPriority>
// nope..
this.priority.setText( "0" );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
{
if( !this.checkHotbarKeys( key ) )
{
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.priority
.textboxKeyTyped( character, key ) )
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 )
{
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";
}
NetworkHandler.instance().sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
out = out.substring( 1 );
fixed = true;
}
else
if( fixed )
{
super.keyTyped( character, key );
this.priority.setText( out );
}
if( out.isEmpty() )
{
out = "0";
}
NetworkHandler.instance().sendToServer( new PacketValueConfig( "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 PacketValueConfig( "PriorityHost.Priority", out ) );
return true;
}
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
protected String getBackground()
@@ -24,7 +24,6 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerQNB;
import appeng.core.localization.GuiText;
import appeng.tile.qnb.TileQuantumBridge;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -45,7 +44,7 @@ public class GuiQNB extends AEBaseGui<ContainerQNB>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -30,7 +30,6 @@ import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.items.contents.QuartzKnifeObj;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -50,7 +49,7 @@ public class GuiQuartzKnife extends AEBaseGui<ContainerQuartzKnife>
{
super.init();
this.name = new TextFieldWidget( 0, this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT );
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 );
@@ -66,32 +65,37 @@ public class GuiQuartzKnife extends AEBaseGui<ContainerQuartzKnife>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
this.name.drawTextBox();
this.name.render(mouseX, mouseY, partialTicks);
}
@Override
protected void keyTyped( final char character, final int key ) throws IOException
public boolean charTyped(char character, int key) {
if( this.name.charTyped( character, key ) )
{
final String Out = this.name.getText();
container.setName( Out );
NetworkHandler.instance().sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
return true;
}
return super.charTyped(character, key);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int p_keyPressed_3_)
{
if( this.name.textboxKeyTyped( character, key ) )
if( this.name.keyPressed( keyCode, scanCode, p_keyPressed_3_ ) )
{
try
{
final String Out = this.name.getText();
container.setName( Out );
NetworkHandler.instance().sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
else
{
super.keyTyped( character, key );
final String Out = this.name.getText();
container.setName( Out );
NetworkHandler.instance().sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
return true;
}
return super.keyPressed(keyCode, scanCode, p_keyPressed_3_);
}
}
@@ -21,6 +21,7 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.SecurityPermissions;
@@ -54,45 +55,8 @@ public class GuiSecurityStation extends GuiMEMonitorable<ContainerSecurityStatio
this.setStandardSize( this.xSize );
}
@Override
protected void actionPerformed( final net.minecraft.client.gui.GuiButton btn )
{
super.actionPerformed( btn );
SecurityPermissions toggleSetting = null;
if( btn == this.inject )
{
toggleSetting = SecurityPermissions.INJECT;
}
if( btn == this.extract )
{
toggleSetting = SecurityPermissions.EXTRACT;
}
if( btn == this.craft )
{
toggleSetting = SecurityPermissions.CRAFT;
}
if( btn == this.build )
{
toggleSetting = SecurityPermissions.BUILD;
}
if( btn == this.security )
{
toggleSetting = SecurityPermissions.SECURITY;
}
if( toggleSetting != null )
{
try
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "TileSecurityStation.ToggleOption", toggleSetting.name() ) );
}
catch( final IOException e )
{
AELog.debug( e );
}
}
private void toggleOption(SecurityPermissions permission) {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "TileSecurityStation.ToggleOption", permission.name() ) );
}
@Override
@@ -101,20 +65,20 @@ public class GuiSecurityStation extends GuiMEMonitorable<ContainerSecurityStatio
super.init();
final int top = this.guiTop + this.ySize - 116;
this.addButton( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
.getTranslationKey(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.inject = this.addButton( new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
.getTranslatedName(), SecurityPermissions.INJECT.getTranslatedTip(), btn -> toggleOption(SecurityPermissions.INJECT) ) );
this.addButton( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
.getTranslationKey(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.extract = this.addButton( new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
.getTranslatedName(), SecurityPermissions.EXTRACT.getTranslatedTip(), btn -> toggleOption(SecurityPermissions.EXTRACT ) ) );
this.addButton( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT
.getTranslationKey(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.craft = this.addButton( new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT
.getTranslatedName(), SecurityPermissions.CRAFT.getTranslatedTip(), btn -> toggleOption(SecurityPermissions.CRAFT ) ) );
this.addButton( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD
.getTranslationKey(), SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.build = this.addButton( new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD
.getTranslatedName(), SecurityPermissions.BUILD.getTranslatedTip(), btn -> toggleOption(SecurityPermissions.BUILD ) ) );
this.addButton( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
.getTranslationKey(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
this.security = this.addButton( new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
.getTranslatedName(), SecurityPermissions.SECURITY.getTranslatedTip(), btn -> toggleOption(SecurityPermissions.SECURITY ) ) );
}
@Override
@@ -49,7 +49,7 @@ public class GuiSkyChest extends AEBaseGui<ContainerSkyChest>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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 );
@@ -19,23 +19,16 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.Settings;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerSpatialIOPort;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiSpatialIOPort extends AEBaseGui<ContainerSpatialIOPort>
@@ -48,29 +41,21 @@ public class GuiSpatialIOPort extends AEBaseGui<ContainerSpatialIOPort>
this.ySize = 199;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.units )
{
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
}
@Override
public void init()
{
super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit(), btn -> selectNextUnit() );
this.addButton( this.units );
}
private void selectNextUnit() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
@@ -97,7 +82,7 @@ public class GuiSpatialIOPort extends AEBaseGui<ContainerSpatialIOPort>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );
@@ -19,30 +19,18 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
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.api.config.*;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerPriority;
import appeng.container.implementations.ContainerStorageBus;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.misc.PartStorageBus;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
public class GuiStorageBus extends GuiUpgradeable<ContainerStorageBus>
@@ -50,9 +38,6 @@ public class GuiStorageBus extends GuiUpgradeable<ContainerStorageBus>
private GuiImgButton rwMode;
private GuiImgButton storageFilter;
private GuiTabButton priority;
private GuiImgButton partition;
private GuiImgButton clear;
public GuiStorageBus(ContainerStorageBus container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
@@ -62,19 +47,17 @@ public class GuiStorageBus extends GuiUpgradeable<ContainerStorageBus>
@Override
protected void addButtons()
{
this.clear = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
this.partition = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
this.rwMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE );
this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
addButton( new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE, btn -> clear() ) );
addButton( new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH, btn -> partition() ) );
this.rwMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE, btn -> toggleReadWriteMode() );
this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, btn -> toggleStorageFilterMode() );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::actionPerformed );
this.addButton( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
this.addButton( new GuiTabButton( 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 );
this.addButton( this.partition );
this.addButton( this.clear );
}
@Override
@@ -105,39 +88,26 @@ public class GuiStorageBus extends GuiUpgradeable<ContainerStorageBus>
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
try
{
if( btn == this.partition )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
}
else if( btn == this.clear )
{
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
}
else if( btn == this.priority )
{
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if( btn == this.rwMode )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
}
else if( btn == this.storageFilter )
{
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
}
catch( final IOException e )
{
AELog.debug( e );
}
private void partition() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
}
private void clear() {
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
}
private void openPriorityGui() {
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( ContainerPriority.TYPE ) );
}
private void toggleReadWriteMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
}
private void toggleStorageFilterMode() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
}
@@ -19,8 +19,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.FuzzyMode;
@@ -64,7 +63,7 @@ public class GuiUpgradeable<T extends ContainerUpgradeable> extends AEBaseGui<T>
protected boolean hasToolbox()
{
return ( (ContainerUpgradeable) this.container ).hasToolbox();
return ( this.container ).hasToolbox();
}
@Override
@@ -76,10 +75,10 @@ public class GuiUpgradeable<T extends ContainerUpgradeable> extends AEBaseGui<T>
protected void addButtons()
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
this.craftMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_ONLY, YesNo.NO );
this.schedulingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, this::actionPerformed );
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::actionPerformed );
this.craftMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.CRAFT_ONLY, YesNo.NO, this::actionPerformed );
this.schedulingMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT, this::actionPerformed );
this.addButton( this.craftMode );
this.addButton( this.redstoneMode );
@@ -115,7 +114,7 @@ public class GuiUpgradeable<T extends ContainerUpgradeable> extends AEBaseGui<T>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks)
{
this.handleButtonVisibility();
@@ -166,12 +165,11 @@ public class GuiUpgradeable<T extends ContainerUpgradeable> extends AEBaseGui<T>
return this.bc instanceof PartImportBus ? GuiText.ImportBus : GuiText.ExportBus;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
// FIXME: replace with individual methods
protected void actionPerformed( final Button btn )
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
// Detect right-clicks
final boolean backwards = minecraft.mouseHelper.isRightDown();
if( btn == this.redstoneMode )
{
@@ -71,7 +71,7 @@ public class GuiVibrationChamber extends AEBaseGui<ContainerVibrationChamber>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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;
@@ -19,23 +19,16 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.PlayerInventory;
import appeng.api.config.Settings;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerWireless;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiWireless extends AEBaseGui<ContainerWireless>
@@ -48,29 +41,21 @@ public class GuiWireless extends AEBaseGui<ContainerWireless>
this.ySize = 166;
}
@Override
protected void actionPerformed( final GuiButton btn ) throws IOException
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.units )
{
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
}
@Override
public void init()
{
super.init();
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit() );
this.units = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.POWER_UNITS, AEConfig.instance().selectedPowerUnit(), btn -> toggleUnits() );
this.addButton( this.units );
}
private void toggleUnits() {
final boolean backwards = minecraft.mouseHelper.isRightDown();
AEConfig.instance().nextPowerUnit( backwards );
this.units.set( AEConfig.instance().selectedPowerUnit() );
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
@@ -90,7 +75,7 @@ public class GuiWireless extends AEBaseGui<ContainerWireless>
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
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, 0 /* FIXME this.zlevel was used */ );