Added Crafting Status GUI to Terminals.
This commit is contained in:
parent
a04f7d6029
commit
995d985987
10 changed files with 405 additions and 28 deletions
|
@ -26,7 +26,6 @@ import appeng.core.AELog;
|
|||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
@ -42,13 +41,25 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||
|
||||
List<IAEItemStack> visual = new ArrayList();
|
||||
|
||||
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, TileCraftingTile te) {
|
||||
super( new ContainerCraftingCPU( inventoryPlayer, te ) );
|
||||
public void clearItems()
|
||||
{
|
||||
storage = AEApi.instance().storage().createItemList();
|
||||
active = AEApi.instance().storage().createItemList();
|
||||
pending = AEApi.instance().storage().createItemList();
|
||||
visual = new ArrayList();
|
||||
}
|
||||
|
||||
protected GuiCraftingCPU(ContainerCraftingCPU container) {
|
||||
super( container );
|
||||
this.ySize = 184;
|
||||
this.xSize = 238;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
}
|
||||
|
||||
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, Object te) {
|
||||
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
GuiButton cancel;
|
||||
|
||||
@Override
|
||||
|
@ -205,6 +216,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
cancel.enabled = !visual.isEmpty();
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
|
@ -398,4 +411,5 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||
{
|
||||
return ViewItems.ALL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
151
client/gui/implementations/GuiCraftingStatus.java
Normal file
151
client/gui/implementations/GuiCraftingStatus.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
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.GuiBridge;
|
||||
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;
|
||||
|
||||
public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
{
|
||||
|
||||
ContainerCraftingStatus ccc;
|
||||
GuiButton selectcpu;
|
||||
|
||||
GuiTabButton originalGuiBtn;
|
||||
GuiBridge OriginalGui;
|
||||
ItemStack myIcon = null;
|
||||
|
||||
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
|
||||
|
||||
ccc = (ContainerCraftingStatus) inventorySlots;
|
||||
Object target = ccc.getTarget();
|
||||
|
||||
if ( target instanceof WirelessTerminalGuiObject )
|
||||
{
|
||||
myIcon = AEApi.instance().items().itemWirelessTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
}
|
||||
|
||||
if ( target instanceof PartTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
if ( target instanceof PartCraftingTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partCraftingTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
|
||||
if ( target instanceof PartPatternTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partPatternTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == selectcpu )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == originalGuiBtn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getGuiDisplayName(String in)
|
||||
{
|
||||
return in; // the cup name is on the button
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + 8, this.guiTop + ySize - 25, 150, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs );
|
||||
// selectcpu.enabled = false;
|
||||
buttonList.add( selectcpu );
|
||||
|
||||
if ( myIcon != null )
|
||||
{
|
||||
buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, myIcon, myIcon.getDisplayName(), itemRender ) );
|
||||
originalGuiBtn.hideEdge = 13;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
String btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
|
||||
if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
|
||||
{
|
||||
if ( ccc.myName.length() > 0 )
|
||||
{
|
||||
String name = ccc.myName.substring( 0, Math.min( 20, ccc.myName.length() ) );
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
|
||||
}
|
||||
else
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": #" + ccc.selectedCpu;
|
||||
}
|
||||
|
||||
if ( ccc.noCPU )
|
||||
btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
|
||||
selectcpu.displayString = btnTextText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
updateCPUButtonText();
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ import appeng.api.util.IConfigureableObject;
|
|||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
|
@ -35,7 +36,9 @@ import appeng.core.AEConfig;
|
|||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
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.IntegrationType;
|
||||
|
@ -47,6 +50,8 @@ import appeng.util.Platform;
|
|||
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost
|
||||
{
|
||||
|
||||
GuiTabButton craftingStatusBtn;
|
||||
|
||||
MEGuiTextField searchField;
|
||||
private static String memoryText = "";
|
||||
|
||||
|
@ -227,6 +232,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
searchField.setTextColor( 0xFFFFFF );
|
||||
searchField.setVisible( true );
|
||||
|
||||
if ( viewCell || this instanceof GuiWirelessTerm )
|
||||
{
|
||||
buttonList.add( craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(),
|
||||
itemRender ) );
|
||||
craftingStatusBtn.hideEdge = 13;
|
||||
}
|
||||
|
||||
// Enum setting = AEConfig.instance.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
|
||||
|
@ -273,6 +285,18 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
if ( btn == craftingStatusBtn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn instanceof GuiImgButton )
|
||||
{
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
|
|
@ -32,9 +32,9 @@ public class GuiPatternTerm extends GuiMEMonitorable
|
|||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
buttonList.add( tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 179, new ItemStack( Blocks.crafting_table ),
|
||||
buttonList.add( tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ),
|
||||
GuiText.CraftingPattern.getLocal(), itemRender ) );
|
||||
buttonList.add( tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 179, new ItemStack( Blocks.furnace ),
|
||||
buttonList.add( tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ),
|
||||
GuiText.ProcessingPattern.getLocal(), itemRender ) );
|
||||
|
||||
// buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163,
|
||||
|
|
|
@ -18,6 +18,8 @@ public class GuiTabButton extends GuiButton implements ITooltip
|
|||
RenderItem itemRenderer;
|
||||
|
||||
int myIcon = -1;
|
||||
public int hideEdge = 0;
|
||||
|
||||
ItemStack myItem;
|
||||
|
||||
String Msg;
|
||||
|
@ -66,16 +68,18 @@ public class GuiTabButton extends GuiButton implements ITooltip
|
|||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( 13 / 16 );
|
||||
int uv_x = 13 - uv_y * 16;
|
||||
int uv_x = (hideEdge > 0 ? 11 : 13) - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 22, 22 );
|
||||
int offsetX = hideEdge > 0 ? 1 : 0;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 25, 22 );
|
||||
|
||||
if ( myIcon >= 0 )
|
||||
{
|
||||
uv_y = (int) Math.floor( myIcon / 16 );
|
||||
uv_x = myIcon - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16 );
|
||||
this.drawTexturedModalRect( offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16 );
|
||||
}
|
||||
|
||||
this.mouseDragged( par1Minecraft, par2, par3 );
|
||||
|
@ -89,7 +93,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
|
|||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
FontRenderer fontrenderer = par1Minecraft.fontRenderer;
|
||||
itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, par1Minecraft.renderEngine, myItem, this.xPosition + 3, this.yPosition + 3 );
|
||||
itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, par1Minecraft.renderEngine, myItem, offsetX + this.xPosition + 3, this.yPosition + 3 );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
|
|
|
@ -12,16 +12,18 @@ import appeng.api.networking.IGrid;
|
|||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.CraftingItemList;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.me.cluster.IAECluster;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.Platform;
|
||||
|
@ -31,13 +33,13 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||
|
||||
CraftingCPUCluster monitor = null;
|
||||
String cpuName = null;
|
||||
IGrid network;
|
||||
protected IGrid network;
|
||||
|
||||
IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
|
||||
public ContainerCraftingCPU(InventoryPlayer ip, TileCraftingTile te) {
|
||||
super( ip, null, null );
|
||||
IGridHost host = te;// .getGridHost();
|
||||
public ContainerCraftingCPU(InventoryPlayer ip, Object te) {
|
||||
super( ip, te );
|
||||
IGridHost host = (IGridHost) (te instanceof IGridHost ? te : null);
|
||||
|
||||
if ( host != null )
|
||||
{
|
||||
|
@ -47,23 +49,52 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||
}
|
||||
|
||||
if ( te instanceof TileCraftingTile )
|
||||
{
|
||||
IAECluster c = ((TileCraftingTile) te).getCluster();
|
||||
if ( c instanceof CraftingCPUCluster )
|
||||
{
|
||||
cpuName = ((CraftingCPUCluster) c).getName();
|
||||
setCPU( (ICraftingCPU) ((TileCraftingTile) te).getCluster() );
|
||||
|
||||
monitor = (CraftingCPUCluster) c;
|
||||
if ( monitor != null )
|
||||
if ( network == null && Platform.isServer() )
|
||||
isContainerValid = false;
|
||||
}
|
||||
|
||||
protected void setCPU(ICraftingCPU c)
|
||||
{
|
||||
if ( c== monitor)
|
||||
return;
|
||||
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
|
||||
for (Object g : this.crafters)
|
||||
{
|
||||
if ( g instanceof EntityPlayer )
|
||||
{
|
||||
try
|
||||
{
|
||||
monitor.getListOfItem( list, CraftingItemList.ALL );
|
||||
monitor.addListener( this, null );
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( network == null && Platform.isServer() )
|
||||
isContainerValid = false;
|
||||
if ( c instanceof CraftingCPUCluster )
|
||||
{
|
||||
cpuName = ((CraftingCPUCluster) c).getName();
|
||||
|
||||
monitor = (CraftingCPUCluster) c;
|
||||
if ( monitor != null )
|
||||
{
|
||||
list.resetStatus();
|
||||
monitor.getListOfItem( list, CraftingItemList.ALL );
|
||||
monitor.addListener( this, null );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor = null;
|
||||
cpuName = "";
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelCrafting()
|
||||
|
@ -106,7 +137,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if ( Platform.isServer() && !list.isEmpty() )
|
||||
if ( Platform.isServer() && monitor != null && !list.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
131
container/implementations/ContainerCraftingStatus.java
Normal file
131
container/implementations/ContainerCraftingStatus.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
{
|
||||
|
||||
@GuiSync(5)
|
||||
public int selectedCpu = -1;
|
||||
|
||||
@GuiSync(6)
|
||||
public boolean noCPU = true;
|
||||
|
||||
@GuiSync(7)
|
||||
public String myName = "";
|
||||
|
||||
public ArrayList<CraftingCPURecord> cpus = new ArrayList();
|
||||
|
||||
private void sendCPUs()
|
||||
{
|
||||
Collections.sort( cpus );
|
||||
|
||||
if ( selectedCpu >= cpus.size() )
|
||||
{
|
||||
selectedCpu = -1;
|
||||
myName = "";
|
||||
}
|
||||
else if ( selectedCpu != -1 )
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
}
|
||||
|
||||
if ( selectedCpu == -1 && cpus.size() > 0 )
|
||||
selectedCpu = 0;
|
||||
|
||||
if ( selectedCpu != -1 )
|
||||
{
|
||||
if ( cpus.get( selectedCpu ).cpu != monitor )
|
||||
setCPU( cpus.get( selectedCpu ).cpu );
|
||||
}
|
||||
else
|
||||
setCPU( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ICraftingGrid cc = network.getCache( ICraftingGrid.class );
|
||||
ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||
|
||||
int matches = 0;
|
||||
boolean changed = false;
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
boolean found = false;
|
||||
for (CraftingCPURecord ccr : cpus)
|
||||
if ( ccr.cpu == c )
|
||||
found = true;
|
||||
|
||||
boolean matched = cpuMatches( c );
|
||||
|
||||
if ( matched )
|
||||
matches++;
|
||||
|
||||
if ( !found != matched )
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ( changed || cpus.size() != matches )
|
||||
{
|
||||
cpus.clear();
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
if ( cpuMatches( c ) )
|
||||
cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
}
|
||||
|
||||
sendCPUs();
|
||||
}
|
||||
|
||||
noCPU = cpus.size() == 0;
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
private boolean cpuMatches(ICraftingCPU c)
|
||||
{
|
||||
return c.isBusy();
|
||||
}
|
||||
|
||||
public ContainerCraftingStatus(InventoryPlayer ip, ITerminalHost te) {
|
||||
super( ip, te );
|
||||
}
|
||||
|
||||
public void cycleCpu(boolean next)
|
||||
{
|
||||
if ( next )
|
||||
selectedCpu++;
|
||||
else
|
||||
selectedCpu--;
|
||||
|
||||
if ( selectedCpu < -1 )
|
||||
selectedCpu = cpus.size() - 1;
|
||||
else if ( selectedCpu >= cpus.size() )
|
||||
selectedCpu = -1;
|
||||
|
||||
if ( selectedCpu == -1 && cpus.size() > 0 )
|
||||
selectedCpu = 0;
|
||||
|
||||
if ( selectedCpu == -1 )
|
||||
{
|
||||
myName = "";
|
||||
setCPU( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
setCPU( cpus.get( selectedCpu ).cpu );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,9 @@ public enum GuiText
|
|||
|
||||
InterfaceTerminal, NoCraftingCPUs, LightTunnel, Clean, InvalidPattern,
|
||||
|
||||
InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint;
|
||||
InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint,
|
||||
|
||||
NoCraftingJobs, CPUs;
|
||||
|
||||
String root;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import appeng.container.implementations.ContainerCondenser;
|
|||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.container.implementations.ContainerFormationPlane;
|
||||
|
@ -161,7 +162,9 @@ public enum GuiBridge implements IGuiHandler
|
|||
|
||||
GUI_CRAFTING_CONFIRM(ContainerCraftConfirm.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_INTERFACE_TERMINAL(ContainerInterfaceTerminal.class, PartMonitor.class, WORLD, SecurityPermissions.BUILD);
|
||||
GUI_INTERFACE_TERMINAL(ContainerInterfaceTerminal.class, PartMonitor.class, WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_CRAFTING_STATUS(ContainerCraftingStatus.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT);
|
||||
|
||||
private Class Tile;
|
||||
private Class Gui;
|
||||
|
|
|
@ -9,16 +9,20 @@ import java.io.DataInputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigureableObject;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerNetworkTool;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
|
@ -56,6 +60,12 @@ public class PacketValueConfig extends AppEngPacket
|
|||
si.onWheel( is, Value.equals( "WheelUp" ) );
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftingStatus )
|
||||
{
|
||||
ContainerCraftingStatus qk = (ContainerCraftingStatus) c;
|
||||
qk.cycleCpu( Value.equals( "Next" ) );
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftConfirm )
|
||||
{
|
||||
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
|
||||
|
@ -198,6 +208,13 @@ public class PacketValueConfig extends AppEngPacket
|
|||
{
|
||||
((AEBaseContainer) c).stringSync( Integer.parseInt( Name.substring( 8 ) ), Value );
|
||||
}
|
||||
else if ( Name.equals( "CraftingStatus" ) && Value.equals( "Clear" ) )
|
||||
{
|
||||
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if ( gs instanceof GuiCraftingCPU )
|
||||
((GuiCraftingCPU) gs).clearItems();
|
||||
return;
|
||||
}
|
||||
else if ( c instanceof IConfigureableObject )
|
||||
{
|
||||
IConfigManager cm = ((IConfigureableObject) c).getConfigManager();
|
||||
|
|
Loading…
Reference in a new issue