Replace call to simple getter from within class with inlined version

This commit is contained in:
thatsIch 2015-03-26 10:23:59 +01:00
parent e41d6a0289
commit 4b4693498d
22 changed files with 56 additions and 47 deletions

View file

@ -818,7 +818,7 @@ public abstract class AEBaseContainer extends Container
}
// get target item.
IAEItemStack slotItem = this.getTargetStack();
IAEItemStack slotItem = this.clientRequestedTargetItem;
switch (action)
{

View file

@ -126,7 +126,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
{
super.onPickupFromSlot( p, is );
// actually necessary to cleanup this case...
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
p.openContainer.onCraftMatrixChanged( this.craftInv );
return request;
}
}
@ -157,7 +157,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
// shouldn't be necessary...
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
p.openContainer.onCraftMatrixChanged( this.craftInv );
return is;
}
@ -178,10 +178,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if ( Platform.isServer() )
{
// set new items onto the crafting table...
for ( int x = 0; x < this.getCraftingMatrix().getSizeInventory(); x++ )
for ( int x = 0; x < this.craftInv.getSizeInventory(); x++ )
{
if ( this.getCraftingMatrix().getStackInSlot( x ) == null )
this.getCraftingMatrix().setInventorySlotContents( x, set[x] );
if ( this.craftInv.getStackInSlot( x ) == null )
{
this.craftInv.setInventorySlotContents( x, set[x] );
}
else if ( set[x] != null )
{
// eek! put it back!

View file

@ -18,15 +18,16 @@
package appeng.crafting;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.google.common.base.Stopwatch;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
@ -177,7 +178,7 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.crafting( "------------- " + this.getByteTotal() + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + this.bytes + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
// if ( mode == Actionable.MODULATE )
// craftingInventory.moveItemsToStorage( storage );
}
@ -203,7 +204,7 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.crafting( "------------- " + this.getByteTotal() + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + this.bytes + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
}
catch (CraftBranchFailure e1)
{
@ -292,7 +293,7 @@ public class CraftingJob implements Runnable, ICraftingJob
synchronized (this.monitor)
{
if ( this.isDone() )
if ( this.done )
return false;
this.watch.reset();

View file

@ -41,7 +41,7 @@ public class CraftingLinkNexus
public boolean isDead(IGrid g, CraftingGridCache craftingGridCache)
{
if ( this.isCanceled() || this.isDone() )
if ( this.canceled || this.done )
return true;
if ( this.req == null || this.cpu == null )

View file

@ -67,7 +67,9 @@ public enum PartRegistry
for (PartRegistry pr : values())
{
if ( pr.equals( c ) )
return pr.getName();
{
return pr.name;
}
}
throw new RuntimeException( "Invalid PartName" );
}

View file

@ -280,8 +280,10 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
if ( this.wth != null && this.effectiveItem != null )
{
if ( mode == Actionable.SIMULATE )
return this.wth.hasPower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
return this.wth.usePower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
{
return this.wth.hasPower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
}
return this.wth.usePower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
}
return 0.0;
}

View file

@ -63,9 +63,11 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
amt = usePowerMultiplier.multiply( amt );
if ( mode == Actionable.SIMULATE )
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.getItemStack() ) ) );
{
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
}
return usePowerMultiplier.divide( this.ips.extractAEPower( this.getItemStack(), amt ) );
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt ) );
}
@Override

View file

@ -154,7 +154,7 @@ public class GridStorage implements IGridStorage
public void remove()
{
WorldSettings.getInstance().destroyGridStorage( this.getID() );
WorldSettings.getInstance().destroyGridStorage( this.myID );
}
}

View file

@ -26,9 +26,6 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -38,6 +35,9 @@ import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.FMLCommonHandler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@ -800,7 +800,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
if ( !(job instanceof CraftingJob) )
return null;
if ( this.isBusy() || !this.isActive() || this.getAvailableStorage() < job.getByteTotal() )
if ( this.isBusy() || !this.isActive() || this.availableStorage < job.getByteTotal() )
return null;
IStorageGrid sg = g.getCache( IStorageGrid.class );

View file

@ -84,7 +84,7 @@ public class QuantumCluster implements ILocatable, IAECluster
QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
if ( qc != null )
{
World theWorld = qc.getCenter().getWorldObj();
World theWorld = qc.center.getWorldObj();
if ( !qc.isDestroyed )
{
Chunk c = theWorld.getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord );
@ -225,7 +225,7 @@ public class QuantumCluster implements ILocatable, IAECluster
this.registered = false;
}
if ( this.getLocatableSerial() != 0 )
if ( this.thisSide != 0 )
{
this.updateStatus( true );
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
@ -260,7 +260,7 @@ public class QuantumCluster implements ILocatable, IAECluster
public boolean hasQES()
{
return this.getLocatableSerial() != 0;
return this.thisSide != 0;
}
private IGridNode getNode()

View file

@ -96,8 +96,8 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
{
this.myAccess = myAccess;
this.cachedAccessRestriction = this.myAccess.restrictPermissions( this.internal.getAccess() );
this.hasReadAccess = this.getAccess().hasPermission( AccessRestriction.READ );
this.hasWriteAccess = this.getAccess().hasPermission( AccessRestriction.WRITE );
this.hasReadAccess = this.cachedAccessRestriction.hasPermission( AccessRestriction.READ );
this.hasWriteAccess = this.cachedAccessRestriction.hasPermission( AccessRestriction.WRITE );
}
public IPartitionList<T> getPartitionList()

View file

@ -231,9 +231,9 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
protected AEColor getColor()
{
if ( this.getHost() == null )
if ( this.host == null )
return AEColor.Transparent;
return this.getHost().getColor();
return this.host.getColor();
}
@Override

View file

@ -21,8 +21,6 @@ package appeng.parts.automation;
import java.util.concurrent.Callable;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
@ -38,6 +36,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.collect.Lists;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.networking.IGridNode;
@ -246,7 +246,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
public TickRateModulation breakblock( boolean modulate )
{
if ( this.isAccepting() && this.proxy.isActive() )
if ( this.isAccepting && this.proxy.isActive() )
{
try
{
@ -349,7 +349,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
public void onEntityCollision( Entity entity )
{
if ( this.isAccepting() && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() )
if ( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() )
{
boolean capture = false;

View file

@ -46,7 +46,7 @@ public class PartPatternTerminal extends PartTerminal
public void writeToNBT(NBTTagCompound data)
{
super.writeToNBT( data );
data.setBoolean( "craftingMode", this.isCraftingRecipe() );
data.setBoolean( "craftingMode", this.craftingMode );
this.pattern.writeToNBT( data, "pattern" );
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
@ -157,7 +157,7 @@ public class PartPatternTerminal extends PartTerminal
private void fixCraftingRecipes()
{
if ( this.isCraftingRecipe() )
if ( this.craftingMode )
{
for (int x = 0; x < this.crafting.getSizeInventory(); x++)
{

View file

@ -209,7 +209,7 @@ public class Ingredient implements IIngredient
}
if ( set.length == 0 )
throw new MissingIngredientError( this.getItemName() + " - ore dictionary could not be resolved to any items." );
throw new MissingIngredientError( this.itemName + " - ore dictionary could not be resolved to any items." );
return set;
}

View file

@ -303,7 +303,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
try
{
this.disable = false;
for (Object o : this.getInput())
for (Object o : this.input )
{
if ( o instanceof IIngredient )
((IIngredient) o).bake();

View file

@ -163,7 +163,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
try
{
this.disable = false;
for (Object o : this.getInput())
for (Object o : this.input )
{
if ( o instanceof IIngredient )
((IIngredient) o).bake();

View file

@ -129,7 +129,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
@Override
public boolean requiresTESR()
{
return this.getJobProgress() != null;
return this.dspPlay != null;
}
@Override

View file

@ -44,7 +44,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
public boolean isEmpty()
{
for (int x = 0; x < this.getSizeInventory(); x++)
for (int x = 0; x < this.size; x++)
if ( this.getStackInSlot( x ) != null )
return false;
return true;

View file

@ -48,7 +48,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public boolean isEmpty()
{
for (int x = 0; x < this.getSizeInventory(); x++)
for (int x = 0; x < this.size; x++)
if ( this.getStackInSlot( x ) != null )
return false;
return true;

View file

@ -253,7 +253,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream( bytes );
CompressedStreamTools.write( (NBTTagCompound) this.getTagCompound(), data );
CompressedStreamTools.write( (NBTTagCompound) this.tagCompound, data );
byte[] tagBytes = bytes.toByteArray();
int size = tagBytes.length;
@ -328,12 +328,12 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
{
if ( st instanceof FluidStack )
{
return ((FluidStack) st).getFluid() == this.getFluid();
return ((FluidStack) st).getFluid() == this.fluid;
}
if ( st instanceof IAEFluidStack )
{
return ((IAEFluidStack) st).getFluid() == this.getFluid();
return ((IAEFluidStack) st).getFluid() == this.fluid;
}
return false;

View file

@ -34,7 +34,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
@Override
public boolean isMeaningful()
{
return this.stackSize != 0 || this.getCountRequestable() > 0 || this.isCraftable();
return this.stackSize != 0 || this.countRequestable > 0 || this.isCraftable;
}
@Override
@ -167,7 +167,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
@Override
public void writeToPacket(ByteBuf i) throws IOException
{
byte mask = (byte) (this.getType( 0 ) | (this.getType( this.stackSize ) << 2) | (this.getType( this.getCountRequestable() ) << 4) | ((byte) (this.isCraftable ? 1 : 0) << 6) | (this.hasTagCompound() ? 1
byte mask = (byte) (this.getType( 0 ) | (this.getType( this.stackSize ) << 2) | (this.getType( this.countRequestable ) << 4) | ((byte) (this.isCraftable ? 1 : 0) << 6) | (this.hasTagCompound() ? 1
: 0) << 7);
i.writeByte( mask );
@ -177,7 +177,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
// putPacketValue( i, priority );
this.putPacketValue( i, this.stackSize );
this.putPacketValue( i, this.getCountRequestable() );
this.putPacketValue( i, this.countRequestable );
}
}