From 0387d30d1cbb0c86a3bc5997938fa27e6f831cea Mon Sep 17 00:00:00 2001 From: thatsIch Date: Fri, 25 Sep 2015 22:52:41 +0200 Subject: [PATCH] Reduce scope of variables --- src/main/java/appeng/block/AEBaseBlock.java | 24 +++++------- .../java/appeng/block/AEBaseItemBlock.java | 3 +- .../misc/BlockQuartzGrowthAccelerator.java | 5 +-- .../appeng/block/storage/BlockSkyChest.java | 2 +- .../java/appeng/client/gui/AEBaseGui.java | 8 ++-- .../gui/implementations/GuiCraftConfirm.java | 9 ++--- .../gui/implementations/GuiCraftingCPU.java | 13 +++---- .../gui/implementations/GuiCraftingTerm.java | 3 +- .../implementations/GuiInterfaceTerminal.java | 2 +- .../gui/implementations/GuiMEMonitorable.java | 2 +- .../gui/implementations/GuiNetworkStatus.java | 4 +- .../implementations/GuiVibrationChamber.java | 5 +-- .../appeng/client/render/BaseBlockRender.java | 14 +++---- .../appeng/client/render/BusRenderHelper.java | 2 +- .../client/render/CableRenderHelper.java | 2 +- .../render/blocks/RenderBlockCraftingCPU.java | 6 +-- .../render/blocks/RenderBlockPaint.java | 5 +-- .../render/blocks/RenderBlockSkyChest.java | 3 +- .../client/render/blocks/RenderMEChest.java | 2 +- .../client/render/blocks/RenderQNB.java | 4 +- .../render/blocks/RenderQuartzTorch.java | 39 ++++++++----------- .../render/blocks/RenderSpatialPylon.java | 2 +- .../client/render/effects/CraftingFx.java | 2 +- .../client/render/effects/EnergyFx.java | 2 +- .../client/render/items/PaintBallRender.java | 7 ++-- .../render/items/ToolBiometricCardRender.java | 6 +-- .../items/ToolColorApplicatorRender.java | 6 +-- .../appeng/container/AEBaseContainer.java | 3 +- .../ContainerCellWorkbench.java | 6 +-- .../ContainerCraftConfirm.java | 2 +- .../implementations/ContainerInscriber.java | 2 +- .../ContainerLevelEmitter.java | 4 +- .../ContainerNetworkStatus.java | 3 +- .../implementations/ContainerUpgradeable.java | 4 +- src/main/java/appeng/core/AEConfig.java | 6 +-- src/main/java/appeng/core/api/ApiPart.java | 3 +- .../registries/GridCacheRegistry.java | 3 +- src/main/java/appeng/core/sync/GuiBridge.java | 2 +- .../network/AppEngClientPacketHandler.java | 3 +- .../network/AppEngServerPacketHandler.java | 3 +- .../core/sync/packets/PacketCraftRequest.java | 3 +- src/main/java/appeng/debug/ToolDebugCard.java | 2 +- src/main/java/appeng/debug/ToolEraser.java | 2 +- src/main/java/appeng/fmp/FMPEvent.java | 5 +-- .../java/appeng/helpers/DualityInterface.java | 2 +- .../appeng/helpers/MultiCraftingTracker.java | 3 +- .../java/appeng/helpers/PatternHelper.java | 2 +- .../java/appeng/integration/modules/NEI.java | 2 +- .../items/storage/ItemSpatialStorageCell.java | 2 +- .../tools/powered/ToolColorApplicator.java | 2 +- .../items/tools/powered/ToolMassCannon.java | 6 +-- .../java/appeng/me/cache/PathGridCache.java | 2 +- .../appeng/me/cache/SpatialPylonCache.java | 17 +++----- .../implementations/CraftingCPUCluster.java | 2 +- .../implementations/QuantumCalculator.java | 3 +- .../implementations/QuantumCluster.java | 3 +- .../me/storage/MEIInventoryWrapper.java | 2 +- .../me/storage/MEMonitorIInventory.java | 4 +- .../me/storage/NetworkInventoryHandler.java | 3 +- .../java/appeng/parts/CableBusContainer.java | 3 +- .../automation/PartAnnihilationPlane.java | 6 +-- .../parts/automation/PartFormationPlane.java | 6 +-- .../parts/automation/PartImportBus.java | 4 +- .../parts/automation/PartLevelEmitter.java | 10 ++--- .../parts/layers/LayerISidedInventory.java | 7 ++-- .../appeng/parts/networking/PartCable.java | 4 +- .../parts/networking/PartDenseCable.java | 2 +- .../java/appeng/parts/p2p/PartP2PLiquids.java | 2 +- .../java/appeng/parts/p2p/PartP2PRFPower.java | 6 +-- .../java/appeng/parts/p2p/PartP2PTunnel.java | 3 +- .../java/appeng/tile/misc/TileInscriber.java | 3 +- .../appeng/tile/networking/TileCableBus.java | 3 +- .../tile/networking/TileCableBusTESR.java | 3 +- .../java/appeng/tile/storage/TileChest.java | 5 +-- .../java/appeng/tile/storage/TileDrive.java | 2 +- .../transformer/asm/ASMIntegration.java | 2 +- src/main/java/appeng/util/Platform.java | 26 +++++++++---- .../java/appeng/worldgen/MeteoritePlacer.java | 2 +- 78 files changed, 174 insertions(+), 218 deletions(-) diff --git a/src/main/java/appeng/block/AEBaseBlock.java b/src/main/java/appeng/block/AEBaseBlock.java index d9269667..ff066b01 100644 --- a/src/main/java/appeng/block/AEBaseBlock.java +++ b/src/main/java/appeng/block/AEBaseBlock.java @@ -408,21 +408,15 @@ public abstract class AEBaseBlock extends Block implements IAEFeature public void registerBlockIcons( IIconRegister iconRegistry ) { final BlockRenderInfo info = this.getRendererInstance(); - final FlippableIcon topIcon; - final FlippableIcon bottomIcon; - final FlippableIcon sideIcon; - final FlippableIcon eastIcon; - final FlippableIcon westIcon; - final FlippableIcon southIcon; - final FlippableIcon northIcon; + final FlippableIcon topIcon = this.optionalIcon( iconRegistry, this.getTextureName(), null ); + final FlippableIcon bottomIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Bottom", topIcon ); + final FlippableIcon sideIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Side", topIcon ); + final FlippableIcon eastIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "East", sideIcon ); + final FlippableIcon westIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "West", sideIcon ); + final FlippableIcon southIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Front", sideIcon ); + final FlippableIcon northIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Back", sideIcon ); - this.blockIcon = topIcon = this.optionalIcon( iconRegistry, this.getTextureName(), null ); - bottomIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Bottom", topIcon ); - sideIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Side", topIcon ); - eastIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "East", sideIcon ); - westIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "West", sideIcon ); - southIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Front", sideIcon ); - northIcon = this.optionalIcon( iconRegistry, this.getTextureName() + "Back", sideIcon ); + this.blockIcon = topIcon; info.updateIcons( bottomIcon, topIcon, northIcon, southIcon, eastIcon, westIcon ); } @@ -557,7 +551,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature final ForgeDirection forward = ori.getForward(); final ForgeDirection up = ori.getUp(); - ForgeDirection west = ForgeDirection.UNKNOWN; if( forward == null || up == null ) { @@ -568,6 +561,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ; int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX; + ForgeDirection west = ForgeDirection.UNKNOWN; for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS ) { if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z ) diff --git a/src/main/java/appeng/block/AEBaseItemBlock.java b/src/main/java/appeng/block/AEBaseItemBlock.java index 304dfb99..1099b5da 100644 --- a/src/main/java/appeng/block/AEBaseItemBlock.java +++ b/src/main/java/appeng/block/AEBaseItemBlock.java @@ -103,8 +103,6 @@ public class AEBaseItemBlock extends ItemBlock ForgeDirection up = ForgeDirection.UNKNOWN; ForgeDirection forward = ForgeDirection.UNKNOWN; - IOrientable ori = null; - if( this.blockType instanceof AEBaseTileBlock ) { if( this.blockType instanceof BlockLightDetector ) @@ -167,6 +165,7 @@ public class AEBaseItemBlock extends ItemBlock } } + IOrientable ori = null; if( this.blockType instanceof IOrientableBlock ) { ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, x, y, z ); diff --git a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java index 3b6270c6..f3c75c4d 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java @@ -84,13 +84,12 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr double ry = 0.5 + y; double rz = 0.5 + z; - double dx = 0; - double dz = 0; - rx += up.offsetX * d0; ry += up.offsetY * d0; rz += up.offsetZ * d0; + double dz = 0; + double dx = 0; switch( r.nextInt( 4 ) ) { case 0: diff --git a/src/main/java/appeng/block/storage/BlockSkyChest.java b/src/main/java/appeng/block/storage/BlockSkyChest.java index a34a2012..0845aa58 100644 --- a/src/main/java/appeng/block/storage/BlockSkyChest.java +++ b/src/main/java/appeng/block/storage/BlockSkyChest.java @@ -140,7 +140,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision public Iterable getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual ) { TileSkyChest sk = this.getTileEntity( w, x, y, z ); - double sc = 0.06; ForgeDirection o = ForgeDirection.UNKNOWN; if( sk != null ) @@ -152,6 +151,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision double offsetY = o.offsetY == 0 ? 0.06 : 0.0; double offsetZ = o.offsetZ == 0 ? 0.06 : 0.0; + double sc = 0.06; return Collections.singletonList( AxisAlignedBB.getBoundingBox( Math.max( 0.0, offsetX - o.offsetX * sc ), Math.max( 0.0, offsetY - o.offsetY * sc ), Math.max( 0.0, offsetZ - o.offsetZ * sc ), Math.min( 1.0, ( 1.0 - offsetX ) - o.offsetX * sc ), Math.min( 1.0, ( 1.0 - offsetY ) - o.offsetY * sc ), Math.min( 1.0, ( 1.0 - offsetZ ) - o.offsetZ * sc ) ) ); } diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index d4bcb4e2..f8fe6a65 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -818,14 +818,14 @@ public abstract class AEBaseGui extends GuiContainer float par2 = aes.yDisplayPosition; float par3 = uv_x * 16; float par4 = uv_y * 16; - float par5 = 16; - float par6 = 16; - float f = 0.00390625F; - float f1 = 0.00390625F; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ); + float f1 = 0.00390625F; + float f = 0.00390625F; + float par6 = 16; tessellator.addVertexWithUV( par1 + 0, par2 + par6, this.zLevel, ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ); + float par5 = 16; tessellator.addVertexWithUV( par1 + par5, par2 + par6, this.zLevel, ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ); tessellator.addVertexWithUV( par1 + par5, par2 + 0, this.zLevel, ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ); tessellator.addVertexWithUV( par1 + 0, par2 + 0, this.zLevel, ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java index 188f91ca..530445fa 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java @@ -138,15 +138,14 @@ public class GuiCraftConfirm extends AEBaseGui this.start.enabled = !( this.ccc.noCPU || this.isSimulation() ); this.selectCPU.enabled = !this.isSimulation(); - int x = 0; - int y = 0; - int gx = ( this.width - this.xSize ) / 2; int gy = ( this.height - this.ySize ) / 2; - int offY = 23; this.tooltip = -1; + int offY = 23; + int y = 0; + int x = 0; for( int z = 0; z <= 4 * 5; z++ ) { int minX = gx + 9 + x * 67; @@ -269,7 +268,6 @@ public class GuiCraftConfirm extends AEBaseGui int negY = ( ( lines - 1 ) * 5 ) / 2; int downY = 0; - boolean red = false; if( stored != null && stored.getStackSize() > 0 ) { @@ -295,6 +293,7 @@ public class GuiCraftConfirm extends AEBaseGui downY += 5; } + boolean red = false; if( missingStack != null && missingStack.getStackSize() > 0 ) { String str = Long.toString( missingStack.getStackSize() ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java index 52b217d9..09bd357f 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java @@ -154,15 +154,14 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource { this.cancel.enabled = !this.visual.isEmpty(); - int x = 0; - int y = 0; - final int gx = ( this.width - this.xSize ) / 2; final int gy = ( this.height - this.ySize ) / 2; - final int offY = 23; this.tooltip = -1; + final int offY = 23; + int y = 0; + int x = 0; for( int z = 0; z <= 4 * 5; z++ ) { int minX = gx + 9 + x * 67; @@ -192,7 +191,6 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource @Override public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY ) { - final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE; String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ); if( this.craftingCpu.eta > 0 && !this.visual.isEmpty() ) @@ -216,6 +214,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource int offY = 23; + final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE; for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ ) { IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z ); @@ -229,18 +228,18 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource final IAEItemStack pendingStack = this.pending.findPrecise( refStack ); int lines = 0; - boolean active = false; - boolean scheduled = false; if( stored != null && stored.getStackSize() > 0 ) { lines++; } + boolean active = false; if( activeStack != null && activeStack.getStackSize() > 0 ) { lines++; active = true; } + boolean scheduled = false; if( pendingStack != null && pendingStack.getStackSize() > 0 ) { lines++; diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java index 9cf53c18..ab2f8f51 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java @@ -66,8 +66,7 @@ public class GuiCraftingTerm extends GuiMEMonitorable if( s != null ) { - PacketInventoryAction p; - p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 ); + PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 ); NetworkHandler.instance.sendToServer( p ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index 259a409b..fb1dc120 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -98,7 +98,6 @@ public class GuiInterfaceTerminal extends AEBaseGui this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - int offset = 17; int ex = this.myScrollBar.getCurrentScroll(); Iterator o = this.inventorySlots.inventorySlots.iterator(); @@ -110,6 +109,7 @@ public class GuiInterfaceTerminal extends AEBaseGui } } + int offset = 17; for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ ) { Object lineObj = this.lines.get( ex + x ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index 6381c41e..7e406634 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -393,9 +393,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi @Override public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY ) { - int x_width = 197; this.bindTexture( this.getBackground() ); + int x_width = 197; this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 ); if( this.viewCell || ( this instanceof GuiSecurity ) ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java index bd9a2550..a08db67a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java @@ -91,14 +91,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource @Override public void drawScreen( int mouseX, int mouseY, float btn ) { - int x = 0; - int y = 0; int gx = ( this.width - this.xSize ) / 2; int gy = ( this.height - this.ySize ) / 2; this.tooltip = -1; + int y = 0; + int x = 0; for( int z = 0; z <= 4 * 5; z++ ) { int minX = gx + 14 + x * 31; diff --git a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java index fc2d16b3..1b9d8ba4 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java @@ -59,9 +59,6 @@ public class GuiVibrationChamber extends AEBaseGui this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - int k = 25; - int l = -15; - this.pb.setFullMsg( this.cvc.aePerTick * this.cvc.getCurrentProgress() / 100 + " AE/t" ); if( this.cvc.getCurrentProgress() > 0 ) @@ -69,6 +66,8 @@ public class GuiVibrationChamber extends AEBaseGui int i1 = this.cvc.getCurrentProgress(); this.bindTexture( "guis/vibchamber.png" ); GL11.glColor3f( 1, 1, 1 ); + int l = -15; + int k = 25; this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 ); } } diff --git a/src/main/java/appeng/client/render/BaseBlockRender.java b/src/main/java/appeng/client/render/BaseBlockRender.java index 1af5a882..35ec7ad9 100644 --- a/src/main/java/appeng/client/render/BaseBlockRender.java +++ b/src/main/java/appeng/client/render/BaseBlockRender.java @@ -415,15 +415,13 @@ public class BaseBlockRender public void preRenderInWorld( B block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer ) { - ForgeDirection forward = ForgeDirection.SOUTH; - ForgeDirection up = ForgeDirection.UP; BlockRenderInfo info = block.getRendererInstance(); IOrientable te = this.getOrientable( block, world, x, y, z ); if( te != null ) { - forward = te.getForward(); - up = te.getUp(); + ForgeDirection forward = te.getForward(); + ForgeDirection up = te.getUp(); renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, forward, up ) ); renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, forward, up ) ); @@ -510,9 +508,7 @@ public class BaseBlockRender double offsetY = 0.0; double offsetZ = 0.0; double layerAX = 0.0; - double layerAY = 0.0; double layerAZ = 0.0; - double layerBX = 0.0; double layerBY = 0.0; double layerBZ = 0.0; @@ -569,6 +565,8 @@ public class BaseBlockRender offsetY += y; offsetZ += z; + double layerBX = 0.0; + double layerAY = 0.0; this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ, // u -> u 0, 1.0, @@ -681,11 +679,11 @@ public class BaseBlockRender public void renderTile( B block, T tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer ) { - ForgeDirection forward = ForgeDirection.SOUTH; - ForgeDirection up = ForgeDirection.UP; renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0; + ForgeDirection up = ForgeDirection.UP; + ForgeDirection forward = ForgeDirection.SOUTH; this.applyTESRRotation( x, y, z, forward, up ); Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture ); diff --git a/src/main/java/appeng/client/render/BusRenderHelper.java b/src/main/java/appeng/client/render/BusRenderHelper.java index 9ecf4485..8e97dcb7 100644 --- a/src/main/java/appeng/client/render/BusRenderHelper.java +++ b/src/main/java/appeng/client/render/BusRenderHelper.java @@ -396,7 +396,6 @@ public final class BusRenderHelper implements IPartRenderHelper { ForgeDirection forward = this.az; ForgeDirection up = this.ay; - ForgeDirection west = ForgeDirection.UNKNOWN; if( forward == null || up == null ) { @@ -407,6 +406,7 @@ public final class BusRenderHelper implements IPartRenderHelper int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ; int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX; + ForgeDirection west = ForgeDirection.UNKNOWN; for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS ) { if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z ) diff --git a/src/main/java/appeng/client/render/CableRenderHelper.java b/src/main/java/appeng/client/render/CableRenderHelper.java index 06a6ce20..cd36efe3 100644 --- a/src/main/java/appeng/client/render/CableRenderHelper.java +++ b/src/main/java/appeng/client/render/CableRenderHelper.java @@ -122,9 +122,9 @@ public class CableRenderHelper IFacadePart fPart = iFacadeContainer.getFacade( s ); if( fPart != null ) { - AxisAlignedBB b = null; fPart.setThinFacades( useThinFacades ); AxisAlignedBB pb = fPart.getPrimaryBox(); + AxisAlignedBB b = null; for( AxisAlignedBB bb : boxes ) { if( bb.intersectsWith( pb ) ) diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java index 6bb4173c..32970982 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java @@ -57,7 +57,6 @@ public class RenderBlockCraftingCPU 15.999 ) ) { + double width = 3.0 / 16.0; switch( a ) { case DOWN: diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockPaint.java b/src/main/java/appeng/client/render/blocks/RenderBlockPaint.java index 8017a454..f5005998 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockPaint.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockPaint.java @@ -63,11 +63,8 @@ public class RenderBlockPaint extends BaseBlockRender Tessellator tess = Tessellator.instance; - int lumen = 14 << 20 | 14 << 4; int brightness = imb.getMixedBrightnessForBlock( world, x, y, z ); - double offsetConstant = 0.001; - EnumSet validSides = EnumSet.noneOf( ForgeDirection.class ); for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS ) @@ -78,6 +75,8 @@ public class RenderBlockPaint extends BaseBlockRender } } + double offsetConstant = 0.001; + int lumen = 14 << 20 | 14 << 4; for( Splotch s : tp.getDots() ) { if( !validSides.contains( s.side ) ) diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockSkyChest.java b/src/main/java/appeng/client/render/blocks/RenderBlockSkyChest.java index 3637ed72..48249c87 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockSkyChest.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockSkyChest.java @@ -61,12 +61,11 @@ public class RenderBlockSkyChest extends BaseBlockRender this.selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 ); - int offsetU = -4; int offsetV = 8; if( stat == 0 ) { @@ -96,6 +95,7 @@ public class RenderMEChest extends BaseBlockRender Tessellator.instance.setBrightness( b ); Tessellator.instance.setColorOpaque_I( 0xffffff ); + int offsetU = -4; FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) ); if( forward == ForgeDirection.EAST && ( up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH ) ) { diff --git a/src/main/java/appeng/client/render/blocks/RenderQNB.java b/src/main/java/appeng/client/render/blocks/RenderQNB.java index 5bb8d152..f793cdde 100644 --- a/src/main/java/appeng/client/render/blocks/RenderQNB.java +++ b/src/main/java/appeng/client/render/blocks/RenderQNB.java @@ -118,8 +118,8 @@ public class RenderQNB extends BaseBlockRender { Tessellator tess = Tessellator.instance; - float Point2 = 6.0f / 16.0f; float Point3 = 7.0f / 16.0f; - float Point13 = 10.0f / 16.0f; float Point12 = 9.0f / 16.0f; - float singlePixel = 1.0f / 16.0f; float renderBottom = 5.0f / 16.0f; float renderTop = 10.0f / 16.0f; - float bottom = 7.0f / 16.0f; - float top = 8.0f / 16.0f; - float xOff = 0.0f; float yOff = 0.0f; float zOff = 0.0f; @@ -68,6 +62,7 @@ public class RenderQuartzTorch extends BaseBlockRender renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff ); this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer ); + float singlePixel = 1.0f / 16.0f; renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff ); this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer ); @@ -78,6 +73,10 @@ public class RenderQuartzTorch extends BaseBlockRender blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) ); renderer.renderAllFaces = true; + float top = 8.0f / 16.0f; + float bottom = 7.0f / 16.0f; + float Point13 = 10.0f / 16.0f; + float Point2 = 6.0f / 16.0f; renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff ); this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer ); @@ -100,23 +99,10 @@ public class RenderQuartzTorch extends BaseBlockRender { IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z ); - float Point2 = 6.0f / 16.0f; - float Point3 = 7.0f / 16.0f; - float Point13 = 10.0f / 16.0f; - float Point12 = 9.0f / 16.0f; - - float singlePixel = 1.0f / 16.0f; - float renderBottom = 5.0f / 16.0f; - float renderTop = 10.0f / 16.0f; - - float bottom = 7.0f / 16.0f; - float top = 8.0f / 16.0f; - - float xOff = 0.0f; - float yOff = 0.0f; - float zOff = 0.0f; - renderer.renderAllFaces = true; + float zOff = 0.0f; + float yOff = 0.0f; + float xOff = 0.0f; if( te != null ) { ForgeDirection forward = te.getUp(); @@ -125,10 +111,15 @@ public class RenderQuartzTorch extends BaseBlockRender zOff = forward.offsetZ * -( 4.0f / 16.0f ); } + float renderTop = 10.0f / 16.0f; + float renderBottom = 5.0f / 16.0f; + float Point12 = 9.0f / 16.0f; + float Point3 = 7.0f / 16.0f; renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff ); super.renderInWorld( block, world, x, y, z, renderer ); int r = ( x + y + z ) % 2; + float singlePixel = 1.0f / 16.0f; if( r == 0 ) { renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff ); @@ -148,6 +139,10 @@ public class RenderQuartzTorch extends BaseBlockRender block.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) ); + float top = 8.0f / 16.0f; + float bottom = 7.0f / 16.0f; + float Point13 = 10.0f / 16.0f; + float Point2 = 6.0f / 16.0f; renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff ); boolean out = renderer.renderStandardBlock( block, x, y, z ); diff --git a/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java b/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java index fc24e6ca..4f2d0a68 100644 --- a/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java +++ b/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java @@ -59,10 +59,10 @@ public class RenderSpatialPylon extends BaseBlockRender> 8 ) & 0xff; int b = ( colorValue ) & 0xff; - int full = (int) ( 255 * 0.3 ); - float fail = 0.7f; - if( item.getItemDamage() >= 20 ) { + float fail = 0.7f; + int full = (int) ( 255 * 0.3 ); GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 ); } else @@ -112,6 +110,7 @@ public class PaintBallRender implements IItemRenderer { GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); } + float f12 = 0.0625F; ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 ); GL11.glDisable( GL11.GL_CULL_FACE ); diff --git a/src/main/java/appeng/client/render/items/ToolBiometricCardRender.java b/src/main/java/appeng/client/render/items/ToolBiometricCardRender.java index d2203ae8..e7c20680 100644 --- a/src/main/java/appeng/client/render/items/ToolBiometricCardRender.java +++ b/src/main/java/appeng/client/render/items/ToolBiometricCardRender.java @@ -58,7 +58,6 @@ public class ToolBiometricCardRender implements IItemRenderer float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); - float f12 = 0.0625F; Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); @@ -83,6 +82,7 @@ public class ToolBiometricCardRender implements IItemRenderer else { GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); + float f12 = 0.0625F; ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 ); GL11.glDisable( GL11.GL_CULL_FACE ); @@ -111,7 +111,6 @@ public class ToolBiometricCardRender implements IItemRenderer GL11.glDisable( GL11.GL_LIGHTING ); tessellator.startDrawingQuads(); - float z = 0; AEColor col = AEColor.values()[Math.abs( 3 + hash ) % AEColor.values().length]; if( hash == 0 ) @@ -119,12 +118,12 @@ public class ToolBiometricCardRender implements IItemRenderer col = AEColor.Black; } + float z = 0; for( int x = 0; x < 8; x++ )// 8 { for( int y = 0; y < 6; y++ )// 6 { boolean isLit = false; - float scale = 0.3f / 255.0f; if( x == 0 || y == 0 || x == 7 || y == 5 ) { @@ -141,6 +140,7 @@ public class ToolBiometricCardRender implements IItemRenderer } else { + float scale = 0.3f / 255.0f; tessellator.setColorOpaque_F( ( ( col.blackVariant >> 16 ) & 0xff ) * scale, ( ( col.blackVariant >> 8 ) & 0xff ) * scale, ( col.blackVariant & 0xff ) * scale ); } diff --git a/src/main/java/appeng/client/render/items/ToolColorApplicatorRender.java b/src/main/java/appeng/client/render/items/ToolColorApplicatorRender.java index 17c1baee..91a0d81a 100644 --- a/src/main/java/appeng/client/render/items/ToolColorApplicatorRender.java +++ b/src/main/java/appeng/client/render/items/ToolColorApplicatorRender.java @@ -56,7 +56,6 @@ public class ToolColorApplicatorRender implements IItemRenderer float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); - float f12 = 0.0625F; Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); @@ -92,6 +91,7 @@ public class ToolColorApplicatorRender implements IItemRenderer { GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); } + float f12 = 0.0625F; ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 ); GL11.glDisable( GL11.GL_CULL_FACE ); @@ -112,9 +112,7 @@ public class ToolColorApplicatorRender implements IItemRenderer } GL11.glDisable( GL11.GL_LIGHTING ); - AEColor col = null; - - col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item ); + AEColor col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item ); if( col != null ) { diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index 8e156cd2..5213988a 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -475,7 +475,6 @@ public abstract class AEBaseContainer extends Container return null; } - ItemStack tis = null; AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots! if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible ) @@ -484,7 +483,7 @@ public abstract class AEBaseContainer extends Container } if( clickSlot != null && clickSlot.getHasStack() ) { - tis = clickSlot.getStack(); + ItemStack tis = clickSlot.getStack(); if( tis == null ) { diff --git a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java index f90a5422..5e47aa00 100644 --- a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java +++ b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java @@ -91,9 +91,6 @@ public class ContainerCellWorkbench extends ContainerUpgradeable @Override protected void setupConfig() { - int x = 8; - int y = 29; - int offset = 0; IInventory cell = this.upgradeable.getInventoryByName( "cell" ); this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) ); @@ -102,6 +99,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable IInventory upgradeInventory = new Upgrades(); // null, 3 * 8 ); + int offset = 0; + int y = 29; + int x = 8; for( int w = 0; w < 7; w++ ) { for( int z = 0; z < 9; z++ ) diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java index b995f8e5..679a3cc7 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java @@ -217,7 +217,6 @@ public class ContainerCraftConfirm extends AEBaseContainer for( IAEItemStack out : plan ) { - IAEItemStack m = null; IAEItemStack o = out.copy(); o.reset(); @@ -230,6 +229,7 @@ public class ContainerCraftConfirm extends AEBaseContainer IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class ); IMEInventory items = sg.getItemInventory(); + IAEItemStack m = null; if( c != null && this.result.isSimulation() ) { m = o.copy(); diff --git a/src/main/java/appeng/container/implementations/ContainerInscriber.java b/src/main/java/appeng/container/implementations/ContainerInscriber.java index 10f87d4a..91001f15 100644 --- a/src/main/java/appeng/container/implementations/ContainerInscriber.java +++ b/src/main/java/appeng/container/implementations/ContainerInscriber.java @@ -153,7 +153,6 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres if( ( s == this.top && bot != null ) || ( s == this.bottom && top != null ) ) { - boolean isValid = false; ItemStack otherSlot = null; if( s == this.top ) { @@ -172,6 +171,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres } // everything else + boolean isValid = false; for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() ) { if( Platform.isSameItemPrecise( recipe.getTopOptional().orNull(), otherSlot ) ) diff --git a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java index 5135344e..b280c446 100644 --- a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java +++ b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java @@ -76,8 +76,6 @@ public class ContainerLevelEmitter extends ContainerUpgradeable @Override protected void setupConfig() { - int x = 80 + 44; - int y = 40; IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); if( this.availableUpgrades() > 0 ) @@ -98,6 +96,8 @@ public class ContainerLevelEmitter extends ContainerUpgradeable } IInventory inv = this.upgradeable.getInventoryByName( "config" ); + int y = 40; + int x = 80 + 44; this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) ); } diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java index 6f083f67..b106291f 100644 --- a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java @@ -107,10 +107,9 @@ public class ContainerNetworkStatus extends AEBaseContainer this.maxPower = (long) ( 100.0 * eg.getMaxStoredPower() ); } - PacketMEInventoryUpdate piu; try { - piu = new PacketMEInventoryUpdate(); + PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate(); for( Class machineClass : this.network.getMachinesClasses() ) { diff --git a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java index b710b0fc..e9b4710e 100644 --- a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java +++ b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java @@ -133,11 +133,11 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl protected void setupConfig() { - int x = 80; - int y = 40; this.setupUpgrades(); IInventory inv = this.upgradeable.getInventoryByName( "config" ); + int y = 40; + int x = 80; this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) ); if( this.supportCapacity() ) diff --git a/src/main/java/appeng/core/AEConfig.java b/src/main/java/appeng/core/AEConfig.java index 5494eeef..2259d0df 100644 --- a/src/main/java/appeng/core/AEConfig.java +++ b/src/main/java/appeng/core/AEConfig.java @@ -115,14 +115,14 @@ public final class AEConfig extends Configuration implements IConfigurableObject FMLCommonHandler.instance().bus().register( this ); - final double DEFAULT_IC2_EXCHANGE = 2.0; - final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0; - final double DEFAULT_RF_EXCHANGE = 0.5; final double DEFAULT_MEKANISM_EXCHANGE = 0.2; PowerUnits.MK.conversionRatio = this.get( "PowerRatios", "Mekanism", DEFAULT_MEKANISM_EXCHANGE ).getDouble( DEFAULT_MEKANISM_EXCHANGE ); + final double DEFAULT_IC2_EXCHANGE = 2.0; PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE ); + final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0; PowerUnits.WA.conversionRatio = this.get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE ); + final double DEFAULT_RF_EXCHANGE = 0.5; PowerUnits.RF.conversionRatio = this.get( "PowerRatios", "ThermalExpansion", DEFAULT_RF_EXCHANGE ).getDouble( DEFAULT_RF_EXCHANGE ); double usageEffective = this.get( "PowerRatios", "UsageMultiplier", 1.0 ).getDouble( 1.0 ); diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index e1b992db..b87c409b 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -238,12 +238,11 @@ public class ApiPart implements IPartHelper public ClassNode getReader( String name ) { - ClassReader cr; String path = '/' + name.replace( ".", "/" ) + ".class"; InputStream is = this.getClass().getResourceAsStream( path ); try { - cr = new ClassReader( is ); + ClassReader cr = new ClassReader( is ); ClassNode cn = new ClassNode(); cr.accept( cn, ClassReader.EXPAND_FRAMES ); diff --git a/src/main/java/appeng/core/features/registries/GridCacheRegistry.java b/src/main/java/appeng/core/features/registries/GridCacheRegistry.java index 785eec00..78e1ef1c 100644 --- a/src/main/java/appeng/core/features/registries/GridCacheRegistry.java +++ b/src/main/java/appeng/core/features/registries/GridCacheRegistry.java @@ -54,10 +54,9 @@ public final class GridCacheRegistry implements IGridCacheRegistry for( Class iface : this.caches.keySet() ) { - Constructor c; try { - c = this.caches.get( iface ).getConstructor( IGrid.class ); + Constructor c = this.caches.get( iface ).getConstructor( IGrid.class ); map.put( iface, c.newInstance( g ) ); } catch( NoSuchMethodException e ) diff --git a/src/main/java/appeng/core/sync/GuiBridge.java b/src/main/java/appeng/core/sync/GuiBridge.java index 26ebfdeb..ba5533d8 100644 --- a/src/main/java/appeng/core/sync/GuiBridge.java +++ b/src/main/java/appeng/core/sync/GuiBridge.java @@ -544,7 +544,6 @@ public enum GuiBridge implements IGuiHandler { if( te instanceof IActionHost && this.requiredPermission != null ) { - boolean requirePower = false; IGridNode gn = ( (IActionHost) te ).getActionableNode(); if( gn != null ) @@ -552,6 +551,7 @@ public enum GuiBridge implements IGuiHandler IGrid g = gn.getGrid(); if( g != null ) { + boolean requirePower = false; if( requirePower ) { IEnergyGrid eg = g.getCache( IEnergyGrid.class ); diff --git a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java index 261d3108..9f554dda 100644 --- a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java @@ -40,13 +40,12 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement public void onPacketData( INetworkInfo network, FMLProxyPacket packet, EntityPlayer player ) { ByteBuf stream = packet.payload(); - int packetType = -1; player = Minecraft.getMinecraft().thePlayer; try { - packetType = stream.readInt(); + int packetType = stream.readInt(); AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream ); pack.clientPacketData( network, pack, player ); } diff --git a/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java b/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java index 2a9a51dc..5f166844 100644 --- a/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java @@ -39,11 +39,10 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp public void onPacketData( INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player ) { ByteBuf stream = packet.payload(); - int packetType = -1; try { - packetType = stream.readInt(); + int packetType = stream.readInt(); AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream ); pack.serverPacketData( manager, pack, player ); } diff --git a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java index e742af10..7151edf8 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java @@ -92,10 +92,9 @@ public class PacketCraftRequest extends AppEngPacket return; } - Future futureJob = null; - cca.whatToMake.setStackSize( this.amount ); + Future futureJob = null; try { ICraftingGrid cg = g.getCache( ICraftingGrid.class ); diff --git a/src/main/java/appeng/debug/ToolDebugCard.java b/src/main/java/appeng/debug/ToolDebugCard.java index 04368686..da802afa 100644 --- a/src/main/java/appeng/debug/ToolDebugCard.java +++ b/src/main/java/appeng/debug/ToolDebugCard.java @@ -98,13 +98,13 @@ public class ToolDebugCard extends AEBaseItem IPathingGrid pg = g.getCache( IPathingGrid.class ); if( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE ) { - int length = 0; Set next = new HashSet(); next.add( node ); int maxLength = 10000; + int length = 0; outer: while( !next.isEmpty() ) { diff --git a/src/main/java/appeng/debug/ToolEraser.java b/src/main/java/appeng/debug/ToolEraser.java index 4ff80aa6..411935d1 100644 --- a/src/main/java/appeng/debug/ToolEraser.java +++ b/src/main/java/appeng/debug/ToolEraser.java @@ -65,10 +65,10 @@ public class ToolEraser extends AEBaseItem Block blk = world.getBlock( x, y, z ); int meta = world.getBlockMetadata( x, y, z ); - int blocks = 0; List next = new LinkedList(); next.add( new WorldCoord( x, y, z ) ); + int blocks = 0; while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() ) { List c = next; diff --git a/src/main/java/appeng/fmp/FMPEvent.java b/src/main/java/appeng/fmp/FMPEvent.java index df92189e..0521f7b4 100644 --- a/src/main/java/appeng/fmp/FMPEvent.java +++ b/src/main/java/appeng/fmp/FMPEvent.java @@ -70,15 +70,14 @@ public class FMPEvent BlockCoord pos = new BlockCoord( hit.blockX, hit.blockY, hit.blockZ ).offset( hit.sideHit ); ItemStack held = player.getHeldItem(); - TMultiPart part = null; - - Block blk = null; if( held == null ) { return false; } + Block blk = null; + TMultiPart part = null; if( held.getItem() instanceof AEBaseItemBlock ) { AEBaseItemBlock ib = (AEBaseItemBlock) held.getItem(); diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java index 62214ea8..f94e30c9 100644 --- a/src/main/java/appeng/helpers/DualityInterface.java +++ b/src/main/java/appeng/helpers/DualityInterface.java @@ -633,10 +633,10 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn private boolean usePlan( int x, IAEItemStack itemStack ) { - boolean changed = false; InventoryAdaptor adaptor = this.getAdaptor( x ); this.isWorking = true; + boolean changed = false; try { this.destination = this.gridProxy.getStorage().getItemInventory(); diff --git a/src/main/java/appeng/helpers/MultiCraftingTracker.java b/src/main/java/appeng/helpers/MultiCraftingTracker.java index c3ad5d3c..03f6029e 100644 --- a/src/main/java/appeng/helpers/MultiCraftingTracker.java +++ b/src/main/java/appeng/helpers/MultiCraftingTracker.java @@ -99,10 +99,9 @@ public class MultiCraftingTracker } else if( craftingJob != null ) { - ICraftingJob job = null; - try { + ICraftingJob job = null; if( craftingJob.isDone() ) { job = craftingJob.get(); diff --git a/src/main/java/appeng/helpers/PatternHelper.java b/src/main/java/appeng/helpers/PatternHelper.java index 0ec7556e..6a3f3382 100644 --- a/src/main/java/appeng/helpers/PatternHelper.java +++ b/src/main/java/appeng/helpers/PatternHelper.java @@ -166,8 +166,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable defaultHandler = NEICraftingHandler.class; Method registrar = this.apiClass.getDeclaredMethod( "registerGuiOverlayHandler", Class.class, overlayHandler, String.class ); registerGuiOverlay.invoke( this.apiClass, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() ); registerGuiOverlay.invoke( this.apiClass, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() ); + Class defaultHandler = NEICraftingHandler.class; Constructor defaultConstructor = defaultHandler.getConstructor( int.class, int.class ); registrar.invoke( this.apiClass, GuiCraftingTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" ); registrar.invoke( this.apiClass, GuiPatternTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" ); diff --git a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java index b7241f90..4c3ce371 100644 --- a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java @@ -160,7 +160,6 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag int targetZ = max.z - min.z - 1; int maxSize = this.getMaxStoredDim( is ); - int floorBuffer = 64; World destination = this.getWorld( is ); if( ( scale.x == 0 && scale.y == 0 && scale.z == 0 ) || ( scale.x == targetX && scale.y == targetY && scale.z == targetZ ) ) @@ -172,6 +171,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag destination = this.createNewWorld( is ); } + int floorBuffer = 64; StorageHelper.getInstance().swapRegions( w, destination, min.x + 1, min.y + 1, min.z + 1, 1, floorBuffer + 1, 1, targetX - 1, targetY - 1, targetZ - 1 ); this.setStoredSize( is, targetX, targetY, targetZ ); diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java index f6414c1e..99dfa530 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java @@ -119,7 +119,6 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe public boolean onItemUse( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ ) { Block blk = w.getBlock( x, y, z ); - double powerPerUse = 100; ItemStack paintBall = this.getColor( is ); @@ -143,6 +142,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe return false; } + double powerPerUse = 100; if( paintBall != null && paintBall.getItem() instanceof ItemSnowball ) { ForgeDirection orientation = ForgeDirection.getOrientation( side ); diff --git a/src/main/java/appeng/items/tools/powered/ToolMassCannon.java b/src/main/java/appeng/items/tools/powered/ToolMassCannon.java index f198937c..eab1d9b6 100644 --- a/src/main/java/appeng/items/tools/powered/ToolMassCannon.java +++ b/src/main/java/appeng/items/tools/powered/ToolMassCannon.java @@ -211,9 +211,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell Entity entity = null; List list = w.getEntitiesWithinAABBExcludingEntity( p, bb ); double closest = 9999999.0D; - int l; - for( l = 0; l < list.size(); ++l ) + for( int l = 0; l < list.size(); ++l ) { Entity entity1 = (Entity) list.get( l ); @@ -335,9 +334,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell Entity entity = null; List list = w.getEntitiesWithinAABBExcludingEntity( p, bb ); double closest = 9999999.0D; - int l; - for( l = 0; l < list.size(); ++l ) + for( int l = 0; l < list.size(); ++l ) { Entity entity1 = (Entity) list.get( l ); diff --git a/src/main/java/appeng/me/cache/PathGridCache.java b/src/main/java/appeng/me/cache/PathGridCache.java index fea22d7a..1151d681 100644 --- a/src/main/java/appeng/me/cache/PathGridCache.java +++ b/src/main/java/appeng/me/cache/PathGridCache.java @@ -308,9 +308,9 @@ public class PathGridCache implements IPathingGrid private int calculateRequiredChannels() { - int depth = 0; this.semiOpen.clear(); + int depth = 0; for( IGridNode nodes : this.requireChannels ) { if( !this.semiOpen.contains( nodes ) ) diff --git a/src/main/java/appeng/me/cache/SpatialPylonCache.java b/src/main/java/appeng/me/cache/SpatialPylonCache.java index d801c88b..3f61905e 100644 --- a/src/main/java/appeng/me/cache/SpatialPylonCache.java +++ b/src/main/java/appeng/me/cache/SpatialPylonCache.java @@ -64,13 +64,6 @@ public class SpatialPylonCache implements ISpatialCache public void reset( IGrid grid ) { - int reqX = 0; - int reqY = 0; - int reqZ = 0; - int requirePylonBlocks = 1; - - double minPower = 0; - double maxPower = 0; this.clusters = new HashMap(); this.ioPorts = new LinkedList(); @@ -120,6 +113,8 @@ public class SpatialPylonCache implements ISpatialCache this.captureMax.z = Math.max( this.captureMax.z, cl.max.z ); } + double maxPower = 0; + double minPower = 0; if( this.hasRegion() ) { this.isValid = this.captureMax.x - this.captureMin.x > 1 && this.captureMax.y - this.captureMin.y > 1 && this.captureMax.z - this.captureMin.z > 1; @@ -149,10 +144,10 @@ public class SpatialPylonCache implements ISpatialCache } } - reqX = this.captureMax.x - this.captureMin.x; - reqY = this.captureMax.y - this.captureMin.y; - reqZ = this.captureMax.z - this.captureMin.z; - requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 ); + int reqX = this.captureMax.x - this.captureMin.x; + int reqY = this.captureMax.y - this.captureMin.y; + int reqZ = this.captureMax.z - this.captureMin.z; + int requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 ); this.efficiency = (double) pylonBlocks / (double) requirePylonBlocks; diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java index 249c8ef9..defbfa48 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java @@ -1292,12 +1292,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU this.lastTime = System.nanoTime(); this.elapsedTime = 0; - int itemCount = 0; final IItemList list = AEApi.instance().storage().createItemList(); this.getListOfItem( list, CraftingItemList.ACTIVE ); this.getListOfItem( list, CraftingItemList.PENDING ); + int itemCount = 0; for( IAEItemStack ge : list ) { itemCount += ge.getStackSize(); diff --git a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java index cae6c888..fc597d3e 100644 --- a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java +++ b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java @@ -128,9 +128,8 @@ public class QuantumCalculator extends MBCalculator { TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( x, y, z ); - byte flags; - num++; + byte flags; if( num == 5 ) { flags = num; diff --git a/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java b/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java index 6242fd5a..26a3bf17 100644 --- a/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java @@ -79,9 +79,8 @@ public class QuantumCluster implements ILocatable, IAECluster @Override public void updateStatus( boolean updateGrid ) { - long qe; - qe = this.center.getQEFrequency(); + long qe = this.center.getQEFrequency(); if( this.thisSide != qe && this.thisSide != -qe ) { diff --git a/src/main/java/appeng/me/storage/MEIInventoryWrapper.java b/src/main/java/appeng/me/storage/MEIInventoryWrapper.java index 8b72549f..ef9a4a6e 100644 --- a/src/main/java/appeng/me/storage/MEIInventoryWrapper.java +++ b/src/main/java/appeng/me/storage/MEIInventoryWrapper.java @@ -128,7 +128,6 @@ public class MEIInventoryWrapper implements IMEInventory @Override public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src ) { - ItemStack Gathered = null; ItemStack Req = request.getItemStack(); int request_stackSize = Req.stackSize; @@ -140,6 +139,7 @@ public class MEIInventoryWrapper implements IMEInventory Req.stackSize = request_stackSize; + ItemStack Gathered = null; if( this.adaptor != null ) { Gathered = this.adaptor.removeItems( Req.stackSize, Req, null ); diff --git a/src/main/java/appeng/me/storage/MEMonitorIInventory.java b/src/main/java/appeng/me/storage/MEMonitorIInventory.java index 376177b7..b6e0332a 100644 --- a/src/main/java/appeng/me/storage/MEMonitorIInventory.java +++ b/src/main/java/appeng/me/storage/MEMonitorIInventory.java @@ -141,12 +141,12 @@ public class MEMonitorIInventory implements IMEMonitor public TickRateModulation onTick() { - boolean changed = false; LinkedList changes = new LinkedList(); - int high = 0; this.list.resetStatus(); + int high = 0; + boolean changed = false; for( ItemSlot is : this.adaptor ) { CachedItemStack old = this.memory.get( is.slot ); diff --git a/src/main/java/appeng/me/storage/NetworkInventoryHandler.java b/src/main/java/appeng/me/storage/NetworkInventoryHandler.java index 6e6168a2..4de3f971 100644 --- a/src/main/java/appeng/me/storage/NetworkInventoryHandler.java +++ b/src/main/java/appeng/me/storage/NetworkInventoryHandler.java @@ -168,10 +168,9 @@ public class NetworkInventoryHandler> implements IMEInvent IGrid gn = n.getGrid(); if( gn != this.security.myGrid ) { - int playerID = -1; ISecurityGrid sg = gn.getCache( ISecurityGrid.class ); - playerID = sg.getOwner(); + int playerID = sg.getOwner(); if( !this.security.hasPermission( playerID, permission ) ) { diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index 1b7da191..2b43b1cd 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -921,11 +921,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I for( int x = 0; x < 7; x++ ) { - ItemStack is = null; IPart p = this.getPart( ForgeDirection.getOrientation( x ) ); if( p != null ) { - is = p.getItemStack( PartItemStack.Network ); + ItemStack is = p.getItemStack( PartItemStack.Network ); data.writeShort( Item.getIdFromItem( is.getItem() ) ); data.writeShort( is.getItemDamage() ); diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java index d56af452..4a709f6a 100644 --- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java @@ -161,9 +161,6 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab protected void renderStaticWithIcon( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, IIcon activeIcon ) { int minX = 1; - int minY = 1; - int maxX = 15; - int maxY = 15; final ForgeDirection e = rh.getWorldX(); final ForgeDirection u = rh.getWorldY(); @@ -175,16 +172,19 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab minX = 0; } + int maxX = 15; if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) ) { maxX = 16; } + int minY = 1; if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) ) { minY = 0; } + int maxY = 15; if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) ) { maxY = 16; diff --git a/src/main/java/appeng/parts/automation/PartFormationPlane.java b/src/main/java/appeng/parts/automation/PartFormationPlane.java index d7b943c5..f8e7e660 100644 --- a/src/main/java/appeng/parts/automation/PartFormationPlane.java +++ b/src/main/java/appeng/parts/automation/PartFormationPlane.java @@ -284,9 +284,6 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer ) { int minX = 1; - int minY = 1; - int maxX = 15; - int maxY = 15; ForgeDirection e = rh.getWorldX(); ForgeDirection u = rh.getWorldY(); @@ -298,16 +295,19 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine minX = 0; } + int maxX = 15; if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) ) { maxX = 16; } + int minY = 1; if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) ) { minY = 0; } + int maxY = 15; if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) ) { maxY = 16; diff --git a/src/main/java/appeng/parts/automation/PartImportBus.java b/src/main/java/appeng/parts/automation/PartImportBus.java index 2e2804e5..8b123c36 100644 --- a/src/main/java/appeng/parts/automation/PartImportBus.java +++ b/src/main/java/appeng/parts/automation/PartImportBus.java @@ -288,8 +288,6 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin private int calculateMaximumAmountToImport( InventoryAdaptor myAdaptor, IAEItemStack whatToImport, IMEMonitor inv, FuzzyMode fzMode ) { final int toSend = Math.min( this.itemToSend, 64 ); - final ItemStack simResult; - final IAEItemStack itemAmountNotStorable; final ItemStack itemStackToImport; if( whatToImport == null ) @@ -301,6 +299,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin itemStackToImport = whatToImport.getItemStack(); } + final IAEItemStack itemAmountNotStorable; + final ItemStack simResult; if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) { simResult = myAdaptor.simulateSimilarRemove( toSend, itemStackToImport, fzMode, this.configDestination( inv ) ); diff --git a/src/main/java/appeng/parts/automation/PartLevelEmitter.java b/src/main/java/appeng/parts/automation/PartLevelEmitter.java index 3419f8ac..bb37b805 100644 --- a/src/main/java/appeng/parts/automation/PartLevelEmitter.java +++ b/src/main/java/appeng/parts/automation/PartLevelEmitter.java @@ -433,9 +433,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH baseY += 7.0 / 16.0; - double par10 = 0; // double par11 = 0; - double Zero = 0; /* * double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 = @@ -475,9 +473,6 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH double var38 = baseX + 0.5D; double var40 = baseZ - 0.5D; double var42 = baseZ + 0.5D; - double var44 = 0.0625D; - double var422 = 0.1915D + 1.0 / 16.0; - double TorchLen = 0.625D; double toff = 0.0d; @@ -493,11 +488,16 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH var12.setBrightness( 11 << 20 | 11 << 4 ); } + double TorchLen = 0.625D; + double var44 = 0.0625D; + double Zero = 0; + double par10 = 0; this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20, var22 ); this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20, var26 ); this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24, var26 ); this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24, var22 ); + double var422 = 0.1915D + 1.0 / 16.0; this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24b, var22b ); this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24b, var26b ); this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20b, var26b ); diff --git a/src/main/java/appeng/parts/layers/LayerISidedInventory.java b/src/main/java/appeng/parts/layers/LayerISidedInventory.java index 610a94b4..e7252f54 100644 --- a/src/main/java/appeng/parts/layers/LayerISidedInventory.java +++ b/src/main/java/appeng/parts/layers/LayerISidedInventory.java @@ -59,11 +59,8 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory public void notifyNeighbors() { // cache of inventory state. - int[][] sideData = null; - List inventories = null; - List slots = null; - inventories = new ArrayList(); + List inventories = new ArrayList(); int slotCount = 0; for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS ) @@ -77,6 +74,8 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory } } + List slots = null; + int[][] sideData = null; if( inventories.isEmpty() || slotCount == 0 ) { inventories = null; diff --git a/src/main/java/appeng/parts/networking/PartCable.java b/src/main/java/appeng/parts/networking/PartCable.java index cd290b36..cc4a4800 100644 --- a/src/main/java/appeng/parts/networking/PartCable.java +++ b/src/main/java/appeng/parts/networking/PartCable.java @@ -464,10 +464,10 @@ public class PartCable extends AEBasePart implements IPartCable if( Platform.isServer() ) { IGridNode node = this.getGridNode(); - int howMany = 0; if( node != null ) { + int howMany = 0; for( IGridConnection gc : node.getConnections() ) { howMany = Math.max( gc.getUsedChannels(), howMany ); @@ -815,11 +815,11 @@ public class PartCable extends AEBasePart implements IPartCable TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; - boolean isGlass = false; AEColor myColor = this.getCableColor(); rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) ); + boolean isGlass = false; if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null && partHost.getColor() != AEColor.Transparent ) { isGlass = true; diff --git a/src/main/java/appeng/parts/networking/PartDenseCable.java b/src/main/java/appeng/parts/networking/PartDenseCable.java index 9d767491..c4b258fe 100644 --- a/src/main/java/appeng/parts/networking/PartDenseCable.java +++ b/src/main/java/appeng/parts/networking/PartDenseCable.java @@ -365,7 +365,6 @@ public class PartDenseCable extends PartCable TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ ); IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; - boolean isGlass = false; AEColor myColor = this.getCableColor(); /* * ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && @@ -434,6 +433,7 @@ public class PartDenseCable extends PartCable rh.renderBlock( x, y, z, renderer ); rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) ); + boolean isGlass = false; if( !isGlass ) { this.setSmartConnectionRotations( of, renderer ); diff --git a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java index f3c30e32..f41a4416 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java +++ b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java @@ -149,9 +149,9 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl } int available = resource.amount; - int used = 0; i = list.iterator(); + int used = 0; while( i.hasNext() ) { PartP2PLiquids l = i.next(); diff --git a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java index c0ac8505..554626c7 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java @@ -193,8 +193,6 @@ public final class PartP2PRFPower extends PartP2PTunnel implemen return 0; } - int total = 0; - Stack stack = this.getDepth(); for( PartP2PRFPower t : stack ) @@ -207,6 +205,7 @@ public final class PartP2PRFPower extends PartP2PTunnel implemen stack.push( this ); + int total = 0; try { for( PartP2PRFPower t : this.getOutputs() ) @@ -235,8 +234,6 @@ public final class PartP2PRFPower extends PartP2PTunnel implemen return 0; } - int total = 0; - Stack stack = this.getDepth(); for( PartP2PRFPower t : stack ) @@ -249,6 +246,7 @@ public final class PartP2PRFPower extends PartP2PTunnel implemen stack.push( this ); + int total = 0; try { for( PartP2PRFPower t : this.getOutputs() ) diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java index b4dd2fe0..62b69046 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java @@ -88,10 +88,9 @@ public abstract class PartP2PTunnel extends PartBasicSt return null; } - PartP2PTunnel tunnel; try { - tunnel = this.proxy.getP2P().getInput( this.freq ); + PartP2PTunnel tunnel = this.proxy.getP2P().getInput( this.freq ); if( this.getClass().isInstance( tunnel ) ) { return (T) tunnel; diff --git a/src/main/java/appeng/tile/misc/TileInscriber.java b/src/main/java/appeng/tile/misc/TileInscriber.java index 378ee140..94753f34 100644 --- a/src/main/java/appeng/tile/misc/TileInscriber.java +++ b/src/main/java/appeng/tile/misc/TileInscriber.java @@ -454,10 +454,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } else { - IEnergyGrid eg; try { - eg = this.gridProxy.getEnergy(); + IEnergyGrid eg = this.gridProxy.getEnergy(); IEnergySource src = this; // Base 1, increase by 1 for each card diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java index 6f9e2a8c..df0f3ea6 100644 --- a/src/main/java/appeng/tile/networking/TileCableBus.java +++ b/src/main/java/appeng/tile/networking/TileCableBus.java @@ -100,10 +100,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl { if( this.cb.requiresDynamicRender ) { - TileCableBus tcb; try { - tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance(); + TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance(); tcb.copyFrom( this ); this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb ); } diff --git a/src/main/java/appeng/tile/networking/TileCableBusTESR.java b/src/main/java/appeng/tile/networking/TileCableBusTESR.java index e0bb7368..f1fcabdc 100644 --- a/src/main/java/appeng/tile/networking/TileCableBusTESR.java +++ b/src/main/java/appeng/tile/networking/TileCableBusTESR.java @@ -30,10 +30,9 @@ public class TileCableBusTESR extends TileCableBus { if( !this.cb.requiresDynamicRender ) { - TileCableBus tcb; try { - tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance(); + TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance(); tcb.copyFrom( this ); this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb ); } diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index 28ddeb9b..40dbcffa 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -343,10 +343,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { double stash = 0.0; - IEnergyGrid eg; try { - eg = this.gridProxy.getEnergy(); + IEnergyGrid eg = this.gridProxy.getEnergy(); stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE ); if( stash >= amt ) { @@ -950,7 +949,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { if( TileChest.this.getTile() instanceof IActionHost && requiredPermission != null ) { - boolean requirePower = false; IGridNode gn = ( (IActionHost) TileChest.this.getTile() ).getActionableNode(); if( gn != null ) @@ -958,6 +956,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan IGrid g = gn.getGrid(); if( g != null ) { + boolean requirePower = false; if( requirePower ) { IEnergyGrid eg = g.getCache( IEnergyGrid.class ); diff --git a/src/main/java/appeng/tile/storage/TileDrive.java b/src/main/java/appeng/tile/storage/TileDrive.java index 55cd67a3..a0acfaa3 100644 --- a/src/main/java/appeng/tile/storage/TileDrive.java +++ b/src/main/java/appeng/tile/storage/TileDrive.java @@ -205,7 +205,6 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior private void recalculateDisplay() { - int oldState = 0; boolean currentActive = this.gridProxy.isActive(); if( currentActive ) @@ -235,6 +234,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior this.state |= ( this.getCellStatus( x ) << ( 3 * x ) ); } + int oldState = 0; if( oldState != this.state ) { this.markForUpdate(); diff --git a/src/main/java/appeng/transformer/asm/ASMIntegration.java b/src/main/java/appeng/transformer/asm/ASMIntegration.java index dc006155..b89e5f07 100644 --- a/src/main/java/appeng/transformer/asm/ASMIntegration.java +++ b/src/main/java/appeng/transformer/asm/ASMIntegration.java @@ -171,7 +171,6 @@ public final class ASMIntegration implements IClassTransformer } String iFace = null; - String iName = null; if( an.values.get( 0 ).equals( "iface" ) ) { @@ -182,6 +181,7 @@ public final class ASMIntegration implements IClassTransformer iFace = (String) an.values.get( 3 ); } + String iName = null; if( an.values.get( 0 ).equals( "iname" ) ) { iName = ( (String[]) an.values.get( 1 ) )[1]; diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 1161963b..a15a77d0 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -187,9 +187,6 @@ public class Platform PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit(); p = PowerUnits.AE.convertTo( displayUnits, p ); - int offset = 0; - String level = ""; - String[] preFixes = { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" }; String unitName = displayUnits.name(); if( displayUnits == PowerUnits.WA ) @@ -202,6 +199,20 @@ public class Platform unitName = "J"; } + String[] preFixes = new String[] { + "k", + "M", + "G", + "T", + "P", + "T", + "P", + "E", + "Z", + "Y" + }; + String level = ""; + int offset = 0; while( p > 1000 && offset < preFixes.length ) { p /= 1000; @@ -1372,9 +1383,8 @@ public class Platform if( hitEntities ) { List list = w.getEntitiesWithinAABBExcludingEntity( p, bb ); - int l; - for( l = 0; l < list.size(); ++l ) + for( int l = 0; l < list.size(); ++l ) { Entity entity1 = (Entity) list.get( l ); @@ -1634,7 +1644,6 @@ public class Platform { for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) { - int offset = 0; int[] sides = ( (ISidedInventory) target ).getAccessibleSlotsFromSide( dir.ordinal() ); @@ -1643,6 +1652,7 @@ public class Platform return 0; } + int offset = 0; for( int side : sides ) { int c = ( side << ( offset % 8 ) ) ^ ( 1 << dir.ordinal() ); @@ -1729,10 +1739,10 @@ public class Platform public static void configurePlayer( EntityPlayer player, ForgeDirection side, TileEntity tile ) { - float pitch = 0.0f; - float yaw = 0.0f; player.yOffset = 1.8f; + float yaw = 0.0f; + float pitch = 0.0f; switch( side ) { case DOWN: diff --git a/src/main/java/appeng/worldgen/MeteoritePlacer.java b/src/main/java/appeng/worldgen/MeteoritePlacer.java index b79a54e1..a47283e6 100644 --- a/src/main/java/appeng/worldgen/MeteoritePlacer.java +++ b/src/main/java/appeng/worldgen/MeteoritePlacer.java @@ -446,7 +446,6 @@ public final class MeteoritePlacer public boolean spawnMeteorite( IMeteoriteWorld w, int x, int y, int z ) { - int validBlocks = 0; if( !w.hasNoSky() ) { @@ -502,6 +501,7 @@ public final class MeteoritePlacer } } + int validBlocks = 0; for( int i = x - 15; i < x + 15; i++ ) { for( int j = y - 15; j < y + 15; j++ )