Nameable CPUs.

This commit is contained in:
AlgorithmX2
2014-07-15 22:26:12 -05:00
parent e64bf91789
commit e49864e295
9 changed files with 121 additions and 9 deletions
@@ -71,6 +71,9 @@ public class ContainerCraftConfirm extends AEBaseContainer
@GuiSync(6)
public boolean noCPU = true;
@GuiSync(7)
public String myName = "";
protected long cpuIdx = Long.MIN_VALUE;
public class CraftingCPURecord implements Comparable<CraftingCPURecord>
@@ -82,10 +85,13 @@ public class ContainerCraftConfirm extends AEBaseContainer
long size;
int processors;
public String myName;
CraftingCPURecord(long size, int proc, ICraftingCPU server) {
this.size = size;
this.processors = proc;
this.cpu = server;
myName = server.getName();
}
@Override
@@ -115,9 +121,11 @@ public class ContainerCraftConfirm extends AEBaseContainer
selectedCpu = -1;
cpuBytesAvail = 0;
cpuCoProcessors = 0;
myName = "";
}
else if ( selectedCpu != -1 )
{
myName = cpus.get( selectedCpu ).myName;
cpuBytesAvail = cpus.get( selectedCpu ).size;
cpuCoProcessors = cpus.get( selectedCpu ).processors;
}
@@ -139,9 +147,11 @@ public class ContainerCraftConfirm extends AEBaseContainer
{
cpuBytesAvail = 0;
cpuCoProcessors = 0;
myName = "";
}
else
{
myName = cpus.get( selectedCpu ).myName;
cpuBytesAvail = cpus.get( selectedCpu ).size;
cpuCoProcessors = cpus.get( selectedCpu ).processors;
}
@@ -20,15 +20,17 @@ import appeng.api.storage.data.IItemList;
import appeng.container.AEBaseContainer;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.helpers.ICustomNameObject;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
{
CraftingCPUCluster monitor = null;
String cpuName = null;
IGrid network;
IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
@@ -49,6 +51,8 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
IAECluster c = ((TileCraftingTile) te).getCluster();
if ( c instanceof CraftingCPUCluster )
{
cpuName = ((CraftingCPUCluster) c).getName();
monitor = (CraftingCPUCluster) c;
if ( monitor != null )
{
@@ -162,4 +166,16 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
}
@Override
public String getCustomName()
{
return cpuName;
}
@Override
public boolean hasCustomName()
{
return cpuName != null && cpuName.length() > 0;
}
}