Merge branch 'rv1' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1
This commit is contained in:
@@ -669,7 +669,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
}
|
||||
|
||||
if ( id.removedByPlayer( w, player, x, y, z ) )
|
||||
if ( id.removedByPlayer( w, player, x, y, z, false ) )
|
||||
{
|
||||
List<ItemStack> l = new ArrayList<ItemStack>();
|
||||
for (ItemStack iss : drops)
|
||||
|
||||
@@ -271,6 +271,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
return cb( world, x, y, z ).isEmpty();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACESINGLE : InventoryAction.PICKUP_OR_SETDOWN;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
|
||||
if ( stack != null && action == InventoryAction.PICKUP_OR_SETDOWN && stack.getStackSize() == 0 )
|
||||
if ( stack != null && action == InventoryAction.PICKUP_OR_SETDOWN && stack.getStackSize() == 0 && player.inventory.getItemStack() == null )
|
||||
action = InventoryAction.AUTOCRAFT;
|
||||
|
||||
break;
|
||||
|
||||
@@ -118,7 +118,7 @@ public class GuiCraftAmount extends AEBaseGui
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketCraftRequest( inventorySlots.getSlot( 0 ).getStack(), Integer.parseInt( this.amountToCraft
|
||||
.getText() ) ) );
|
||||
.getText() ), isShiftKeyDown() ) );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
@@ -185,6 +185,10 @@ public class GuiCraftAmount extends AEBaseGui
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( key == 28 )
|
||||
{
|
||||
actionPerformed( next );
|
||||
}
|
||||
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
|
||||
&& amountToCraft.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
@@ -226,6 +230,8 @@ public class GuiCraftAmount extends AEBaseGui
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
|
||||
|
||||
bindTexture( "guis/craftAmt.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
|
||||
|
||||
@@ -1,46 +1,471 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
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.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.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
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;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
|
||||
int rows = 5;
|
||||
|
||||
IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
|
||||
List<IAEItemStack> visual = new ArrayList();
|
||||
|
||||
GuiBridge OriginalGui;
|
||||
|
||||
boolean isAutoStart()
|
||||
{
|
||||
return ((ContainerCraftConfirm) inventorySlots).autoStart;
|
||||
}
|
||||
|
||||
boolean isSimulation()
|
||||
{
|
||||
return ((ContainerCraftConfirm) inventorySlots).simulation;
|
||||
}
|
||||
|
||||
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
|
||||
xSize = 238;
|
||||
ySize = 206;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
|
||||
if ( te instanceof WirelessTerminalGuiObject )
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
if ( te instanceof PartTerminal )
|
||||
OriginalGui = GuiBridge.GUI_ME;
|
||||
|
||||
if ( te instanceof PartCraftingTerminal )
|
||||
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
|
||||
if ( te instanceof PartPatternTerminal )
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
|
||||
}
|
||||
|
||||
GuiButton cancel;
|
||||
GuiButton start;
|
||||
GuiButton selectcpu;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + ySize - 25, 50, 20, GuiText.Start.getLocal() );
|
||||
start.enabled = false;
|
||||
buttonList.add( start );
|
||||
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + (219 - 150) / 2, this.guiTop + ySize - 68, 150, 20, GuiText.CraftingCPU.getLocal() + ": "
|
||||
+ GuiText.Automatic );
|
||||
selectcpu.enabled = false;
|
||||
buttonList.add( selectcpu );
|
||||
|
||||
if ( OriginalGui != null )
|
||||
cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||
|
||||
buttonList.add( cancel );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( btn == cancel )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == start )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private long getTotal(IAEItemStack is)
|
||||
{
|
||||
IAEItemStack a = storage.findPrecise( is );
|
||||
IAEItemStack c = pending.findPrecise( is );
|
||||
IAEItemStack m = missing.findPrecise( is );
|
||||
|
||||
long total = 0;
|
||||
|
||||
if ( a != null )
|
||||
total += a.getStackSize();
|
||||
|
||||
if ( c != null )
|
||||
total += c.getStackSize();
|
||||
|
||||
if ( m != null )
|
||||
total += m.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;
|
||||
|
||||
case 2:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( missing, 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
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( key == 28 )
|
||||
{
|
||||
actionPerformed( start );
|
||||
}
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
setScrollBar();
|
||||
bindTexture( "guis/craftingreport.png" );
|
||||
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";
|
||||
start.enabled = isSimulation() ? false : true;
|
||||
selectcpu.enabled = isSimulation() ? false : true;
|
||||
|
||||
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
|
||||
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 = null;
|
||||
|
||||
if ( isSimulation() )
|
||||
dsp = GuiText.Simulation.getLocal();
|
||||
else
|
||||
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 );
|
||||
IAEItemStack missingStack = missing.findPrecise( refStack );
|
||||
|
||||
int lines = 0;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( pendingStack != null && pendingStack.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 ( missingStack != null && missingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( missingStack.getStackSize() );
|
||||
if ( missingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000 ) + "k";
|
||||
if ( missingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Missing.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.Missing.getLocal() + ": " + Long.toString( missingStack.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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -20,10 +22,15 @@ import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
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;
|
||||
|
||||
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
|
||||
@@ -37,21 +44,38 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, TileCraftingTile te) {
|
||||
super( new ContainerCraftingCPU( inventoryPlayer, te ) );
|
||||
this.ySize = 153;
|
||||
this.xSize = 195;
|
||||
this.ySize = 184;
|
||||
this.xSize = 238;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
}
|
||||
|
||||
GuiButton cancel;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( cancel == btn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
cancel = new GuiButton( 0, this.guiLeft + 163, this.guiTop + ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||
buttonList.add( cancel );
|
||||
}
|
||||
|
||||
private long getTotal(IAEItemStack is)
|
||||
@@ -163,12 +187,10 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
int size = 0;
|
||||
for (IAEItemStack l : visual)
|
||||
size++;
|
||||
int size = visual.size();
|
||||
|
||||
myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
|
||||
myScrollBar.setRange( 0, (size + 4) / 5 - rows, 1 );
|
||||
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
|
||||
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,17 +210,18 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
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 + 14 + x * 31;
|
||||
int minY = gy + 41 + y * 18;
|
||||
int minX = gx + 9 + x * 67;
|
||||
int minY = gy + 22 + y * yoff;
|
||||
|
||||
if ( minX < mouse_x && minX + 28 > mouse_x )
|
||||
if ( minX < mouse_x && minX + 67 > mouse_x )
|
||||
{
|
||||
if ( minY < mouse_y && minY + 20 > mouse_y )
|
||||
if ( minY < mouse_y && minY + yoff - 2 > mouse_y )
|
||||
{
|
||||
tooltip = z;
|
||||
break;
|
||||
@@ -208,7 +231,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 4 )
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
@@ -221,21 +244,24 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 7, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.CraftingStatus.getLocal(), 8, 7, 4210752 );
|
||||
|
||||
int sectionLength = 30;
|
||||
int sectionLength = 67;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int xo = 0 + 12;
|
||||
int yo = 0 + 42;
|
||||
int viewStart = 0;// myScrollBar.getCurrentScroll() * 5;
|
||||
int viewEnd = viewStart + 5 * 4;
|
||||
int xo = 0 + 9;
|
||||
int yo = 0 + 22;
|
||||
int viewStart = myScrollBar.getCurrentScroll() * 3;
|
||||
int viewEnd = viewStart + 3 * 6;
|
||||
|
||||
String ToolTip = "";
|
||||
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 );
|
||||
@@ -244,37 +270,100 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
|
||||
String str = Long.toString( refStack.getStackSize() );
|
||||
if ( refStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( refStack.getStackSize() / 1000 ) + "k";
|
||||
IAEItemStack stored = storage.findPrecise( refStack );
|
||||
IAEItemStack activeStack = active.findPrecise( refStack );
|
||||
IAEItemStack pendingStack = pending.findPrecise( refStack );
|
||||
|
||||
int w = fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * 18 + yo + 6) * 2),
|
||||
4210752 );
|
||||
int lines = 0;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( activeStack != null && activeStack.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.Stored.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.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if ( activeStack != null && activeStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( activeStack.getStackSize() );
|
||||
if ( activeStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000 ) + "k";
|
||||
if ( activeStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Crafting.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.Crafting.getLocal() + ": " + Long.toString( activeStack.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.Scheduled.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.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
int posX = x * sectionLength + xo + sectionLength - 18;
|
||||
int posY = y * 18 + yo;
|
||||
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
|
||||
int posY = y * offY + yo;
|
||||
|
||||
ItemStack is = refStack.copy().getItemStack();
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
{
|
||||
ToolTip = Platform.getItemDisplayName( is );
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
||||
if ( refStack.getCountRequestable() > 0 )
|
||||
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
|
||||
if ( lineList.size() > 0 )
|
||||
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||
|
||||
toolPosX = x * sectionLength + xo + sectionLength - 8;
|
||||
toolPosY = y * 18 + yo;
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
}
|
||||
|
||||
drawItem( posX, posY, is );
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 4 )
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
@@ -283,10 +372,10 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
}
|
||||
|
||||
if ( tooltip >= 0 && ToolTip.length() > 0 )
|
||||
if ( tooltip >= 0 && dspToolTip.length() > 0 )
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
drawTooltip( toolPosX, toolPosY + 10, 0, ToolTip );
|
||||
drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.crafting.CraftingJob;
|
||||
import appeng.crafting.ICraftingHost;
|
||||
import appeng.me.cache.CraftingCache;
|
||||
@@ -26,6 +37,21 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingH
|
||||
public Future<CraftingJob> job;
|
||||
public CraftingJob result;
|
||||
|
||||
@GuiSync(0)
|
||||
public long bytesUsed;
|
||||
|
||||
@GuiSync(1)
|
||||
public long cpuBytesAvail;
|
||||
|
||||
@GuiSync(2)
|
||||
public int cpuCoProcessors;
|
||||
|
||||
@GuiSync(3)
|
||||
public boolean autoStart = false;
|
||||
|
||||
@GuiSync(4)
|
||||
public boolean simulation = true;
|
||||
|
||||
public ContainerCraftConfirm(InventoryPlayer ip, ITerminalHost te) {
|
||||
super( ip, te );
|
||||
priHost = te;
|
||||
@@ -40,12 +66,83 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingH
|
||||
try
|
||||
{
|
||||
result = job.get();
|
||||
|
||||
if ( !result.isSimulation() )
|
||||
{
|
||||
CraftingCache cc = getGrid().getCache( CraftingCache.class );
|
||||
cc.submitJob( result, null, getActionSrc() );
|
||||
AELog.info( "Job info is ready!" );
|
||||
this.isContainerValid = false;
|
||||
simulation = false;
|
||||
if ( autoStart )
|
||||
{
|
||||
startJob();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
simulation = true;
|
||||
|
||||
try
|
||||
{
|
||||
PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
|
||||
PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
PacketMEInventoryUpdate c = result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
|
||||
IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||
result.tree.getPlan( plan );
|
||||
|
||||
bytesUsed = result.getByteTotal();
|
||||
|
||||
for (IAEItemStack out : plan)
|
||||
{
|
||||
IAEItemStack m = null;
|
||||
|
||||
IAEItemStack o = out.copy();
|
||||
o.reset();
|
||||
o.setStackSize( out.getStackSize() );
|
||||
|
||||
IAEItemStack p = out.copy();
|
||||
p.reset();
|
||||
p.setStackSize( out.getCountRequestable() );
|
||||
|
||||
IStorageGrid sg = getGrid().getCache( IStorageGrid.class );
|
||||
IMEInventory<IAEItemStack> itemsg = sg.getItemInventory();
|
||||
|
||||
if ( c != null && result.isSimulation() )
|
||||
{
|
||||
m = o.copy();
|
||||
o = itemsg.extractItems( o, Actionable.SIMULATE, mySrc );
|
||||
|
||||
if ( o == null )
|
||||
{
|
||||
o = m.copy();
|
||||
o.setStackSize( 0 );
|
||||
}
|
||||
|
||||
m.setStackSize( m.getStackSize() - o.getStackSize() );
|
||||
}
|
||||
|
||||
if ( o.getStackSize() > 0 )
|
||||
a.appendItem( o );
|
||||
|
||||
if ( p.getStackSize() > 0 )
|
||||
b.appendItem( p );
|
||||
|
||||
if ( c != null && m != null && m.getStackSize() > 0 )
|
||||
c.appendItem( m );
|
||||
}
|
||||
|
||||
for (Object g : this.crafters)
|
||||
{
|
||||
if ( g instanceof EntityPlayer )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
|
||||
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
|
||||
if ( c != null )
|
||||
NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
@@ -61,6 +158,16 @@ public class ContainerCraftConfirm extends AEBaseContainer implements ICraftingH
|
||||
verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
}
|
||||
|
||||
public void startJob()
|
||||
{
|
||||
if ( result != null && simulation == false )
|
||||
{
|
||||
CraftingCache cc = getGrid().getCache( CraftingCache.class );
|
||||
cc.submitJob( result, null, getActionSrc() );
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
isContainerValid = false;
|
||||
}
|
||||
|
||||
public void cancelCrafting()
|
||||
{
|
||||
if ( monitor != null )
|
||||
{
|
||||
monitor.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void findNode(IGridHost host, ForgeDirection d)
|
||||
{
|
||||
if ( network == null )
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ContainerPriority extends AEBaseContainer
|
||||
}
|
||||
|
||||
@GuiSync(2)
|
||||
long PriorityValue = -1;
|
||||
public long PriorityValue = -1;
|
||||
|
||||
public void setPriority(int newValue, EntityPlayer player)
|
||||
{
|
||||
@@ -45,6 +45,7 @@ public class ContainerPriority extends AEBaseContainer
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
@Mod(modid = AppEng.modid, name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies)
|
||||
@Mod(modid = AppEng.modid, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies)
|
||||
public class AppEng
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ public class AppEng
|
||||
|
||||
AELog.info( "Starting ( PreInit )" );
|
||||
|
||||
CreativeTab.init();
|
||||
CreativeTab.init();
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) )
|
||||
CreativeTabFacade.init();
|
||||
|
||||
|
||||
@@ -30,7 +30,9 @@ public enum GuiText
|
||||
|
||||
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether, inWorldPurificationFluix, inWorldSingularity, ChargedQuartz,
|
||||
|
||||
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty, ConfirmCrafting;
|
||||
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;
|
||||
|
||||
String root;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.crafting.CraftingJob;
|
||||
import appeng.me.cache.CraftingCache;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
@@ -34,6 +33,7 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
{
|
||||
|
||||
final public IAEItemStack slotItem;
|
||||
final public boolean heldShift;
|
||||
final public static ExecutorService craftingPool;
|
||||
|
||||
static
|
||||
@@ -53,6 +53,7 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
|
||||
// automatic.
|
||||
public PacketCraftRequest(ByteBuf stream) throws IOException {
|
||||
heldShift = stream.readBoolean();
|
||||
slotItem = AEItemStack.loadItemStackFromPacket( stream );
|
||||
}
|
||||
|
||||
@@ -74,8 +75,6 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
if ( g == null )
|
||||
return;
|
||||
|
||||
CraftingCache cc = g.getCache( CraftingCache.class );
|
||||
|
||||
try
|
||||
{
|
||||
CraftingJob cj = new CraftingJob( cca.getWorld(), cca, slotItem, Actionable.SIMULATE );
|
||||
@@ -89,6 +88,7 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
if ( player.openContainer instanceof ContainerCraftConfirm )
|
||||
{
|
||||
ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
|
||||
ccc.autoStart = heldShift;
|
||||
ccc.job = craftingPool.submit( cj, cj );
|
||||
cca.detectAndSendChanges();
|
||||
}
|
||||
@@ -103,13 +103,15 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
}
|
||||
}
|
||||
|
||||
public PacketCraftRequest(ItemStack stack, int parseInt) throws IOException {
|
||||
public PacketCraftRequest(ItemStack stack, int parseInt, boolean shift) throws IOException {
|
||||
this.slotItem = AEApi.instance().storage().createItemStack( stack );
|
||||
this.slotItem.setStackSize( parseInt );
|
||||
this.heldShift = shift;
|
||||
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( getPacketID() );
|
||||
data.writeBoolean( shift );
|
||||
slotItem.writeToPacket( data );
|
||||
|
||||
configureWrite( data );
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||
@@ -89,6 +90,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
{
|
||||
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
if ( gs instanceof GuiCraftConfirm )
|
||||
((GuiCraftConfirm) gs).postUpdate( list, ref );
|
||||
|
||||
if ( gs instanceof GuiCraftingCPU )
|
||||
((GuiCraftingCPU) gs).postUpdate( list, ref );
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigureableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
@@ -53,6 +55,18 @@ public class PacketValueConfig extends AppEngPacket
|
||||
si.onWheel( is, Value.equals( "WheelUp" ) );
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "Terminal.Start" ) && c instanceof ContainerCraftConfirm )
|
||||
{
|
||||
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
|
||||
qk.startJob();
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "TileCrafting.Cancel" ) && c instanceof ContainerCraftingCPU )
|
||||
{
|
||||
ContainerCraftingCPU qk = (ContainerCraftingCPU) c;
|
||||
qk.cancelCrafting();
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
|
||||
{
|
||||
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
|
||||
|
||||
@@ -193,7 +193,7 @@ public class CraftingTreeNode
|
||||
{
|
||||
if ( missing > 0 )
|
||||
job.addMissing( getStack( missing ) );
|
||||
missing = 0;
|
||||
// missing = 0;
|
||||
|
||||
job.addBytes( 8 + bytes );
|
||||
|
||||
@@ -228,4 +228,20 @@ public class CraftingTreeNode
|
||||
for (CraftingTreeProcess pro : nodes)
|
||||
pro.setJob( storage, craftingCPUCluster, src );
|
||||
}
|
||||
|
||||
public void getPlan(IItemList<IAEItemStack> plan)
|
||||
{
|
||||
if ( missing > 0 )
|
||||
{
|
||||
IAEItemStack o = what.copy();
|
||||
o.setStackSize( missing );
|
||||
plan.add( o );
|
||||
}
|
||||
|
||||
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.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.me.cache.CraftingCache;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
@@ -202,4 +203,17 @@ public class CraftingTreeProcess
|
||||
for (CraftingTreeNode pro : nodes.keySet())
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package appeng.integration.modules;
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public class RFItem extends BaseModule implements IIntegrationModule
|
||||
{
|
||||
|
||||
public static RFItem instance;
|
||||
|
||||
public RFItem() {
|
||||
TestClass( cofh.api.energy.IEnergyContainerItem.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,8 +178,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
private boolean dissassembleDrive(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
{
|
||||
@@ -213,4 +212,17 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
dissassembleDrive( stack, world, player );
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return dissassembleDrive( stack, world, player );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
double d3 = 32.0D;
|
||||
|
||||
Vec3 vec31 = vec3.addVector( (double) f7 * d3, (double) f6 * d3, (double) f8 * d3 );
|
||||
Vec3 direction = vec3.createVectorHelper( (double) f7 * d3, (double) f6 * d3, (double) f8 * d3 );
|
||||
Vec3 direction = Vec3.createVectorHelper( (double) f7 * d3, (double) f6 * d3, (double) f8 * d3 );
|
||||
|
||||
float penitration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
if ( penitration <= 0 )
|
||||
|
||||
@@ -20,10 +20,10 @@ public class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charge(ItemStack is, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
public double charge(ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
{
|
||||
int addedAmt = amount;
|
||||
int limit = getTransferLimit( is );
|
||||
double addedAmt = amount;
|
||||
double limit = getTransferLimit( is );
|
||||
|
||||
if ( !ignoreTransferLimit && amount > limit )
|
||||
addedAmt = limit;
|
||||
@@ -32,25 +32,25 @@ public class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
|
||||
public double discharge(ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externaly, boolean simulate)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharge(ItemStack is)
|
||||
public double getCharge(ItemStack is)
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse(ItemStack is, int amount)
|
||||
public boolean canUse(ItemStack is, double amount)
|
||||
{
|
||||
return getCharge( is ) > amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use(ItemStack is, int amount, EntityLivingBase entity)
|
||||
public boolean use(ItemStack is, double amount, EntityLivingBase entity)
|
||||
{
|
||||
if ( canUse( is, amount ) )
|
||||
{
|
||||
@@ -92,9 +92,9 @@ public class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCharge(ItemStack itemStack)
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, getAEMaxPower( itemStack ) );
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, getAEMaxPower( itemStack ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,7 +104,7 @@ public class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransferLimit(ItemStack itemStack)
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return Math.max( 32, getMaxCharge( itemStack ) / 200 );
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import appeng.api.config.PowerUnits;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", iname = "RF")
|
||||
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", iname = "RFItem")
|
||||
public class RedstoneFlux extends IC2 implements IEnergyContainerItem
|
||||
{
|
||||
|
||||
|
||||
+2
-2
@@ -40,10 +40,10 @@ public class Grid implements IGrid
|
||||
caches.put( c, new GridCacheWrapper( myCaches.get( c ) ) );
|
||||
}
|
||||
|
||||
postEvent( new MENetworkPostCacheConstruction() );
|
||||
|
||||
TickHandler.instance.addNetwork( this );
|
||||
center.setGrid( this );
|
||||
|
||||
postEvent( new MENetworkPostCacheConstruction() );
|
||||
}
|
||||
|
||||
public Set<Class<? extends IGridHost>> getMachineClasses()
|
||||
|
||||
Vendored
+8
-4
@@ -18,6 +18,7 @@ import appeng.api.networking.crafting.ICraftingMedium;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkCraftingCpuChange;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
@@ -43,7 +44,10 @@ public class CraftingCache implements IGridCache, ICraftingProviderHelper, ICell
|
||||
|
||||
HashSet<CraftingCPUCluster> cpuClusters = new HashSet();
|
||||
HashSet<ICraftingProvider> providers = new HashSet();
|
||||
|
||||
IGrid grid;
|
||||
IStorageGrid sg;
|
||||
IEnergyGrid eg;
|
||||
|
||||
HashMap<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap();
|
||||
HashMap<IAEItemStack, Set<ICraftingPatternDetails>> craftableItems = new HashMap();
|
||||
@@ -57,7 +61,9 @@ public class CraftingCache implements IGridCache, ICraftingProviderHelper, ICell
|
||||
@MENetworkEventSubscribe
|
||||
public void afterCacheConstruction(MENetworkPostCacheConstruction cc)
|
||||
{
|
||||
IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||
sg = grid.getCache( IStorageGrid.class );
|
||||
eg = grid.getCache( IEnergyGrid.class );
|
||||
|
||||
sg.registerCellProvider( this );
|
||||
}
|
||||
|
||||
@@ -71,7 +77,7 @@ public class CraftingCache implements IGridCache, ICraftingProviderHelper, ICell
|
||||
}
|
||||
|
||||
for (CraftingCPUCluster cpu : cpuClusters)
|
||||
cpu.updateCraftingLogic( grid, this );
|
||||
cpu.updateCraftingLogic( grid, eg, this );
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -138,8 +144,6 @@ public class CraftingCache implements IGridCache, ICraftingProviderHelper, ICell
|
||||
|
||||
private void updatePatterns()
|
||||
{
|
||||
IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||
|
||||
// update the stuff that was in the list...
|
||||
for (IAEItemStack out : craftableItems.keySet())
|
||||
{
|
||||
|
||||
@@ -13,12 +13,14 @@ import net.minecraft.world.WorldServer;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
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.ICraftingMedium;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkCraftingCpuChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
@@ -299,14 +301,6 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||
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)
|
||||
{
|
||||
for (IAEItemStack g : condencedInputs)
|
||||
@@ -346,7 +340,14 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateCraftingLogic(IGrid grid, CraftingCache cc)
|
||||
public void cancel()
|
||||
{
|
||||
isComplete = true;
|
||||
tasks.clear();
|
||||
waitingFor.resetStatus();
|
||||
}
|
||||
|
||||
public void updateCraftingLogic(IGrid grid, IEnergyGrid eg, CraftingCache cc)
|
||||
{
|
||||
if ( isComplete )
|
||||
{
|
||||
@@ -377,7 +378,7 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||
if ( waiting || tasks.isEmpty() ) // nothing to do here...
|
||||
return;
|
||||
|
||||
int remainingOperations = accelerator + 1;
|
||||
int remainingOperations = accelerator + 1 + 90;
|
||||
boolean didsomething = false;
|
||||
|
||||
for (Entry<ICraftingPatternDetails, TaskProgress> e : tasks.entrySet())
|
||||
@@ -399,10 +400,22 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||
{
|
||||
if ( ic == null )
|
||||
{
|
||||
IAEItemStack[] input = details.getInputs();
|
||||
|
||||
double sum = 0;
|
||||
for (int x = 0; x < input.length; x++)
|
||||
{
|
||||
if ( input[x] != null )
|
||||
sum += input[x].getStackSize();
|
||||
}
|
||||
|
||||
// power...
|
||||
if ( eg.extractAEPower( sum, Actionable.MODULATE, PowerMultiplier.CONFIG ) < sum - 0.01 )
|
||||
continue;
|
||||
|
||||
ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
boolean found = false;
|
||||
|
||||
IAEItemStack[] input = details.getInputs();
|
||||
for (int x = 0; x < input.length; x++)
|
||||
{
|
||||
|
||||
@@ -609,4 +622,5 @@ public class CraftingCPUCluster implements IAECluster, IBaseMonitor<IAEItemStack
|
||||
is.setStackSize( 0 );
|
||||
return is;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -445,21 +446,39 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
if ( type == Actionable.MODULATE )
|
||||
{
|
||||
|
||||
is.stackSize = (int) maxStorage;
|
||||
if ( type == Actionable.MODULATE )
|
||||
EntityItem ei = new EntityItem( w, // w
|
||||
((side.offsetX != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetX * -0.3 + (double) x, // spawn
|
||||
((side.offsetY != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetY * -0.3 + (double) y, // spawn
|
||||
((side.offsetZ != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetZ * -0.3 + (double) z, // spawn
|
||||
is.copy() );
|
||||
|
||||
Entity result = ei;
|
||||
|
||||
ei.motionX = side.offsetX * 0.2;
|
||||
ei.motionY = side.offsetY * 0.2;
|
||||
ei.motionZ = side.offsetZ * 0.2;
|
||||
|
||||
if ( is.getItem().hasCustomEntity( is ) )
|
||||
{
|
||||
EntityItem ei = new EntityItem( w, // w
|
||||
((side.offsetX != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetX * -0.3 + (double) x, // spawn
|
||||
((side.offsetY != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetY * -0.3 + (double) y, // spawn
|
||||
((side.offsetZ != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetZ * -0.3 + (double) z, // spawn
|
||||
is.copy() );
|
||||
ei.motionX = side.offsetX * 0.2;
|
||||
ei.motionY = side.offsetY * 0.2;
|
||||
ei.motionZ = side.offsetZ * 0.2;
|
||||
w.spawnEntityInWorld( ei );
|
||||
result = is.getItem().createEntity( w, ei, is );
|
||||
if ( result != null )
|
||||
ei.setDead();
|
||||
else
|
||||
result = ei;
|
||||
}
|
||||
|
||||
if ( !w.spawnEntityInWorld( result ) )
|
||||
{
|
||||
result.setDead();
|
||||
worked = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
worked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
}
|
||||
|
||||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if ( !isInIC2() )
|
||||
return 0;
|
||||
@@ -125,7 +125,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
if ( part instanceof IEnergySink )
|
||||
{
|
||||
// use lower number cause ic2 deletes power it sends that isn't recieved.
|
||||
return ((IEnergySink) part).demandedEnergyUnits();
|
||||
return ((IEnergySink) part).getDemandedEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
|
||||
{
|
||||
if ( !isInIC2() )
|
||||
return amount;
|
||||
@@ -143,7 +143,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
IPart part = getPart( dir );
|
||||
if ( part instanceof IEnergySink )
|
||||
{
|
||||
return ((IEnergySink) part).injectEnergyUnits( directionFrom, amount );
|
||||
return ((IEnergySink) part).injectEnergy( directionFrom, amount, voltage );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput()
|
||||
public int getSinkTier()
|
||||
{
|
||||
return Integer.MAX_VALUE; // no real options here...
|
||||
}
|
||||
|
||||
@@ -147,4 +147,21 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceTier()
|
||||
{
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
IPart part = getPart( dir );
|
||||
if ( part instanceof IEnergySource )
|
||||
{
|
||||
return ((IEnergySource) part).getSourceTier();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,23 +37,31 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
}
|
||||
|
||||
// two packet buffering...
|
||||
double OutputPacketA;
|
||||
double OutputPacketB;
|
||||
double OutputEnergyA;
|
||||
double OutputEnergyB;
|
||||
|
||||
// two packet buffering...
|
||||
double OutputVoltageA;
|
||||
double OutputVoltageB;
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT( tag );
|
||||
tag.setDouble( "OutputPacket", OutputPacketA );
|
||||
tag.setDouble( "OutputPacket2", OutputPacketB );
|
||||
tag.setDouble( "OutputPacket", OutputEnergyA );
|
||||
tag.setDouble( "OutputPacket2", OutputEnergyB );
|
||||
tag.setDouble( "OutputVoltageA", OutputVoltageA );
|
||||
tag.setDouble( "OutputVoltageB", OutputVoltageB );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
OutputPacketA = tag.getDouble( "OutputPacket" );
|
||||
OutputPacketB = tag.getDouble( "OutputPacket2" );
|
||||
OutputEnergyA = tag.getDouble( "OutputPacket" );
|
||||
OutputEnergyB = tag.getDouble( "OutputPacket2" );
|
||||
OutputVoltageA = tag.getDouble( "OutputVoltageA" );
|
||||
OutputVoltageB = tag.getDouble( "OutputVoltageB" );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -79,7 +87,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
}
|
||||
|
||||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if ( output )
|
||||
return 0;
|
||||
@@ -88,7 +96,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
{
|
||||
for (PartP2PIC2Power t : getOutputs())
|
||||
{
|
||||
if ( t.OutputPacketA <= 0.0001 || t.OutputPacketB <= 0.0001 )
|
||||
if ( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 )
|
||||
{
|
||||
return 2048;
|
||||
}
|
||||
@@ -120,7 +128,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
};
|
||||
|
||||
@Override
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
|
||||
{
|
||||
TunnelCollection<PartP2PIC2Power> outs;
|
||||
try
|
||||
@@ -138,14 +146,14 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
LinkedList<PartP2PIC2Power> Options = new LinkedList();
|
||||
for (PartP2PIC2Power o : outs)
|
||||
{
|
||||
if ( o.OutputPacketA <= 0.01 )
|
||||
if ( o.OutputEnergyA <= 0.01 )
|
||||
Options.add( o );
|
||||
}
|
||||
|
||||
if ( Options.isEmpty() )
|
||||
{
|
||||
for (PartP2PIC2Power o : outs)
|
||||
if ( o.OutputPacketB <= 0.01 )
|
||||
if ( o.OutputEnergyB <= 0.01 )
|
||||
Options.add( o );
|
||||
}
|
||||
|
||||
@@ -160,17 +168,19 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
|
||||
PartP2PIC2Power x = (PartP2PIC2Power) Platform.pickRandom( Options );
|
||||
|
||||
if ( x != null && x.OutputPacketA <= 0.001 )
|
||||
if ( x != null && x.OutputEnergyA <= 0.001 )
|
||||
{
|
||||
QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
x.OutputPacketA = amount;
|
||||
x.OutputEnergyA = amount;
|
||||
x.OutputVoltageA = voltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( x != null && x.OutputPacketB <= 0.001 )
|
||||
if ( x != null && x.OutputEnergyB <= 0.001 )
|
||||
{
|
||||
QueueTunnelDrain( PowerUnits.EU, amount );
|
||||
x.OutputPacketB = amount;
|
||||
x.OutputEnergyB = amount;
|
||||
x.OutputVoltageB = voltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -178,28 +188,44 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput()
|
||||
public int getSinkTier()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
if ( output )
|
||||
return OutputPacketA;
|
||||
return OutputEnergyA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEnergy(double amount)
|
||||
{
|
||||
OutputPacketA -= amount;
|
||||
if ( OutputPacketA < 0.001 )
|
||||
OutputEnergyA -= amount;
|
||||
if ( OutputEnergyA < 0.001 )
|
||||
{
|
||||
OutputPacketA = OutputPacketB;
|
||||
OutputPacketB = 0;
|
||||
OutputEnergyA = OutputEnergyB;
|
||||
OutputEnergyB = 0;
|
||||
|
||||
OutputVoltageA = OutputVoltageB;
|
||||
OutputVoltageB = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceTier()
|
||||
{
|
||||
if ( output )
|
||||
return calculateTierFromVoltage( OutputVoltageA );
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int calculateTierFromVoltage(double voltage)
|
||||
{
|
||||
return ic2.api.energy.EnergyNet.instance.getTierFromPower( voltage );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,12 +55,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
{
|
||||
|
||||
static final int[] sides = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
static final ItemStack is = AEApi.instance().blocks().blockMolecularAssembler.stack( 1 );
|
||||
static final ItemStack assemblerStack = AEApi.instance().blocks().blockMolecularAssembler.stack( 1 );
|
||||
|
||||
private InventoryCrafting craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
private AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
|
||||
private IConfigManager settings = new ConfigManager( this );
|
||||
private UpgradeInventory upgrades = new UpgradeInventory( is, this, getUpgradeSlots() );
|
||||
private UpgradeInventory upgrades = new UpgradeInventory( assemblerStack, this, getUpgradeSlots() );
|
||||
|
||||
private ForgeDirection pushDirection = ForgeDirection.UNKNOWN;
|
||||
private ItemStack myPattern = null;
|
||||
@@ -216,8 +216,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
if ( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
World w = getWorldObj();
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
|
||||
if ( ph != null )
|
||||
{
|
||||
forcePlan = true;
|
||||
@@ -391,22 +391,22 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
switch (upgrades.getInstalledUpgrades( Upgrades.SPEED ))
|
||||
{
|
||||
case 0:
|
||||
progress += userPower( TicksSinceLastCall * 10 );
|
||||
progress += userPower( TicksSinceLastCall, 10, 1.0 );
|
||||
break;
|
||||
case 1:
|
||||
progress += userPower( TicksSinceLastCall * 13 );
|
||||
progress += userPower( TicksSinceLastCall, 13, 1.3 );
|
||||
break;
|
||||
case 2:
|
||||
progress += userPower( TicksSinceLastCall * 17 );
|
||||
progress += userPower( TicksSinceLastCall, 17, 1.7 );
|
||||
break;
|
||||
case 3:
|
||||
progress += userPower( TicksSinceLastCall * 20 );
|
||||
progress += userPower( TicksSinceLastCall, 20, 2.0 );
|
||||
break;
|
||||
case 4:
|
||||
progress += userPower( TicksSinceLastCall * 25 );
|
||||
progress += userPower( TicksSinceLastCall, 25, 2.5 );
|
||||
break;
|
||||
case 5:
|
||||
progress += userPower( TicksSinceLastCall * 50 );
|
||||
progress += userPower( TicksSinceLastCall, 50, 5.0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -459,11 +459,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IAEAppEn
|
||||
}
|
||||
}
|
||||
|
||||
private int userPower(int i)
|
||||
private int userPower(int ticksPassed, int bonusValue, double acceleratorTax)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (int) gridProxy.getEnergy().extractAEPower( i, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
return (int) (gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax);
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
|
||||
@@ -25,13 +25,13 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
|
||||
}
|
||||
|
||||
@Override
|
||||
final public double demandedEnergyUnits()
|
||||
final public double getDemandedEnergy()
|
||||
{
|
||||
return getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
||||
}
|
||||
|
||||
@Override
|
||||
final public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
final public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
|
||||
{
|
||||
// just store the excess in the current block, if I return the waste,
|
||||
// IC2 will just disintegrate it - Oct 20th 2013
|
||||
@@ -41,7 +41,7 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
|
||||
}
|
||||
|
||||
@Override
|
||||
final public int getMaxSafeInput()
|
||||
final public int getSinkTier()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@ public class ASMIntegration implements IClassTransformer
|
||||
integrationModules.add( IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC" );
|
||||
integrationModules.add( IntegrationSide.BOTH, "BuildCraft5 Power", null, "MJ5" );
|
||||
integrationModules.add( IntegrationSide.BOTH, "BuildCraft6 Power", null, "MJ6" );
|
||||
integrationModules.add( IntegrationSide.BOTH, "RedstoneFlux Power", null, "RF" );
|
||||
|
||||
integrationModules.add( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", null, "RF" );
|
||||
integrationModules.add( IntegrationSide.BOTH, "RedstoneFlux Power - Items", null, "RFItem" );
|
||||
|
||||
// integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT" );
|
||||
// integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, "UE" );
|
||||
// integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP" );
|
||||
|
||||
Reference in New Issue
Block a user