From cd064ec05c9a228ccaa62b40a2cd979caa01d808 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Wed, 1 Oct 2014 11:34:27 +0200 Subject: [PATCH] Remove redundant local variables --- .../block/AEBaseItemBlockChargeable.java | 6 ++--- .../render/blocks/RenderBlockCharger.java | 3 +-- .../render/blocks/RenderBlockCraftingCPU.java | 3 +-- .../blocks/RenderBlockCraftingCPUMonitor.java | 15 ++++++------ .../render/blocks/RenderBlockInscriber.java | 6 ++--- .../implementations/ContainerCondenser.java | 3 +-- .../implementations/ContainerUpgradeable.java | 3 +-- .../container/slot/SlotRestrictedInput.java | 3 +-- .../NEIHelpers/NEICraftingHandler.java | 5 ++-- .../NEIHelpers/NEIGrinderRecipeHandler.java | 3 +-- .../NEIHelpers/NEIInscriberRecipeHandler.java | 3 +-- .../appeng/integration/modules/Waila.java | 16 +++++-------- .../appeng/items/parts/ItemMultiPart.java | 3 +-- .../java/appeng/me/cluster/MBCalculator.java | 24 +++++++++---------- src/main/java/appeng/parts/PartPlacement.java | 10 ++++---- .../parts/automation/PartSharedItemBus.java | 3 +-- .../appeng/recipes/game/ShapelessRecipe.java | 4 +--- .../appeng/recipes/handlers/HCCrusher.java | 9 ++++--- .../java/appeng/tile/storage/TileChest.java | 14 +++++------ .../java/appeng/util/inv/WrapperInvSlot.java | 3 +-- .../java/appeng/util/item/AEItemStack.java | 9 ++++--- 21 files changed, 59 insertions(+), 89 deletions(-) diff --git a/src/main/java/appeng/block/AEBaseItemBlockChargeable.java b/src/main/java/appeng/block/AEBaseItemBlockChargeable.java index 770e44c6..ae1f7bb5 100644 --- a/src/main/java/appeng/block/AEBaseItemBlockChargeable.java +++ b/src/main/java/appeng/block/AEBaseItemBlockChargeable.java @@ -98,15 +98,13 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte @Override public double getAEMaxPower(ItemStack is) { - double internalMaxPower = getMax( is ); - return internalMaxPower; + return getMax( is ); } @Override public double getAECurrentPower(ItemStack is) { - double internalCurrentPower = getInternal( is ); - return internalCurrentPower; + return getInternal( is ); } @Override diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java b/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java index c8873b87..361ef8f1 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCharger.java @@ -131,8 +131,7 @@ public class RenderBlockCharger extends BaseBlockRender GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f ); } - int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); - int br = light;// << 20 | light << 4; + int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4; int var11 = br % 65536; int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 ); diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java index 91bc487c..52d89785 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java @@ -121,9 +121,8 @@ public class RenderBlockCraftingCPU extends BaseBlockRender double a = 0.0 / 16.0; double o = 16.0 / 16.0; renderer.setRenderBounds( a, a, a, o, o, o ); - boolean out = renderer.renderStandardBlock( blk, x, y, z ); - return out; + return renderer.renderStandardBlock( blk, x, y, z ); } } diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPUMonitor.java b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPUMonitor.java index 4b0f9460..e223a657 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPUMonitor.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPUMonitor.java @@ -79,44 +79,43 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU } GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - ForgeDirection d = side; - GL11.glTranslated( d.offsetX * 0.69, d.offsetY * 0.69, d.offsetZ * 0.69 ); + GL11.glTranslated( side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69 ); float scale = 0.7f; GL11.glScalef( scale, scale, scale ); - if ( d == ForgeDirection.UP ) + if ( side == ForgeDirection.UP ) { GL11.glScalef( 1.0f, -1.0f, 1.0f ); GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( spin * 90.0F, 0, 0, 1 ); } - if ( d == ForgeDirection.DOWN ) + if ( side == ForgeDirection.DOWN ) { GL11.glScalef( 1.0f, -1.0f, 1.0f ); GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( spin * -90.0F, 0, 0, 1 ); } - if ( d == ForgeDirection.EAST ) + if ( side == ForgeDirection.EAST ) { GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f ); } - if ( d == ForgeDirection.WEST ) + if ( side == ForgeDirection.WEST ) { GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); } - if ( d == ForgeDirection.NORTH ) + if ( side == ForgeDirection.NORTH ) { GL11.glScalef( -1.0f, -1.0f, -1.0f ); } - if ( d == ForgeDirection.SOUTH ) + if ( side == ForgeDirection.SOUTH ) { GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f ); diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockInscriber.java b/src/main/java/appeng/client/render/blocks/RenderBlockInscriber.java index 302adb8e..b8ea6e8a 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockInscriber.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockInscriber.java @@ -132,8 +132,7 @@ public class RenderBlockInscriber extends BaseBlockRender Minecraft mc = Minecraft.getMinecraft(); mc.renderEngine.bindTexture( TextureMap.locationBlocksTexture ); - int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); - int br = light;// << 20 | light << 4; + int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4; int var11 = br % 65536; int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 ); @@ -244,8 +243,7 @@ public class RenderBlockInscriber extends BaseBlockRender GL11.glRotatef( 90.0f, 1, 0, 0 ); - int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 ); - int br = light;// << 20 | light << 4; + int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4; int var11 = br % 65536; int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 ); diff --git a/src/main/java/appeng/container/implementations/ContainerCondenser.java b/src/main/java/appeng/container/implementations/ContainerCondenser.java index e62e6435..e890f2b3 100644 --- a/src/main/java/appeng/container/implementations/ContainerCondenser.java +++ b/src/main/java/appeng/container/implementations/ContainerCondenser.java @@ -34,9 +34,8 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv { double maxStorage = this.condenser.getStorage(); double requiredEnergy = this.condenser.getRequiredPower(); - int maxDisplay = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage ); - this.requiredEnergy = maxDisplay; + this.requiredEnergy = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage ); this.storedPower = (int) this.condenser.storedPower; this.output = (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT ); } diff --git a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java index 4e242814..cca9b4f7 100644 --- a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java +++ b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java @@ -52,8 +52,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl if ( te instanceof IPart ) { - IUpgradeableHost myTile = te; - TileEntity mk = myTile.getTile(); + TileEntity mk = te.getTile(); w = mk.getWorldObj(); xCoord = mk.xCoord; yCoord = mk.yCoord; diff --git a/src/main/java/appeng/container/slot/SlotRestrictedInput.java b/src/main/java/appeng/container/slot/SlotRestrictedInput.java index 114b99ec..c6836ed2 100644 --- a/src/main/java/appeng/container/slot/SlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/SlotRestrictedInput.java @@ -198,8 +198,7 @@ public class SlotRestrictedInput extends AppEngSlot case WORKBENCH_CELL: return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i ); case STORAGE_COMPONENT: - boolean isComp = i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i ); - return isComp; + return i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i ); case TRASH: if ( AEApi.instance().registries().cell().isCellHandled( i ) ) return false; diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java index 041e5c83..58cbb05c 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java @@ -65,8 +65,7 @@ public class NEICraftingHandler implements IOverlayHandler { if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix ) { - Slot ctSlot = slot; - if ( ctSlot.getSlotIndex() == col + row * 3 ) + if ( slot.getSlotIndex() == col + row * 3 ) { NBTTagList tags = new NBTTagList(); List list = new LinkedList(); @@ -91,7 +90,7 @@ public class NEICraftingHandler implements IOverlayHandler tags.appendTag( tag ); } - recipe.setTag( "#" + ctSlot.getSlotIndex(), tags ); + recipe.setTag( "#" + slot.getSlotIndex(), tags ); break; } } diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java index 4c5a49b4..6df17850 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java @@ -136,8 +136,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler public String getGuiTexture() { ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" ); - String f = loc.toString(); - return f; + return loc.toString(); } @Override diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java index 927f6445..dc428c22 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java @@ -108,8 +108,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler public String getGuiTexture() { ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/inscriber.png" ); - String f = loc.toString(); - return f; + return loc.toString(); } @Override diff --git a/src/main/java/appeng/integration/modules/Waila.java b/src/main/java/appeng/integration/modules/Waila.java index 1b30a55c..23aadf66 100644 --- a/src/main/java/appeng/integration/modules/Waila.java +++ b/src/main/java/appeng/integration/modules/Waila.java @@ -122,13 +122,11 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr SelectedPart sp = ((IPartHost) te).selectPart( Pos ); if ( sp.facade != null ) { - IFacadePart fp = sp.facade; - ThingOfInterest = fp; + ThingOfInterest = sp.facade; } else if ( sp.part != null ) { - IPart part = sp.part; - ThingOfInterest = part; + ThingOfInterest = sp.part; } } @@ -136,10 +134,9 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr { if ( ThingOfInterest instanceof PartCableSmart || ThingOfInterest instanceof PartDenseCable ) { - NBTTagCompound c = nbt; - if ( c != null && c.hasKey( "extra:6" ) ) + if ( nbt != null && nbt.hasKey( "extra:6" ) ) { - NBTTagCompound ic = c.getCompoundTag( "extra:6" ); + NBTTagCompound ic = nbt.getCompoundTag( "extra:6" ); if ( ic != null && ic.hasKey( "usedChannels" ) ) { int channels = ic.getByte( "usedChannels" ); @@ -151,11 +148,10 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr if ( ThingOfInterest instanceof TileEnergyCell ) { - NBTTagCompound c = nbt; - if ( c != null && c.hasKey( "internalCurrentPower" ) ) + if ( nbt != null && nbt.hasKey( "internalCurrentPower" ) ) { TileEnergyCell tec = (TileEnergyCell) ThingOfInterest; - long power = (long) (100 * c.getDouble( "internalCurrentPower" )); + long power = (long) (100 * nbt.getDouble( "internalCurrentPower" )); currentToolTip.add( WailaText.Contains + ": " + Platform.formatPowerLong( power, false ) + " / " + Platform.formatPowerLong( (long) (100 * tec.getAEMaxPower()), false ) ); } diff --git a/src/main/java/appeng/items/parts/ItemMultiPart.java b/src/main/java/appeng/items/parts/ItemMultiPart.java index 33538a0b..3e79ce92 100644 --- a/src/main/java/appeng/items/parts/ItemMultiPart.java +++ b/src/main/java/appeng/items/parts/ItemMultiPart.java @@ -135,8 +135,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup @Override public IIcon getIconFromDamage(int dmg) { - IIcon ico = dmgToPart.get( dmg ).ico; - return ico; + return this.dmgToPart.get( dmg ).ico; } @Override diff --git a/src/main/java/appeng/me/cluster/MBCalculator.java b/src/main/java/appeng/me/cluster/MBCalculator.java index d3cc27be..967c0f44 100644 --- a/src/main/java/appeng/me/cluster/MBCalculator.java +++ b/src/main/java/appeng/me/cluster/MBCalculator.java @@ -63,7 +63,7 @@ public abstract class MBCalculator return isValidTile( w.getTileEntity( x, y, z ) ); } - public void calculateMultiblock(World worldObj, WorldCoord loc) + public void calculateMultiblock(World world, WorldCoord loc) { if ( Platform.isClient() ) return; @@ -73,31 +73,29 @@ public abstract class MBCalculator WorldCoord min = loc.copy(); WorldCoord max = loc.copy(); - World w = worldObj; - // find size of MB structure... - while (isValidTileAt( w, min.x - 1, min.y, min.z )) + while (isValidTileAt( world, min.x - 1, min.y, min.z )) min.x--; - while (isValidTileAt( w, min.x, min.y - 1, min.z )) + while (isValidTileAt( world, min.x, min.y - 1, min.z )) min.y--; - while (isValidTileAt( w, min.x, min.y, min.z - 1 )) + while (isValidTileAt( world, min.x, min.y, min.z - 1 )) min.z--; - while (isValidTileAt( w, max.x + 1, max.y, max.z )) + while (isValidTileAt( world, max.x + 1, max.y, max.z )) max.x++; - while (isValidTileAt( w, max.x, max.y + 1, max.z )) + while (isValidTileAt( world, max.x, max.y + 1, max.z )) max.y++; - while (isValidTileAt( w, max.x, max.y, max.z + 1 )) + while (isValidTileAt( world, max.x, max.y, max.z + 1 )) max.z++; if ( checkMultiblockScale( min, max ) ) { - if ( verifyUnownedRegion( w, min, max ) ) + if ( verifyUnownedRegion( world, min, max ) ) { - IAECluster c = createCluster( w, min, max ); + IAECluster c = createCluster( world, min, max ); try { - if ( !verifyInternalStructure( worldObj, min, max ) ) + if ( !verifyInternalStructure( world, min, max ) ) { disconnect(); return; @@ -113,7 +111,7 @@ public abstract class MBCalculator IAECluster cluster = target.getCluster(); if ( cluster == null ) { - updateTiles( c, w, min, max ); + updateTiles( c, world, min, max ); updateGrid = true; } diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 7838c455..e5192f99 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -350,11 +350,9 @@ public class PartPlacement { if ( pass == PlaceType.INTERACT_FIRST_PASS || pass == PlaceType.PLACE_ITEM ) { - ForgeDirection offset = side; - - te_x = x + offset.offsetX; - te_y = y + offset.offsetY; - te_z = z + offset.offsetZ; + te_x = x + side.offsetX; + te_y = y + side.offsetY; + te_z = z + side.offsetZ; Block blkID = world.getBlock( te_x, te_y, te_z ); tile = world.getTileEntity( te_x, te_y, te_z ); @@ -362,7 +360,7 @@ public class PartPlacement if ( tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) ) host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile ); - if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN ) + if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && side != ForgeDirection.UNKNOWN ) return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 ); } diff --git a/src/main/java/appeng/parts/automation/PartSharedItemBus.java b/src/main/java/appeng/parts/automation/PartSharedItemBus.java index 37529bcf..b47e5e65 100644 --- a/src/main/java/appeng/parts/automation/PartSharedItemBus.java +++ b/src/main/java/appeng/parts/automation/PartSharedItemBus.java @@ -22,8 +22,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid if ( w.getChunkProvider().chunkExists( x >> 4, z >> 4 ) ) { - TileEntity te = w.getTileEntity( x, y, z ); - return te; + return w.getTileEntity( x, y, z ); } return null; diff --git a/src/main/java/appeng/recipes/game/ShapelessRecipe.java b/src/main/java/appeng/recipes/game/ShapelessRecipe.java index e7bec013..13461ee4 100644 --- a/src/main/java/appeng/recipes/game/ShapelessRecipe.java +++ b/src/main/java/appeng/recipes/game/ShapelessRecipe.java @@ -81,12 +81,10 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable { boolean inRecipe = false; - for (Object aRequired : required) + for (Object next : required) { boolean match = false; - Object next = aRequired; - if ( next instanceof IIngredient ) { try diff --git a/src/main/java/appeng/recipes/handlers/HCCrusher.java b/src/main/java/appeng/recipes/handlers/HCCrusher.java index e905c19f..c78cfa9b 100644 --- a/src/main/java/appeng/recipes/handlers/HCCrusher.java +++ b/src/main/java/appeng/recipes/handlers/HCCrusher.java @@ -33,25 +33,24 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer return; } } - new RecipeError( "Crusher must have a single input, and single output." ); + throw new RecipeError( "Crusher must have a single input, and single output." ); } @Override public void register() throws RegistrationError, MissingIngredientError { - for (ItemStack is : pro_input.getItemStackSet()) + for (ItemStack beginStack : pro_input.getItemStackSet()) { try { NBTTagCompound toRegister = new NBTTagCompound(); - - ItemStack beginStack = is; + ItemStack endStack = pro_output[0].getItemStack(); NBTTagCompound itemFrom = new NBTTagCompound(); NBTTagCompound itemTo = new NBTTagCompound(); - beginStack.writeToNBT(itemFrom); + beginStack.writeToNBT( itemFrom ); endStack.writeToNBT(itemTo); toRegister.setTag("itemFrom", itemFrom); diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index d9ff6cce..27e7bd40 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -824,11 +824,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { try { - IMEInventoryHandler ih = this.getHandler( StorageChannel.ITEMS ); - if ( ch != null && ih != null ) + IMEInventoryHandler invHandler = this.getHandler( StorageChannel.ITEMS ); + if ( ch != null && invHandler != null ) { - IMEInventoryHandler mine = ih; - ch.openChestGui( p, this, ch, mine, cell, StorageChannel.ITEMS ); + ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.ITEMS ); return true; } @@ -840,11 +839,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan try { - IMEInventoryHandler fh = this.getHandler( StorageChannel.FLUIDS ); - if ( ch != null && fh != null ) + IMEInventoryHandler invHandler = this.getHandler( StorageChannel.FLUIDS ); + if ( ch != null && invHandler != null ) { - IMEInventoryHandler mine = fh; - ch.openChestGui( p, this, ch, mine, cell, StorageChannel.FLUIDS ); + ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.FLUIDS ); return true; } } diff --git a/src/main/java/appeng/util/inv/WrapperInvSlot.java b/src/main/java/appeng/util/inv/WrapperInvSlot.java index f827300b..c84f9263 100644 --- a/src/main/java/appeng/util/inv/WrapperInvSlot.java +++ b/src/main/java/appeng/util/inv/WrapperInvSlot.java @@ -105,8 +105,7 @@ public class WrapperInvSlot public IInventory getWrapper(int slot) { - InternalInterfaceWrapper wrapper = new InternalInterfaceWrapper( inv, slot ); - return wrapper; + return new InternalInterfaceWrapper( inv, slot ); } protected boolean isItemValid(ItemStack itemstack) diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index e244fe0d..06a4baf5 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -454,7 +454,6 @@ public final class AEItemStack extends AEStack implements IAEItemS if ( def.item.isDamageable() ) { ItemStack a = getItemStack(); - ItemStack b = o; try { @@ -464,12 +463,12 @@ public final class AEItemStack extends AEStack implements IAEItemS } else if ( Mode == FuzzyMode.PERCENT_99 ) { - return (a.getItemDamageForDisplay() > 1) == (b.getItemDamageForDisplay() > 1); + return (a.getItemDamageForDisplay() > 1) == (o.getItemDamageForDisplay() > 1); } else { float APercentDamaged = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage(); - float BPercentDamaged = 1.0f - (float) b.getItemDamageForDisplay() / (float) b.getMaxDamage(); + float BPercentDamaged = 1.0f - (float) o.getItemDamageForDisplay() / (float) o.getMaxDamage(); return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint); } @@ -482,12 +481,12 @@ public final class AEItemStack extends AEStack implements IAEItemS } else if ( Mode == FuzzyMode.PERCENT_99 ) { - return (a.getItemDamage() > 1) == (b.getItemDamage() > 1); + return (a.getItemDamage() > 1) == (o.getItemDamage() > 1); } else { float APercentDamaged = (float) a.getItemDamage() / (float) a.getMaxDamage(); - float BPercentDamaged = (float) b.getItemDamage() / (float) b.getMaxDamage(); + float BPercentDamaged = (float) o.getItemDamage() / (float) o.getMaxDamage(); return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint); }