Crafting Plan Screen is almost done.
This commit is contained in:
parent
3031d60fc4
commit
c8bdf1bd45
8 changed files with 401 additions and 21 deletions
|
@ -1,23 +1,64 @@
|
||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
import appeng.container.implementations.ContainerCraftConfirm;
|
import appeng.container.implementations.ContainerCraftConfirm;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
public class GuiCraftConfirm extends AEBaseGui
|
public class GuiCraftConfirm extends AEBaseGui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int rows = 5;
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||||
|
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||||
|
|
||||||
|
List<IAEItemStack> visual = new ArrayList();
|
||||||
|
|
||||||
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
|
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
|
||||||
|
xSize = 238;
|
||||||
|
ySize = 206;
|
||||||
|
myScrollBar = new GuiScrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuiButton cancel;
|
||||||
|
GuiButton start;
|
||||||
|
GuiButton selectcpu;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui()
|
||||||
{
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
|
start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + ySize - 25, 50, 20, GuiText.Start.getLocal() );
|
||||||
|
buttonList.add( start );
|
||||||
|
|
||||||
|
selectcpu = new GuiButton( 0, this.guiLeft + (219 - 150) / 2, this.guiTop + ySize - 68, 150, 20, GuiText.CraftingCPU.getLocal() + ": "
|
||||||
|
+ GuiText.Automatic );
|
||||||
|
buttonList.add( selectcpu );
|
||||||
|
|
||||||
|
cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||||
|
buttonList.add( cancel );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,21 +67,287 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||||
super.actionPerformed( btn );
|
super.actionPerformed( btn );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long getTotal(IAEItemStack is)
|
||||||
|
{
|
||||||
|
IAEItemStack a = storage.findPrecise( is );
|
||||||
|
IAEItemStack c = pending.findPrecise( is );
|
||||||
|
|
||||||
|
long total = 0;
|
||||||
|
|
||||||
|
if ( a != null )
|
||||||
|
total += a.getStackSize();
|
||||||
|
|
||||||
|
if ( c != null )
|
||||||
|
total += c.getStackSize();
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate(List<IAEItemStack> list, byte ref)
|
||||||
|
{
|
||||||
|
switch (ref)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
for (IAEItemStack l : list)
|
||||||
|
handleInput( storage, l );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
for (IAEItemStack l : list)
|
||||||
|
handleInput( pending, l );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IAEItemStack l : list)
|
||||||
|
{
|
||||||
|
long amt = getTotal( l );
|
||||||
|
|
||||||
|
if ( amt <= 0 )
|
||||||
|
deleteVisualStack( l );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IAEItemStack is = findVisualStack( l );
|
||||||
|
is.setStackSize( amt );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleInput(IItemList<IAEItemStack> s, IAEItemStack l)
|
||||||
|
{
|
||||||
|
IAEItemStack a = s.findPrecise( l );
|
||||||
|
|
||||||
|
if ( l.getStackSize() <= 0 )
|
||||||
|
{
|
||||||
|
if ( a != null )
|
||||||
|
a.reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( a == null )
|
||||||
|
{
|
||||||
|
s.add( l.copy() );
|
||||||
|
a = s.findPrecise( l );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( a != null )
|
||||||
|
a.setStackSize( l.getStackSize() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAEItemStack findVisualStack(IAEItemStack l)
|
||||||
|
{
|
||||||
|
Iterator<IAEItemStack> i = visual.iterator();
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
IAEItemStack o = i.next();
|
||||||
|
if ( o.equals( l ) )
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
IAEItemStack stack = l.copy();
|
||||||
|
visual.add( stack );
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteVisualStack(IAEItemStack l)
|
||||||
|
{
|
||||||
|
Iterator<IAEItemStack> i = visual.iterator();
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
IAEItemStack o = i.next();
|
||||||
|
if ( o.equals( l ) )
|
||||||
|
{
|
||||||
|
i.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setScrollBar()
|
||||||
|
{
|
||||||
|
int size = visual.size();
|
||||||
|
|
||||||
|
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
|
||||||
|
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
|
setScrollBar();
|
||||||
bindTexture( "guis/craftingreport.png" );
|
bindTexture( "guis/craftingreport.png" );
|
||||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBackground()
|
int tooltip = -1;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||||
{
|
{
|
||||||
return "guis/craftingreport.png";
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
|
||||||
|
int gx = (width - xSize) / 2;
|
||||||
|
int gy = (height - ySize) / 2;
|
||||||
|
int yoff = 23;
|
||||||
|
|
||||||
|
tooltip = -1;
|
||||||
|
|
||||||
|
for (int z = 0; z <= 4 * 5; z++)
|
||||||
|
{
|
||||||
|
int minX = gx + 9 + x * 67;
|
||||||
|
int minY = gy + 22 + y * yoff;
|
||||||
|
|
||||||
|
if ( minX < mouse_x && minX + 67 > mouse_x )
|
||||||
|
{
|
||||||
|
if ( minY < mouse_y && minY + yoff - 2 > mouse_y )
|
||||||
|
{
|
||||||
|
tooltip = z;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
x++;
|
||||||
|
|
||||||
|
if ( x > 2 )
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.drawScreen( mouse_x, mouse_y, btn );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
fontRendererObj.drawString( GuiText.ConfirmCrafting.getLocal(), 8, 6, 4210752 );
|
ContainerCraftConfirm c = (ContainerCraftConfirm) inventorySlots;
|
||||||
|
|
||||||
|
long BytesUsed = c.bytesUsed;
|
||||||
|
String byteUsed = NumberFormat.getInstance().format( BytesUsed );
|
||||||
|
String Add = BytesUsed > 0 ? (byteUsed + " " + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
|
||||||
|
fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
|
||||||
|
|
||||||
|
String dsp = c.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + c.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + c.cpuCoProcessors)
|
||||||
|
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
|
||||||
|
int offset = (219 - fontRendererObj.getStringWidth( dsp )) / 2;
|
||||||
|
fontRendererObj.drawString( dsp, offset, 165, 4210752 );
|
||||||
|
|
||||||
|
int sectionLength = 67;
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
int xo = 0 + 9;
|
||||||
|
int yo = 0 + 22;
|
||||||
|
int viewStart = myScrollBar.getCurrentScroll() * 3;
|
||||||
|
int viewEnd = viewStart + 3 * rows;
|
||||||
|
|
||||||
|
String dspToolTip = "";
|
||||||
|
List<String> lineList = new LinkedList();
|
||||||
|
int toolPosX = 0;
|
||||||
|
int toolPosY = 0;
|
||||||
|
|
||||||
|
int offY = 23;
|
||||||
|
|
||||||
|
for (int z = viewStart; z < Math.min( viewEnd, visual.size() ); z++)
|
||||||
|
{
|
||||||
|
IAEItemStack refStack = visual.get( z );// repo.getRefrenceItem( z );
|
||||||
|
if ( refStack != null )
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||||
|
|
||||||
|
IAEItemStack stored = storage.findPrecise( refStack );
|
||||||
|
IAEItemStack pendingStack = pending.findPrecise( refStack );
|
||||||
|
|
||||||
|
int lines = 0;
|
||||||
|
|
||||||
|
if ( stored != null && stored.getStackSize() > 0 )
|
||||||
|
lines++;
|
||||||
|
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||||
|
lines++;
|
||||||
|
|
||||||
|
int negY = ((lines - 1) * 5) / 2;
|
||||||
|
int downY = 0;
|
||||||
|
|
||||||
|
if ( stored != null && stored.getStackSize() > 0 )
|
||||||
|
{
|
||||||
|
String str = Long.toString( stored.getStackSize() );
|
||||||
|
if ( stored.getStackSize() >= 10000 )
|
||||||
|
str = Long.toString( stored.getStackSize() / 1000 ) + "k";
|
||||||
|
if ( stored.getStackSize() >= 10000000 )
|
||||||
|
str = Long.toString( stored.getStackSize() / 1000000 ) + "m";
|
||||||
|
|
||||||
|
str = GuiText.FromStorage.getLocal() + ": " + str;
|
||||||
|
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||||
|
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||||
|
+ 6 - negY + downY) * 2), 4210752 );
|
||||||
|
|
||||||
|
if ( tooltip == z - viewStart )
|
||||||
|
lineList.add( GuiText.FromStorage.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
|
||||||
|
|
||||||
|
downY += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||||
|
{
|
||||||
|
String str = Long.toString( pendingStack.getStackSize() );
|
||||||
|
if ( pendingStack.getStackSize() >= 10000 )
|
||||||
|
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k";
|
||||||
|
if ( pendingStack.getStackSize() >= 10000000 )
|
||||||
|
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m";
|
||||||
|
|
||||||
|
str = GuiText.ToCraft.getLocal() + ": " + str;
|
||||||
|
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||||
|
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||||
|
+ 6 - negY + downY) * 2), 4210752 );
|
||||||
|
|
||||||
|
if ( tooltip == z - viewStart )
|
||||||
|
lineList.add( GuiText.ToCraft.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
|
||||||
|
int posY = y * offY + yo;
|
||||||
|
|
||||||
|
ItemStack is = refStack.copy().getItemStack();
|
||||||
|
|
||||||
|
if ( tooltip == z - viewStart )
|
||||||
|
{
|
||||||
|
dspToolTip = Platform.getItemDisplayName( is );
|
||||||
|
|
||||||
|
if ( lineList.size() > 0 )
|
||||||
|
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||||
|
|
||||||
|
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||||
|
toolPosY = y * offY + yo;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawItem( posX, posY, is );
|
||||||
|
|
||||||
|
x++;
|
||||||
|
|
||||||
|
if ( x > 2 )
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tooltip >= 0 && dspToolTip.length() > 0 )
|
||||||
|
{
|
||||||
|
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||||
|
drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,9 +187,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||||
|
|
||||||
private void setScrollBar()
|
private void setScrollBar()
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = visual.size();
|
||||||
for (IAEItemStack l : visual)
|
|
||||||
size++;
|
|
||||||
|
|
||||||
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
|
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
|
||||||
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
||||||
|
@ -198,7 +196,6 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
setScrollBar();
|
|
||||||
bindTexture( "guis/craftingcpu.png" );
|
bindTexture( "guis/craftingcpu.png" );
|
||||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,30 @@
|
||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.networking.security.IActionHost;
|
import appeng.api.networking.security.IActionHost;
|
||||||
import appeng.api.networking.security.PlayerSource;
|
import appeng.api.networking.security.PlayerSource;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import appeng.crafting.CraftingJob;
|
import appeng.crafting.CraftingJob;
|
||||||
import appeng.crafting.ICraftingHost;
|
import appeng.crafting.ICraftingHost;
|
||||||
import appeng.me.cache.CraftingCache;
|
|
||||||
|
|
||||||
public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingHost
|
public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingHost
|
||||||
{
|
{
|
||||||
|
@ -26,6 +33,15 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingH
|
||||||
public Future<CraftingJob> job;
|
public Future<CraftingJob> job;
|
||||||
public CraftingJob result;
|
public CraftingJob result;
|
||||||
|
|
||||||
|
@GuiSync(0)
|
||||||
|
public long bytesUsed;
|
||||||
|
|
||||||
|
@GuiSync(1)
|
||||||
|
public long cpuBytesAvail;
|
||||||
|
|
||||||
|
@GuiSync(2)
|
||||||
|
public int cpuCoProcessors;
|
||||||
|
|
||||||
public ContainerCraftConfirm(InventoryPlayer ip, ITerminalHost te) {
|
public ContainerCraftConfirm(InventoryPlayer ip, ITerminalHost te) {
|
||||||
super( ip, te );
|
super( ip, te );
|
||||||
priHost = te;
|
priHost = te;
|
||||||
|
@ -42,10 +58,51 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingH
|
||||||
result = job.get();
|
result = job.get();
|
||||||
if ( !result.isSimulation() )
|
if ( !result.isSimulation() )
|
||||||
{
|
{
|
||||||
CraftingCache cc = getGrid().getCache( CraftingCache.class );
|
try
|
||||||
cc.submitJob( result, null, getActionSrc() );
|
{
|
||||||
AELog.info( "Job info is ready!" );
|
PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
|
||||||
this.isContainerValid = false;
|
PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||||
|
result.tree.getPlan( plan );
|
||||||
|
|
||||||
|
bytesUsed = result.getByteTotal();
|
||||||
|
|
||||||
|
for (IAEItemStack out : plan)
|
||||||
|
{
|
||||||
|
IAEItemStack o = out.copy();
|
||||||
|
o.reset();
|
||||||
|
o.setStackSize( out.getStackSize() );
|
||||||
|
|
||||||
|
IAEItemStack p = out.copy();
|
||||||
|
p.reset();
|
||||||
|
p.setStackSize( out.getCountRequestable() );
|
||||||
|
|
||||||
|
if ( o.getStackSize() > 0 )
|
||||||
|
a.appendItem( o );
|
||||||
|
|
||||||
|
if ( p.getStackSize() > 0 )
|
||||||
|
b.appendItem( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Object g : this.crafters)
|
||||||
|
{
|
||||||
|
if ( g instanceof EntityPlayer )
|
||||||
|
{
|
||||||
|
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
|
||||||
|
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftingCache cc = getGrid().getCache( CraftingCache.class );
|
||||||
|
// cc.submitJob( result, null, getActionSrc() );
|
||||||
|
// AELog.info( "Job info is ready!" );
|
||||||
|
// this.isContainerValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
|
|
|
@ -32,7 +32,7 @@ public enum GuiText
|
||||||
|
|
||||||
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty, ConfirmCrafting,
|
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty, ConfirmCrafting,
|
||||||
|
|
||||||
Stored, Crafting, Scheduled, CraftingStatus, Cancel;
|
Stored, Crafting, Scheduled, CraftingStatus, Cancel, FromStorage, ToCraft, CraftingPlan, CalculatingWait, Start, Bytes, CraftingCPU, Automatic, CoProcessors;
|
||||||
|
|
||||||
String root;
|
String root;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||||
|
@ -89,6 +90,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||||
{
|
{
|
||||||
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||||
|
|
||||||
|
if ( gs instanceof GuiCraftConfirm )
|
||||||
|
((GuiCraftConfirm) gs).postUpdate( list, ref );
|
||||||
|
|
||||||
if ( gs instanceof GuiCraftingCPU )
|
if ( gs instanceof GuiCraftingCPU )
|
||||||
((GuiCraftingCPU) gs).postUpdate( list, ref );
|
((GuiCraftingCPU) gs).postUpdate( list, ref );
|
||||||
|
|
||||||
|
|
|
@ -228,4 +228,13 @@ public class CraftingTreeNode
|
||||||
for (CraftingTreeProcess pro : nodes)
|
for (CraftingTreeProcess pro : nodes)
|
||||||
pro.setJob( storage, craftingCPUCluster, src );
|
pro.setJob( storage, craftingCPUCluster, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getPlan(IItemList<IAEItemStack> plan)
|
||||||
|
{
|
||||||
|
for (IAEItemStack i : used)
|
||||||
|
plan.add( i.copy() );
|
||||||
|
|
||||||
|
for (CraftingTreeProcess pro : nodes)
|
||||||
|
pro.getPlan( plan );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.me.cache.CraftingCache;
|
import appeng.me.cache.CraftingCache;
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||||
|
@ -202,4 +203,17 @@ public class CraftingTreeProcess
|
||||||
for (CraftingTreeNode pro : nodes.keySet())
|
for (CraftingTreeNode pro : nodes.keySet())
|
||||||
pro.setJob( storage, craftingCPUCluster, src );
|
pro.setJob( storage, craftingCPUCluster, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getPlan(IItemList<IAEItemStack> plan)
|
||||||
|
{
|
||||||
|
for (IAEItemStack i : details.getOutputs())
|
||||||
|
{
|
||||||
|
i = i.copy();
|
||||||
|
i.setCountRequestable( i.getStackSize() * crafts );
|
||||||
|
plan.addRequestable( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CraftingTreeNode pro : nodes.keySet())
|
||||||
|
pro.getPlan( plan );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,14 +301,6 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||||
isComplete = true;
|
isComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getRemainingTasks()
|
|
||||||
{
|
|
||||||
int o = 0;
|
|
||||||
for (Entry<ICraftingPatternDetails, TaskProgress> tp : tasks.entrySet())
|
|
||||||
o += tp.getValue().value * tp.getKey().getCondencedOutputs()[0].getStackSize();
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canCraft(ICraftingPatternDetails details, IAEItemStack[] condencedInputs)
|
private boolean canCraft(ICraftingPatternDetails details, IAEItemStack[] condencedInputs)
|
||||||
{
|
{
|
||||||
for (IAEItemStack g : condencedInputs)
|
for (IAEItemStack g : condencedInputs)
|
||||||
|
|
Loading…
Reference in a new issue