Added Feature: #0134 - Need info on wireless terminal GUI
This commit is contained in:
parent
ae220a36c8
commit
a999c30bbc
3 changed files with 69 additions and 2 deletions
|
@ -1,14 +1,47 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
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;
|
||||
|
||||
public class GuiWireless extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiImgButton units;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == units )
|
||||
{
|
||||
AEConfig.instance.nextPowerUnit( backwards );
|
||||
units.set( AEConfig.instance.selectedPowerUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
|
||||
buttonList.add( units );
|
||||
}
|
||||
|
||||
public GuiWireless(InventoryPlayer inventoryPlayer, TileWireless te) {
|
||||
super( new ContainerWireless( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
|
@ -26,6 +59,19 @@ public class GuiWireless extends AEBaseGui
|
|||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
ContainerWireless cw = (ContainerWireless) inventorySlots;
|
||||
|
||||
if ( cw.range > 0 )
|
||||
{
|
||||
String msga = GuiText.Range.getLocal() + ": " + ((double) cw.range / 10.0) + " m";
|
||||
String msgb = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.drain, true );
|
||||
|
||||
int strWidth = Math.max( fontRendererObj.getStringWidth( msga ), fontRendererObj.getStringWidth( msgb ) );
|
||||
int cOffset = (this.xSize / 2) - (strWidth / 2);
|
||||
fontRendererObj.drawString( msga, cOffset, 20, 4210752 );
|
||||
fontRendererObj.drawString( msgb, cOffset, 20 + 12, 4210752 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package appeng.container.implementations;
|
|||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
|
||||
public class ContainerWireless extends AEBaseContainer
|
||||
|
@ -11,13 +13,32 @@ public class ContainerWireless extends AEBaseContainer
|
|||
|
||||
TileWireless myte;
|
||||
|
||||
@GuiSync(1)
|
||||
public long range = 0;
|
||||
|
||||
@GuiSync(2)
|
||||
public long drain = 0;
|
||||
|
||||
SlotRestrictedInput boosterSlot;
|
||||
|
||||
public ContainerWireless(InventoryPlayer ip, TileWireless te) {
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.RANGE_BOOSTER, myte, 0, 80, 37, invPlayer ) );
|
||||
addSlotToContainer( boosterSlot = new SlotRestrictedInput( PlaceableItemType.RANGE_BOOSTER, myte, 0, 80, 47, invPlayer ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
int boosters = boosterSlot.getStack() == null ? 0 : boosterSlot.getStack().stackSize;
|
||||
|
||||
range = (long) (10 * AEConfig.instance.wireless_getMaxRange( boosters ));
|
||||
drain = (long) (100 * AEConfig.instance.wireless_getPowerDrain( boosters ));
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public enum GuiText
|
|||
|
||||
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty, ConfirmCrafting,
|
||||
|
||||
Stored, Crafting, Scheduled, CraftingStatus, Cancel, FromStorage, ToCraft, CraftingPlan, CalculatingWait, Start, Bytes, CraftingCPU, Automatic, CoProcessors, Simulation, Missing, InterfaceTerminal, NoCraftingCPUs, LightTunnel, Clean, InvalidPattern, InterfaceTerminalHint;
|
||||
Stored, Crafting, Scheduled, CraftingStatus, Cancel, FromStorage, ToCraft, CraftingPlan, CalculatingWait, Start, Bytes, CraftingCPU, Automatic, CoProcessors, Simulation, Missing, InterfaceTerminal, NoCraftingCPUs, LightTunnel, Clean, InvalidPattern, InterfaceTerminalHint, Range;
|
||||
|
||||
String root;
|
||||
|
||||
|
|
Loading…
Reference in a new issue