Fixed Crafting CPU Render.
Finished Crafting Confirm Screen Added logic to prevent crafting in cpus with too little storage.
This commit is contained in:
@@ -11,6 +11,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -37,6 +38,8 @@ import com.google.common.base.Joiner;
|
||||
public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerCraftConfirm ccc;
|
||||
|
||||
int rows = 5;
|
||||
|
||||
IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
@@ -63,6 +66,8 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
ySize = 206;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
|
||||
ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||
|
||||
if ( te instanceof WirelessTerminalGuiObject )
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
@@ -90,7 +95,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
start.enabled = false;
|
||||
buttonList.add( start );
|
||||
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + (219 - 150) / 2, this.guiTop + ySize - 68, 150, 20, GuiText.CraftingCPU.getLocal() + ": "
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + (219 - 180) / 2, this.guiTop + ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": "
|
||||
+ GuiText.Automatic );
|
||||
selectcpu.enabled = false;
|
||||
buttonList.add( selectcpu );
|
||||
@@ -101,11 +106,36 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
buttonList.add( cancel );
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic;
|
||||
if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
|
||||
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + ccc.selectedCpu;
|
||||
if ( ccc.noCPU )
|
||||
btnTextText = GuiText.NoCraftingCPUs.getLocal();
|
||||
|
||||
selectcpu.displayString = btnTextText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == selectcpu )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == cancel )
|
||||
{
|
||||
try
|
||||
@@ -273,7 +303,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
start.enabled = isSimulation() ? false : true;
|
||||
updateCPUButtonText();
|
||||
|
||||
start.enabled = ccc.noCPU || isSimulation() ? false : true;
|
||||
selectcpu.enabled = isSimulation() ? false : true;
|
||||
|
||||
int x = 0;
|
||||
@@ -315,9 +347,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
ContainerCraftConfirm c = (ContainerCraftConfirm) inventorySlots;
|
||||
|
||||
long BytesUsed = c.bytesUsed;
|
||||
long BytesUsed = ccc.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 );
|
||||
@@ -327,7 +357,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
if ( isSimulation() )
|
||||
dsp = GuiText.Simulation.getLocal();
|
||||
else
|
||||
dsp = c.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + c.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + c.cpuCoProcessors)
|
||||
dsp = ccc.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + ccc.cpuCoProcessors)
|
||||
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
|
||||
|
||||
int offset = (219 - fontRendererObj.getStringWidth( dsp )) / 2;
|
||||
|
||||
@@ -464,4 +464,22 @@ public class BusRenderHelper implements IPartRenderHelper
|
||||
az = dz == null ? ForgeDirection.SOUTH : dz;
|
||||
}
|
||||
|
||||
public double[] getBounds()
|
||||
{
|
||||
return new double[] { minX, minY, minZ, maxX, maxY, maxZ };
|
||||
}
|
||||
|
||||
public void setBounds(double[] bounds)
|
||||
{
|
||||
if ( bounds == null || bounds.length != 6 )
|
||||
return;
|
||||
|
||||
minX = bounds[0];
|
||||
minY = bounds[1];
|
||||
minZ = bounds[2];
|
||||
maxX = bounds[3];
|
||||
maxY = bounds[4];
|
||||
maxZ = bounds[5];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -524,10 +524,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -179,6 +179,7 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
|
||||
|
||||
BusRenderer.instance.renderer.blockAccess = renderer.blockAccess;
|
||||
renderer = BusRenderer.instance.renderer;
|
||||
BusRenderer.instance.renderer.isFacade = true;
|
||||
|
||||
preRenderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
@@ -242,6 +243,7 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
BusRenderer.instance.renderer.isFacade = false;
|
||||
|
||||
postRenderInWorld( renderer );
|
||||
|
||||
|
||||
+21
-11
@@ -19,14 +19,14 @@ import appeng.client.render.BusRenderer;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
|
||||
public class RenderBlockCrafting extends BaseBlockRender
|
||||
public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
{
|
||||
|
||||
protected RenderBlockCrafting(boolean useTesr, int range) {
|
||||
protected RenderBlockCraftingCPU(boolean useTesr, int range) {
|
||||
super( useTesr, range );
|
||||
}
|
||||
|
||||
public RenderBlockCrafting() {
|
||||
public RenderBlockCraftingCPU() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@@ -55,16 +55,17 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | (formed ? 8 : 0) );
|
||||
|
||||
IIcon nonForward = theIcon;
|
||||
if ( blk instanceof BlockCraftingMonitor )
|
||||
if ( isMonitor )
|
||||
nonForward = AEApi.instance().blocks().blockCraftingUnit.block().getIcon( 0, meta | (formed ? 8 : 0) );
|
||||
|
||||
if ( formed )
|
||||
{
|
||||
renderer = BusRenderer.instance.renderer;
|
||||
BusRenderHelper i = BusRenderHelper.instance;
|
||||
BusRenderer.instance.renderer.isFacade = true;
|
||||
|
||||
renderer.blockAccess = w;
|
||||
i.setPass( 0 );
|
||||
|
||||
i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
|
||||
try
|
||||
@@ -73,9 +74,9 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
t.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
float highX = isConnected( w, x, y, z, ForgeDirection.EAST ) ? 16 : 13.01f;
|
||||
float lowX = isConnected( w, x, y, z, ForgeDirection.WEST ) ? 0 : 2.99f;
|
||||
|
||||
@@ -100,9 +101,14 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
fso( side, highX, ForgeDirection.EAST ), fso( side, highY, ForgeDirection.UP ), fso( side, highZ, ForgeDirection.SOUTH ) );
|
||||
i.prepareBounds( renderer );
|
||||
|
||||
handleSide( blk, meta, x, y, z, i, renderer, ct.getForward().equals( side ) ? theIcon : nonForward, emitsLight, isMonitor, side, w );
|
||||
boolean LocalEmit = emitsLight;
|
||||
if ( blk instanceof BlockCraftingMonitor && !ct.getForward().equals( side ) )
|
||||
LocalEmit = false;
|
||||
|
||||
handleSide( blk, meta, x, y, z, i, renderer, ct.getForward().equals( side ) ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
|
||||
}
|
||||
|
||||
BusRenderer.instance.renderer.isFacade = false;
|
||||
i.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
i.normalRendering();
|
||||
|
||||
@@ -165,8 +171,6 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
return;
|
||||
|
||||
i.setFacesToRender( EnumSet.of( side ) );
|
||||
renderer = BusRenderer.instance.renderer;
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateWest = renderer.uvRotateTop = 0;
|
||||
|
||||
if ( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
|
||||
{
|
||||
@@ -200,12 +204,19 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
}
|
||||
}
|
||||
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
|
||||
for (ForgeDirection a : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if ( a == side || a == side.getOpposite() )
|
||||
continue;
|
||||
|
||||
if ( (side.offsetX != 0 || side.offsetZ != 0)
|
||||
&& (a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH) )
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
else if ( (side.offsetY != 0) && (a == ForgeDirection.EAST || a == ForgeDirection.WEST) )
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
else
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
|
||||
|
||||
double width = 3.0 / 16.0;
|
||||
|
||||
if ( !(i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999) )
|
||||
@@ -255,7 +266,6 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
i.prepareBounds( renderer );
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateWest = renderer.uvRotateTop = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -20,10 +20,10 @@ import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class RenderBlockCraftingMonitor extends RenderBlockCrafting
|
||||
public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
{
|
||||
|
||||
public RenderBlockCraftingMonitor() {
|
||||
public RenderBlockCraftingCPUMonitor() {
|
||||
super( true, 20 );
|
||||
}
|
||||
|
||||
@@ -67,8 +67,17 @@ public class RenderBlockCraftingMonitor extends RenderBlockCrafting
|
||||
private void tesrRenderScreen(Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais)
|
||||
{
|
||||
ForgeDirection side = cmt.getForward();
|
||||
|
||||
ForgeDirection walrus = side.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP;
|
||||
int spin = 0;
|
||||
|
||||
int max = 5;
|
||||
while (walrus != cmt.getUp() && max-- > 0)
|
||||
{
|
||||
spin++;
|
||||
walrus = Platform.rotateAround( walrus, side );
|
||||
}
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
ForgeDirection d = side;
|
||||
GL11.glTranslated( d.offsetX * 0.69, d.offsetY * 0.69, d.offsetZ * 0.69 );
|
||||
@@ -66,7 +66,8 @@ public enum ExtraBlockTextures
|
||||
BlockCraftingStorage1kFit("BlockCraftingStorageFit"), BlockCraftingStorage4kFit("BlockCraftingStorage4kFit"), BlockCraftingStorage16kFit(
|
||||
"BlockCraftingStorage16kFit"), BlockCraftingStorage64kFit("BlockCraftingStorage64kFit"),
|
||||
|
||||
BlockCraftingUnitRing("BlockCraftingUnitRing"), BlockCraftingUnitRingLong("BlockCraftingUnitRingLong"), BlockCraftingUnitFit("BlockCraftingUnitFit"),
|
||||
BlockCraftingUnitRing("BlockCraftingUnitRing"), BlockCraftingUnitRingLongRotated("BlockCraftingUnitRingLongRotated"), BlockCraftingUnitRingLong(
|
||||
"BlockCraftingUnitRingLong"), BlockCraftingUnitFit("BlockCraftingUnitFit"),
|
||||
|
||||
BlockCraftingMonitorOuter("BlockCraftingMonitorOuter"), BlockCraftingFitSolid("BlockCraftingFitSolid");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user