Code cleanup

Added missing this, annotations, etc.
This commit is contained in:
yueh
2018-08-30 20:33:08 +02:00
parent fed12cb99f
commit a2091d10fe
77 changed files with 227 additions and 270 deletions
@@ -150,9 +150,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final EnumFacing up = this.getOrientable( world, pos ).getUp();
if( !this.canPlaceAt( (World) world, pos, up.getOpposite() ) )
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
{
this.dropTorch( (World) world, pos );
this.dropTorch( world, pos );
}
}
@@ -319,11 +319,11 @@ public class BlockCableBus extends AEBaseTileBlock
// Randomly select one of the textures if the cable bus has more than just one possibility here
TextureAtlasSprite texture = Platform.pickRandom( textures );
double d0 = (double) pos.getX() + ( (double) j + 0.5D ) / 4.0D;
double d1 = (double) pos.getY() + ( (double) k + 0.5D ) / 4.0D;
double d2 = (double) pos.getZ() + ( (double) l + 0.5D ) / 4.0D;
ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - (double) pos.getX() - 0.5D, d1 - (double) pos
.getY() - 0.5D, d2 - (double) pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
double d0 = pos.getX() + ( j + 0.5D ) / 4.0D;
double d1 = pos.getY() + ( k + 0.5D ) / 4.0D;
double d2 = pos.getZ() + ( l + 0.5D ) / 4.0D;
ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
particle.setParticleTexture( texture );
effectRenderer.addEffect( particle );
}
@@ -136,7 +136,7 @@ public class FeatureFactory
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
{
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
this.bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
}
@SideOnly( Side.CLIENT )
@@ -161,16 +161,16 @@ public abstract class AEBaseGui extends GuiContainer
super.drawScreen( mouseX, mouseY, partialTicks );
GlStateManager.pushMatrix();
GlStateManager.translate( (float) this.guiLeft, (float) this.guiTop, 0.0F );
GlStateManager.translate( this.guiLeft, this.guiTop, 0.0F );
GlStateManager.enableDepth();
for( final GuiCustomSlot c : this.guiSlots )
{
drawGuiSlot( c, mouseX, mouseY, partialTicks );
this.drawGuiSlot( c, mouseX, mouseY, partialTicks );
}
GlStateManager.disableDepth();
for( final GuiCustomSlot c : this.guiSlots )
{
drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
}
GlStateManager.popMatrix();
@@ -180,7 +180,7 @@ public abstract class AEBaseGui extends GuiContainer
{
if( c instanceof ITooltip )
{
drawTooltip( (ITooltip) c, mouseX, mouseY );
this.drawTooltip( (ITooltip) c, mouseX, mouseY );
}
}
}
@@ -23,7 +23,7 @@ public abstract class GuiCustomSlot extends Gui implements ITooltip
public int getId()
{
return id;
return this.id;
}
public boolean canClick( final EntityPlayer player )
@@ -131,7 +131,9 @@ public class MEGuiTextField extends GuiTextField
public void drawSelectionBox( int startX, int startY, int endX, int endY )
{
if( !this.isFocused() )
{
return;
}
if( startX < endX )
{
@@ -165,20 +167,20 @@ public class MEGuiTextField extends GuiTextField
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
float red = (float) ( this.selectionColor >> 16 & 255 ) / 255.0F;
float blue = (float) ( this.selectionColor >> 8 & 255 ) / 255.0F;
float green = (float) ( this.selectionColor & 255 ) / 255.0F;
float alpha = (float) ( this.selectionColor >> 24 & 255 ) / 255.0F;
float red = ( this.selectionColor >> 16 & 255 ) / 255.0F;
float blue = ( this.selectionColor >> 8 & 255 ) / 255.0F;
float green = ( this.selectionColor & 255 ) / 255.0F;
float alpha = ( this.selectionColor >> 24 & 255 ) / 255.0F;
GlStateManager.color( red, green, blue, alpha );
GlStateManager.disableTexture2D();
GlStateManager.enableColorLogic();
GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE );
bufferbuilder.begin( 7, DefaultVertexFormats.POSITION );
bufferbuilder.pos( (double) startX, (double) endY, 0.0D ).endVertex();
bufferbuilder.pos( (double) endX, (double) endY, 0.0D ).endVertex();
bufferbuilder.pos( (double) endX, (double) startY, 0.0D ).endVertex();
bufferbuilder.pos( (double) startX, (double) startY, 0.0D ).endVertex();
bufferbuilder.pos( startX, endY, 0.0D ).endVertex();
bufferbuilder.pos( endX, endY, 0.0D ).endVertex();
bufferbuilder.pos( endX, startY, 0.0D ).endVertex();
bufferbuilder.pos( startX, startY, 0.0D ).endVertex();
tessellator.draw();
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
@@ -50,7 +50,7 @@ public class DummyFluidBakedModel implements IBakedModel
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
{
return quads;
return this.quads;
}
@Override
@@ -104,13 +104,13 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME );
}
TextureAtlasSprite sprite = bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) );
TextureAtlasSprite sprite = DummyFluidDispatcherBakedModel.this.bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) );
if( sprite == null )
{
return new DummyFluidBakedModel( ImmutableList.of() );
}
return new DummyFluidBakedModel( ItemLayerModel.getQuadsForSprite( 0, sprite, format, Optional.empty() ) );
return new DummyFluidBakedModel( ItemLayerModel.getQuadsForSprite( 0, sprite, DummyFluidDispatcherBakedModel.this.format, Optional.empty() ) );
}
};
}
@@ -51,7 +51,7 @@ public class DummyFluidItemModel implements IModel
{
try
{
baseModel = ModelLoaderRegistry.getModel( MODEL_BASE );
this.baseModel = ModelLoaderRegistry.getModel( MODEL_BASE );
}
catch( Exception e )
{
@@ -84,6 +84,6 @@ public class DummyFluidItemModel implements IModel
@Override
public IModelState getDefaultState()
{
return getBaseModel().getDefaultState();
return this.getBaseModel().getDefaultState();
}
}
@@ -188,7 +188,7 @@ public class CableBusRenderState
{
return false;
}
if( getClass() != obj.getClass() )
if( this.getClass() != obj.getClass() )
{
return false;
}
@@ -56,7 +56,7 @@ public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedMode
frequency = (short) ( partFlags.longValue() & 0xffffL );
active = ( partFlags.longValue() & 0x10000L ) != 0;
}
return getQuadsForFrequency( frequency, active );
return this.getQuadsForFrequency( frequency, active );
} );
}
catch( ExecutionException e )
@@ -72,7 +72,7 @@ public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedMode
{
return Collections.emptyList();
}
return getPartQuads( null, rand );
return this.getPartQuads( null, rand );
}
private List<BakedQuad> getQuadsForFrequency( final short frequency, final boolean active )
@@ -100,7 +100,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel
{
if( this.baseModel instanceof IBakedModel )
{
return ( (IBakedModel) this.baseModel ).handlePerspective( cameraTransformType );
return this.baseModel.handlePerspective( cameraTransformType );
}
return PerspectiveMapWrapper.handlePerspective( this, this.transforms, cameraTransformType );
@@ -150,7 +150,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel
if( selectedModel instanceof IBakedModel )
{
return ( (IBakedModel) selectedModel ).handlePerspective( cameraTransformType );
return selectedModel.handlePerspective( cameraTransformType );
}
return PerspectiveMapWrapper.handlePerspective( this, ItemEncodedPatternBakedModel.this.transforms, cameraTransformType );
@@ -77,7 +77,7 @@ public class AssemblerFX extends Particle implements ICanDie
this.setExpired();
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.motionY -= 0.04D * this.particleGravity;
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
@@ -142,7 +142,7 @@ public class CraftingFx extends ParticleBreaking
this.setExpired();
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.motionY -= 0.04D * this.particleGravity;
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
@@ -132,7 +132,7 @@ public class EnergyFx extends ParticleBreaking
this.setExpired();
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.motionY -= 0.04D * this.particleGravity;
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
@@ -88,7 +88,7 @@ public class LightningFX extends Particle
this.setExpired();
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.motionY -= 0.04D * this.particleGravity;
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
@@ -67,7 +67,7 @@ public class MatterCannonFX extends ParticleBreaking
this.setExpired();
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.motionY -= 0.04D * this.particleGravity;
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
@@ -19,7 +19,6 @@
package appeng.client.render.model;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -263,7 +262,7 @@ public enum UVLModelLoader implements ICustomModelLoader
finally
{
IOUtils.closeQuietly( reader );
IOUtils.closeQuietly( (Closeable) iresource );
IOUtils.closeQuietly( iresource );
}
model = lvt_5_1_;
@@ -1033,7 +1033,7 @@ public abstract class AEBaseContainer extends Container
protected ItemStack transferStackToContainer( final ItemStack input )
{
return shiftStoreItem( input );
return this.shiftStoreItem( input );
}
private ItemStack shiftStoreItem( final ItemStack input )
@@ -80,11 +80,13 @@ public class OptionalSlotFake extends SlotFake implements IOptionalSlot
this.renderDisabled = renderDisabled;
}
@Override
public int getSourceX()
{
return this.srcX;
}
@Override
public int getSourceY()
{
return this.srcY;
+3 -3
View File
@@ -349,7 +349,7 @@ final class Registration
final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items();
registerSpatialDimension();
this.registerSpatialDimension();
// default settings..
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
@@ -562,7 +562,7 @@ final class Registration
CriterionTrigggerRegistry()
{
this.method = ReflectionHelper.findMethod( CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class );
method.setAccessible( true );
this.method.setAccessible( true );
}
@Override
@@ -570,7 +570,7 @@ final class Registration
{
try
{
method.invoke( null, trigger );
this.method.invoke( null, trigger );
}
catch( IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
{
@@ -1067,6 +1067,6 @@ public final class ApiBlocks implements IBlocks
public IBlockDefinition energyGenerator()
{
return energyGenerator;
return this.energyGenerator;
}
}
@@ -372,7 +372,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
{
return true;
}
if( obj == null || getClass() != obj.getClass() )
if( obj == null || this.getClass() != obj.getClass() )
{
return false;
}
@@ -31,10 +31,10 @@ public class AdvancementTriggers
public AdvancementTriggers( ICriterionTriggerRegistry registry )
{
registry.register( networkApprentice );
registry.register( networkEngineer );
registry.register( networkAdmin );
registry.register( spatialExplorer );
registry.register( this.networkApprentice );
registry.register( this.networkEngineer );
registry.register( this.networkAdmin );
registry.register( this.spatialExplorer );
}
public IAdvancementTrigger getNetworkApprentice()
@@ -46,13 +46,13 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
public AppEngAdvancementTrigger( String parString )
{
super();
ID = new ResourceLocation( AppEng.MOD_ID, parString );
this.ID = new ResourceLocation( AppEng.MOD_ID, parString );
}
@Override
public ResourceLocation getId()
{
return ID;
return this.ID;
}
@Override
@@ -97,6 +97,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger<AppEngAdvance
return new AppEngAdvancementTrigger.Instance( this.getId() );
}
@Override
public void trigger( EntityPlayerMP parPlayer )
{
AppEngAdvancementTrigger.Listeners l = this.listeners.get( parPlayer.getAdvancements() );
@@ -150,7 +150,7 @@ public class PacketJEIRecipe extends AppEngPacket
if( !currentItem.isEmpty() )
{
// already the correct item?
ItemStack newItem = canUseInSlot( x, currentItem );
ItemStack newItem = this.canUseInSlot( x, currentItem );
// put away old item
if( newItem != currentItem && security.hasPermission( player, SecurityPermissions.INJECT ) )
@@ -73,7 +73,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
@Override
public void deleteCellDimension( int cellStorageId )
{
StorageCellData removed = spatialData.remove( cellStorageId );
StorageCellData removed = this.spatialData.remove( cellStorageId );
if( removed != null )
{
this.clearCellArea( cellStorageId, removed );
@@ -102,7 +102,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
{
if( this.isCellDimension( cellStorageId ) )
{
return getBlockPosFromId( cellStorageId );
return this.getBlockPosFromId( cellStorageId );
}
return null;
}
@@ -228,18 +228,18 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
public NBTTagCompound serializeNBT()
{
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger( NBT_DIM_X_KEY, contentDimension.getX() );
nbt.setInteger( NBT_DIM_Y_KEY, contentDimension.getY() );
nbt.setInteger( NBT_DIM_Z_KEY, contentDimension.getZ() );
nbt.setInteger( NBT_OWNER_KEY, owner );
nbt.setInteger( NBT_DIM_X_KEY, this.contentDimension.getX() );
nbt.setInteger( NBT_DIM_Y_KEY, this.contentDimension.getY() );
nbt.setInteger( NBT_DIM_Z_KEY, this.contentDimension.getZ() );
nbt.setInteger( NBT_OWNER_KEY, this.owner );
return nbt;
}
@Override
public void deserializeNBT( NBTTagCompound nbt )
{
contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) );
owner = nbt.getInteger( NBT_OWNER_KEY );
this.contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) );
this.owner = nbt.getInteger( NBT_OWNER_KEY );
}
}
}
@@ -64,7 +64,7 @@ public class CraftingWatcher implements ICraftingWatcher
@Override
public boolean remove( final IAEStack o )
{
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this );
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( o, this );
}
@Override
@@ -139,7 +139,7 @@ public class ToolReplicatorCard extends AEBaseItem
final TileEntity nte = blk.createTileEntity( world, state );
final NBTTagCompound data = new NBTTagCompound();
ote.writeToNBT( data );
nte.readFromNBT( (NBTTagCompound) data.copy() );
nte.readFromNBT( data.copy() );
world.setTileEntity( d, nte );
}
world.notifyBlockUpdate( d, prev, state, 3 );
@@ -85,7 +85,7 @@ public class GuiFluidSlot extends GuiCustomSlot
@Override
public String getMessage()
{
final IAEFluidStack fluid = getFluidStack();
final IAEFluidStack fluid = this.getFluidStack();
if( fluid != null )
{
return fluid.getFluidStack().getLocalizedName();
@@ -72,11 +72,11 @@ public class GuiFluidTank extends GuiButton implements ITooltip
int iconHeightRemainder = scaledHeight % 16;
if( iconHeightRemainder > 0 )
{
drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder, sprite, 16, iconHeightRemainder );
this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder, sprite, 16, iconHeightRemainder );
}
for( int i = 0; i < scaledHeight / 16; i++ )
{
drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder - ( i + 1 ) * 16, sprite, 16, 16 );
this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder - ( i + 1 ) * 16, sprite, 16, 16 );
}
}
@@ -36,7 +36,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
{
if( this.sync == null )
{
this.sync = new FluidSyncHelper( getFluidConfigInventory(), 0 );
this.sync = new FluidSyncHelper( this.getFluidConfigInventory(), 0 );
}
return this.sync;
}
@@ -47,7 +47,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
FluidStack fs = FluidUtil.getFluidContained( input );
if( fs != null )
{
final IAEFluidTank t = getFluidConfigInventory();
final IAEFluidTank t = this.getFluidConfigInventory();
final IAEFluidStack stack = AEFluidStack.fromFluidStack( fs );
for( int i = 0; i < t.getSlots(); ++i )
{
@@ -89,7 +89,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
this.getSynchHelper().sendDiff( this.listeners );
// clear out config items that are no longer valid (eg capacity upgrade removed)
final IAEFluidTank t = getFluidConfigInventory();
final IAEFluidTank t = this.getFluidConfigInventory();
for( int i = 0; i < t.getSlots(); ++i )
{
if( t.getFluidInSlot( i ) != null && !this.isValidForConfig( i, t.getFluidInSlot( i ) ) )
@@ -32,7 +32,7 @@ public class ContainerFluidFormationPlane extends ContainerFluidConfigurable
@Override
public IAEFluidTank getFluidConfigInventory()
{
return plane.getConfig();
return this.plane.getConfig();
}
@Override
@@ -43,7 +43,7 @@ public class ContainerFluidIO extends ContainerFluidConfigurable
@Override
public IAEFluidTank getFluidConfigInventory()
{
return bus.getConfig();
return this.bus.getConfig();
}
@Override
@@ -97,11 +97,13 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable
this.tankSync.readPacket( fluids );
}
@Override
protected boolean supportCapacity()
{
return false;
}
@Override
public int availableUpgrades()
{
return 0;
@@ -120,11 +120,11 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
{
if( this.iHost instanceof IUpgradeableHost )
{
return (IUpgradeableHost) this.iHost;
return this.iHost;
}
if( this.iHost instanceof IUpgradeableHost )
{
return (IUpgradeableHost) this.iHost;
return this.iHost;
}
return null;
}
@@ -43,7 +43,7 @@ public class FluidDummyItem extends AEBaseItem
public String getItemStackDisplayName( ItemStack stack )
{
FluidStack fluidStack = getFluidStack( stack );
FluidStack fluidStack = this.getFluidStack( stack );
if( fluidStack == null )
{
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME );
@@ -297,7 +297,7 @@ public class PartFluidAnnihilationPlane extends PartBasicState implements IGridT
}
else
{
final float requiredPower = (float) stack.getStackSize() / Math.min( 1.0f, stack.getChannel().transferFactor() );
final float requiredPower = stack.getStackSize() / Math.min( 1.0f, stack.getChannel().transferFactor() );
final IEnergyGrid energy = this.getProxy().getEnergy();
if( energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) < requiredPower )
@@ -160,6 +160,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return TickRateModulation.SLEEP;
}
@Override
protected void resetCache()
{
final boolean fullReset = this.resetCacheLogic == 2;
@@ -191,6 +192,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
}
}
@Override
protected void resetCache( final boolean fullReset )
{
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost()
@@ -83,7 +83,7 @@ public class AEFluidInventory implements IAEFluidTank
@Override
public int getSlots()
{
return fluids.length;
return this.fluids.length;
}
@Override
@@ -147,7 +147,7 @@ public class AEFluidInventory implements IAEFluidTank
fluid.setStackSize( this.capacity );
}
onContentChanged( slot );
this.onContentChanged( slot );
return (int) filled;
}
@@ -158,7 +158,7 @@ public class AEFluidInventory implements IAEFluidTank
{
return null;
}
return drain( slot, resource.amount, doDrain );
return this.drain( slot, resource.amount, doDrain );
}
public FluidStack drain( final int slot, final int maxDrain, boolean doDrain )
@@ -183,7 +183,7 @@ public class AEFluidInventory implements IAEFluidTank
{
this.fluids[slot] = null;
}
onContentChanged( slot );
this.onContentChanged( slot );
}
return stack;
}
@@ -192,7 +192,9 @@ public class AEFluidInventory implements IAEFluidTank
public int fill( final FluidStack fluid, final boolean doFill )
{
if( fluid == null || fluid.amount <= 0 )
{
return 0;
}
final FluidStack insert = fluid.copy();
@@ -203,7 +205,9 @@ public class AEFluidInventory implements IAEFluidTank
totalFillAmount += fillAmount;
insert.amount -= fillAmount;
if( insert.amount <= 0 )
{
break;
}
}
return totalFillAmount;
}
@@ -212,7 +216,9 @@ public class AEFluidInventory implements IAEFluidTank
public FluidStack drain( final FluidStack fluid, final boolean doDrain )
{
if( fluid == null || fluid.amount <= 0 )
{
return null;
}
final FluidStack resource = fluid.copy();
@@ -223,13 +229,19 @@ public class AEFluidInventory implements IAEFluidTank
if( drain != null )
{
if( totalDrained == null )
{
totalDrained = drain;
}
else
{
totalDrained.amount += drain.amount;
}
resource.amount -= drain.amount;
if( resource.amount <= 0 )
{
break;
}
}
}
return totalDrained;
@@ -239,7 +251,9 @@ public class AEFluidInventory implements IAEFluidTank
public FluidStack drain( final int maxDrain, final boolean doDrain )
{
if( maxDrain == 0 )
{
return null;
}
FluidStack totalDrained = null;
int toDrain = maxDrain;
@@ -267,7 +281,9 @@ public class AEFluidInventory implements IAEFluidTank
}
if( toDrain <= 0 )
{
break;
}
}
return totalDrained;
}
@@ -341,7 +357,7 @@ public class AEFluidInventory implements IAEFluidTank
@Override
public FluidStack getContents()
{
return AEFluidInventory.this.fluids[slot] == null ? null : AEFluidInventory.this.fluids[slot].getFluidStack();
return AEFluidInventory.this.fluids[this.slot] == null ? null : AEFluidInventory.this.fluids[this.slot].getFluidStack();
}
@Override
@@ -43,9 +43,9 @@ public class AEFluidTank extends FluidTank implements IAEFluidTank
@Override
protected void onContentsChanged()
{
if( host != null && Platform.isServer() )
if( this.host != null && Platform.isServer() )
{
host.onFluidInventoryChanged( this, 0 );
this.host.onFluidInventoryChanged( this, 0 );
}
super.onContentsChanged();
}
@@ -35,18 +35,13 @@ public class FluidSorters
{
private static SortDir Direction = SortDir.ASCENDING;
public static final Comparator<IAEFluidStack> CONFIG_BASED_SORT_BY_NAME = new Comparator<IAEFluidStack>()
public static final Comparator<IAEFluidStack> CONFIG_BASED_SORT_BY_NAME = ( o1, o2 ) ->
{
@Override
public int compare( final IAEFluidStack o1, final IAEFluidStack o2 )
if( getDirection() == SortDir.ASCENDING )
{
if( getDirection() == SortDir.ASCENDING )
{
return Platform.getFluidDisplayName( o1 ).compareToIgnoreCase( Platform.getFluidDisplayName( o2 ) );
}
return Platform.getFluidDisplayName( o2 ).compareToIgnoreCase( Platform.getFluidDisplayName( o1 ) );
return Platform.getFluidDisplayName( o1 ).compareToIgnoreCase( Platform.getFluidDisplayName( o2 ) );
}
return Platform.getFluidDisplayName( o2 ).compareToIgnoreCase( Platform.getFluidDisplayName( o1 ) );
};
public static final Comparator<IAEFluidStack> CONFIG_BASED_SORT_BY_MOD = new Comparator<IAEFluidStack>()
@@ -76,18 +71,13 @@ public class FluidSorters
}
};
public static final Comparator<IAEFluidStack> CONFIG_BASED_SORT_BY_SIZE = new Comparator<IAEFluidStack>()
public static final Comparator<IAEFluidStack> CONFIG_BASED_SORT_BY_SIZE = ( o1, o2 ) ->
{
@Override
public int compare( final IAEFluidStack o1, final IAEFluidStack o2 )
if( getDirection() == SortDir.ASCENDING )
{
if( getDirection() == SortDir.ASCENDING )
{
return Long.compare( o2.getStackSize(), o1.getStackSize() );
}
return Long.compare( o1.getStackSize(), o2.getStackSize() );
return Long.compare( o2.getStackSize(), o1.getStackSize() );
}
return Long.compare( o1.getStackSize(), o2.getStackSize() );
};
private static SortDir getDirection()
@@ -89,13 +89,13 @@ public class GrinderRecipes
@Override
public void apply()
{
AEApi.instance().registries().grinder().addRecipe( entry );
AEApi.instance().registries().grinder().addRecipe( this.entry );
}
@Override
public String describe()
{
return "Adding Grinder Entry for " + entry.getInput().getDisplayName();
return "Adding Grinder Entry for " + this.entry.getInput().getDisplayName();
}
}
@@ -111,7 +111,7 @@ public class GrinderRecipes
@Override
public void apply()
{
IGrinderRecipe recipe = AEApi.instance().registries().grinder().getRecipeForInput( stack );
IGrinderRecipe recipe = AEApi.instance().registries().grinder().getRecipeForInput( this.stack );
if( recipe != null )
{
AEApi.instance().registries().grinder().removeRecipe( recipe );
@@ -121,7 +121,7 @@ public class GrinderRecipes
@Override
public String describe()
{
return "Removing Grinder Entry for " + stack.getDisplayName();
return "Removing Grinder Entry for " + this.stack.getDisplayName();
}
}
}
@@ -98,13 +98,13 @@ public class InscriberRecipes
@Override
public void apply()
{
AEApi.instance().registries().inscriber().addRecipe( entry );
AEApi.instance().registries().inscriber().addRecipe( this.entry );
}
@Override
public String describe()
{
return "Adding Inscriber Entry for " + entry.getOutput().getDisplayName();
return "Adding Inscriber Entry for " + this.entry.getOutput().getDisplayName();
}
}
@@ -131,7 +131,7 @@ public class InscriberRecipes
@Override
public String describe()
{
return "Removing Inscriber Entry for " + stack.getDisplayName();
return "Removing Inscriber Entry for " + this.stack.getDisplayName();
}
}
@@ -18,7 +18,7 @@ public class InventoryTweaksModule implements IInvTweaks
{
try
{
api = (InvTweaksAPI) Class.forName( "invtweaks.forge.InvTweaksMod", true, Loader.instance().getModClassLoader() )
this.api = (InvTweaksAPI) Class.forName( "invtweaks.forge.InvTweaksMod", true, Loader.instance().getModClassLoader() )
.getField( "instance" )
.get( null );
}
@@ -30,12 +30,12 @@ public class InventoryTweaksModule implements IInvTweaks
@Override
public boolean isEnabled()
{
return api != null;
return this.api != null;
}
@Override
public int compareItems( ItemStack i, ItemStack j )
{
return api.compareItems( i, j );
return this.api.compareItems( i, j );
}
}
@@ -27,6 +27,7 @@ import appeng.api.features.IGrinderRecipe;
class GrinderRecipeHandler implements IRecipeWrapperFactory<IGrinderRecipe>
{
@Override
public IRecipeWrapper getRecipeWrapper( IGrinderRecipe recipe )
{
return new GrinderRecipeWrapper( recipe );
@@ -71,7 +71,7 @@ class GrinderRecipeWrapper implements IRecipeWrapper
{
String text = String.format( "%d%%", (int) ( this.recipe.getOptionalChance() * 100 ) );
float width = fr.getStringWidth( text ) * scale;
int xScaled = (int) Math.round( ( x + ( 18 - width ) / 2 ) * invScale );
int xScaled = Math.round( ( x + ( 18 - width ) / 2 ) * invScale );
fr.drawString( text, xScaled, (int) ( 65 * invScale ), Color.gray.getRGB() );
x += 18;
}
@@ -80,7 +80,7 @@ class GrinderRecipeWrapper implements IRecipeWrapper
{
String text = String.format( "%d%%", (int) ( this.recipe.getSecondOptionalChance() * 100 ) );
float width = fr.getStringWidth( text ) * scale;
int xScaled = (int) Math.round( ( x + ( 18 - width ) / 2 ) * invScale );
int xScaled = Math.round( ( x + ( 18 - width ) / 2 ) * invScale );
fr.drawString( text, xScaled, (int) ( 65 * invScale ), Color.gray.getRGB() );
}
@@ -40,7 +40,6 @@ import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.me.helpers.MEMonitorHandler;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@@ -97,22 +96,17 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
@Override
public IConfigManager getConfigManager()
{
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
manager.writeToNBT( data );
}
final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
manager.writeToNBT( data );
} );
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( this.target ).copy() );
out.readFromNBT( Platform.openNbtData( this.target ).copy() );
return out;
}
}
@@ -228,15 +228,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
final List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>()
{
@Override
public int compare( final MaterialType o1, final MaterialType o2 )
{
return o1.name().compareTo( o2.name() );
}
} );
Collections.sort( types, ( o1, o2 ) -> o1.name().compareTo( o2.name() ) );
for( final MaterialType mat : types )
{
@@ -174,11 +174,11 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
final InventoryPlayer playerInventory = player.inventory;
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, getChannel() );
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, this.getChannel() );
if( inv != null && playerInventory.getCurrentItem() == stack )
{
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player );
final IItemList<IAEItemStack> list = inv.getAvailableItems( getChannel().createList() );
final IItemList<IAEItemStack> list = inv.getAvailableItems( this.getChannel().createList() );
if( list.isEmpty() && ia != null )
{
playerInventory.setInventorySlotContents( playerInventory.currentItem, ItemStack.EMPTY );
@@ -203,7 +203,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
// drop empty storage cell case
dropEmptyStorageCellCase( ia, player );
this.dropEmptyStorageCellCase( ia, player );
if( player.inventoryContainer != null )
{
@@ -20,7 +20,6 @@ package appeng.items.tools.powered;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -293,15 +292,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
list.add( i );
}
Collections.sort( list, new Comparator<IAEItemStack>()
{
@Override
public int compare( final IAEItemStack a, final IAEItemStack b )
{
return Integer.compare( a.getItemDamage(), b.getItemDamage() );
}
} );
Collections.sort( list, ( a, b ) -> Integer.compare( a.getItemDamage(), b.getItemDamage() ) );
if( list.size() <= 0 )
{
@@ -138,7 +138,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
}
aeAmmo.setStackSize( 1 );
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).createItemStack();
final ItemStack ammo = aeAmmo.createItemStack();
if( ammo == null )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
@@ -45,7 +45,6 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@@ -121,22 +120,17 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public IConfigManager getConfigManager( final ItemStack target )
{
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
final NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
}
final NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
} );
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
out.readFromNBT( Platform.openNbtData( target ).copy() );
return out;
}
+15 -34
View File
@@ -92,26 +92,11 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
private static final ExecutorService CRAFTING_POOL;
private static final Comparator<ICraftingPatternDetails> COMPARATOR = new Comparator<ICraftingPatternDetails>()
{
@Override
public int compare( final ICraftingPatternDetails firstDetail, final ICraftingPatternDetails nextDetail )
{
return nextDetail.getPriority() - firstDetail.getPriority();
}
};
private static final Comparator<ICraftingPatternDetails> COMPARATOR = ( firstDetail, nextDetail ) -> nextDetail.getPriority() - firstDetail.getPriority();
static
{
final ThreadFactory factory = new ThreadFactory()
{
@Override
public Thread newThread( final Runnable ar )
{
return new Thread( ar, "AE Crafting Calculator" );
}
};
final ThreadFactory factory = ar -> new Thread( ar, "AE Crafting Calculator" );
CRAFTING_POOL = Executors.newCachedThreadPool( factory );
}
@@ -542,28 +527,24 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
}
Collections.sort( validCpusClusters, new Comparator<CraftingCPUCluster>()
Collections.sort( validCpusClusters, ( firstCluster, nextCluster ) ->
{
@Override
public int compare( final CraftingCPUCluster firstCluster, final CraftingCPUCluster nextCluster )
if( prioritizePower )
{
if( prioritizePower )
final int comparison1 = Long.compare( nextCluster.getCoProcessors(), firstCluster.getCoProcessors() );
if( comparison1 != 0 )
{
final int comparison = Long.compare( nextCluster.getCoProcessors(), firstCluster.getCoProcessors() );
if( comparison != 0 )
{
return comparison;
}
return Long.compare( nextCluster.getAvailableStorage(), firstCluster.getAvailableStorage() );
return comparison1;
}
final int comparison = Long.compare( firstCluster.getCoProcessors(), nextCluster.getCoProcessors() );
if( comparison != 0 )
{
return comparison;
}
return Long.compare( firstCluster.getAvailableStorage(), nextCluster.getAvailableStorage() );
return Long.compare( nextCluster.getAvailableStorage(), firstCluster.getAvailableStorage() );
}
final int comparison2 = Long.compare( firstCluster.getCoProcessors(), nextCluster.getCoProcessors() );
if( comparison2 != 0 )
{
return comparison2;
}
return Long.compare( firstCluster.getAvailableStorage(), nextCluster.getAvailableStorage() );
} );
if( !validCpusClusters.isEmpty() )
+1 -1
View File
@@ -487,7 +487,7 @@ public class EnergyGridCache implements IEnergyGrid
{
if( machine instanceof IEnergyGridProvider )
{
this.energyGridProviders.remove( (IEnergyGridProvider) machine );
this.energyGridProviders.remove( machine );
}
// idle draw.
@@ -97,7 +97,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
{
if( this.cellItems == null )
{
this.cellItems = getChannel().createList();
this.cellItems = this.getChannel().createList();
this.loadCellItems();
}
@@ -186,7 +186,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
{
if( this.cellItems == null )
{
this.cellItems = getChannel().createList();
this.cellItems = this.getChannel().createList();
}
this.cellItems.resetStatus(); // clears totals and stuff.
@@ -299,14 +299,14 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
@Override
public long getUsedBytes()
{
final long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / itemsPerByte;
final long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / this.itemsPerByte;
return this.getStoredItemTypes() * this.getBytesPerType() + bytesForItemCount;
}
@Override
public long getRemainingItemCount()
{
final long remaining = this.getFreeBytes() * itemsPerByte + this.getUnusedItemCount();
final long remaining = this.getFreeBytes() * this.itemsPerByte + this.getUnusedItemCount();
return remaining > 0 ? remaining : 0;
}
@@ -320,7 +320,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
return 0;
}
return itemsPerByte - div;
return this.itemsPerByte - div;
}
@Override
@@ -183,7 +183,7 @@ public class BasicCellInventory<T extends IAEStack<T>> extends AbstractCellInven
if( this.canHoldNewItem() ) // room for new type, and for at least one item!
{
final int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * itemsPerByte;
final int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * this.itemsPerByte;
if( remainingItemCount > 0 )
{
if( input.getStackSize() > remainingItemCount )
@@ -267,7 +267,7 @@ public class BasicCellInventory<T extends IAEStack<T>> extends AbstractCellInven
final T t;
try
{
t = getChannel().createFromNBT( compoundTag );
t = this.getChannel().createFromNBT( compoundTag );
if( t == null )
{
AELog.warn( "Removing item " + compoundTag + " from storage cell because the associated item type couldn't be found." );
@@ -64,7 +64,7 @@ public class ItemWatcher implements IStackWatcher
@Override
public boolean remove( final IAEStack o )
{
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this );
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( o, this );
}
@Override
@@ -178,10 +178,10 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
for( int x = 0; x < this.availableSlots(); x++ )
{
final IAEItemStack ais = this.getConfig().getAEStackInSlot( x );
if( ais != null && itemsToSend > 0 )
if( ais != null && this.itemsToSend > 0 )
{
Configured = true;
while( itemsToSend > 0 )
while( this.itemsToSend > 0 )
{
if( this.importStuff( myAdaptor, ais, inv, energy, fzMode ) )
{
@@ -193,7 +193,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( !Configured )
{
while( itemsToSend > 0 )
while( this.itemsToSend > 0 )
{
if( this.importStuff( myAdaptor, null, inv, energy, fzMode ) )
{
@@ -266,7 +266,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
if( this.myEnergyWatcher != null )
{
this.myEnergyWatcher.add( (double) this.reportingValue );
this.myEnergyWatcher.add( this.reportingValue );
}
try
@@ -390,7 +390,7 @@ public class PartCable extends AEBasePart implements IPartCable
// a cable bus
if( conOnSide || this.getHost().getPart( d ) != null )
{
ch = ( (int) data.readByte() ) & 0xFF;
ch = ( data.readByte() ) & 0xFF;
}
if( ch != this.getChannelsOnSide( d.ordinal() ) )
@@ -95,7 +95,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
this.opacity = data.readInt();
this.setOutput( this.lastValue > 0 );
return lastValue != oldValue || oldOpacity != this.opacity;
return this.lastValue != oldValue || oldOpacity != this.opacity;
}
private boolean doWork()
@@ -162,7 +162,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
public void writeToStream( ByteBuf data ) throws IOException
{
super.writeToStream( data );
data.writeShort( getFrequency() );
data.writeShort( this.getFrequency() );
}
@Override
@@ -260,7 +260,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
return;
}
final IAEItemStack ais = (IAEItemStack) this.getDisplayed();
final IAEItemStack ais = this.getDisplayed();
if( ais == null )
{
@@ -43,10 +43,10 @@ public class AERecipeLoader
public AERecipeLoader()
{
mod = Loader.instance().getIndexedModList().get( AppEng.MOD_ID );
ctx = new JsonContext( AppEng.MOD_ID );
this.mod = Loader.instance().getIndexedModList().get( AppEng.MOD_ID );
this.ctx = new JsonContext( AppEng.MOD_ID );
initFactories();
this.initFactories();
}
public boolean loadProcessingRecipes()
@@ -63,7 +63,9 @@ public class AERecipeLoader
{
String relative = root.relativize( file ).toString();
if( !"json".equals( FilenameUtils.getExtension( file.toString() ) ) || relative.startsWith( "_" ) )
{
return true;
}
String name = FilenameUtils.removeExtension( relative ).replaceAll( "\\\\", "/" );
ResourceLocation key = new ResourceLocation( this.ctx.getModId(), name );
@@ -74,9 +76,11 @@ public class AERecipeLoader
reader = Files.newBufferedReader( file );
JsonObject json = JsonUtils.fromJson( GSON, reader, JsonObject.class );
if( json.has( "conditions" ) && !CraftingHelper.processConditions( JsonUtils.getJsonArray( json, "conditions" ), this.ctx ) )
{
return true;
}
register( json );
this.register( json );
}
catch( JsonParseException e )
{
@@ -99,15 +103,21 @@ public class AERecipeLoader
private void register( JsonObject json )
{
if( json == null || json.isJsonNull() )
{
throw new JsonSyntaxException( "Json cannot be null" );
}
String type = this.ctx.appendModId( JsonUtils.getString( json, "type" ) );
if( type.isEmpty() )
{
throw new JsonSyntaxException( "Recipe type can not be an empty string" );
}
IAERecipeFactory factory = factories.get( new ResourceLocation( type ) );
IAERecipeFactory factory = this.factories.get( new ResourceLocation( type ) );
if( factory == null )
{
throw new JsonSyntaxException( "Unknown recipe type: " + type );
}
factory.register( json, this.ctx );
}
+1 -1
View File
@@ -222,7 +222,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
this.renderFragment = 100;
output = readFromStream( stream );
output = this.readFromStream( stream );
if( ( this.renderFragment & 1 ) == 1 )
{
@@ -57,7 +57,7 @@ public class AppEngCellInventory implements IInternalItemHandler
public ItemStack insertItem( int slot, ItemStack stack, boolean simulate )
{
this.persist( slot );
final ItemStack ret = inv.insertItem( slot, stack, simulate );
final ItemStack ret = this.inv.insertItem( slot, stack, simulate );
this.cleanup( slot );
return ret;
}
@@ -66,7 +66,7 @@ public class AppEngCellInventory implements IInternalItemHandler
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
this.persist( slot );
final ItemStack ret = inv.extractItem( slot, amount, simulate );
final ItemStack ret = this.inv.extractItem( slot, amount, simulate );
this.cleanup( slot );
return ret;
}
@@ -74,13 +74,13 @@ public class AppEngCellInventory implements IInternalItemHandler
@Override
public int getSlotLimit( int slot )
{
return inv.getSlotLimit( slot );
return this.inv.getSlotLimit( slot );
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
return inv.isItemValidForSlot( slot, stack );
return this.inv.isItemValidForSlot( slot, stack );
}
@Override
@@ -70,11 +70,11 @@ class CondenserItemInventory implements IMEMonitor<IAEItemStack>, ITickingMonito
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
{
AEItemStack ret = null;
ItemStack slotItem = target.getOutputSlot().getStackInSlot( 0 );
ItemStack slotItem = this.target.getOutputSlot().getStackInSlot( 0 );
if( !slotItem.isEmpty() && request.isSameType( slotItem ) )
{
int count = (int) Math.min( request.getStackSize(), Integer.MAX_VALUE );
ret = AEItemStack.fromItemStack( target.getOutputSlot().extractItem( 0, count, mode == Actionable.SIMULATE ) );
ret = AEItemStack.fromItemStack( this.target.getOutputSlot().extractItem( 0, count, mode == Actionable.SIMULATE ) );
}
return ret;
}
@@ -82,9 +82,9 @@ class CondenserItemInventory implements IMEMonitor<IAEItemStack>, ITickingMonito
@Override
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
{
if( !target.getOutputSlot().getStackInSlot( 0 ).isEmpty() )
if( !this.target.getOutputSlot().getStackInSlot( 0 ).isEmpty() )
{
out.add( AEItemStack.fromItemStack( target.getOutputSlot().getStackInSlot( 0 ) ) );
out.add( AEItemStack.fromItemStack( this.target.getOutputSlot().getStackInSlot( 0 ) ) );
}
return out;
}
@@ -351,7 +351,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
void outputChanged( ItemStack added, ItemStack removed )
{
itemInventory.updateOutput( added, removed );
this.itemInventory.updateOutput( added, removed );
}
@Nullable
@@ -58,7 +58,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
private static final double DILATION_SCALING = 25.0; // x4 ~ 40 AE/t at max
private static final int MIN_BURN_SPEED = 20;
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private final IItemHandler invExt = new WrapperFilteredItemHandler( inv, new FuelSlotFilter() );
private final IItemHandler invExt = new WrapperFilteredItemHandler( this.inv, new FuelSlotFilter() );
private int burnSpeed = 100;
private double burnTime = 0;
@@ -24,7 +24,7 @@ class ForgeEnergyAdapter implements IEnergyStorage
@Override
public final int receiveEnergy( int maxReceive, boolean simulate )
{
final double offered = (double) maxReceive;
final double offered = maxReceive;
final double overflow = this.sink.injectExternalPower( PowerUnits.RF, offered, simulate ? Actionable.SIMULATE : Actionable.MODULATE );
return (int) ( maxReceive - overflow );
@@ -42,7 +42,7 @@ class TeslaEnergyAdapter implements ITeslaConsumer
public long givePower( long power, boolean simulated )
{
// Cut it down to what we can represent in a double
double offeredPower = (double) power;
double offeredPower = power;
final double overflow = this.sink.injectExternalPower( PowerUnits.RF, offeredPower, simulated ? Actionable.SIMULATE : Actionable.MODULATE );
@@ -56,7 +56,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
{
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private final IItemHandler invExt = new WrapperFilteredItemHandler( inv, new SpatialIOFilter() );
private final IItemHandler invExt = new WrapperFilteredItemHandler( this.inv, new SpatialIOFilter() );
private YesNo lastRedstoneState = YesNo.UNDECIDED;
public TileSpatialIOPort()
@@ -149,9 +149,9 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
if( !res.isCanceled() )
{
int playerId = -1;
if( getProxy().getSecurity().isAvailable() )
if( this.getProxy().getSecurity().isAvailable() )
{
playerId = getProxy().getSecurity().getOwner();
playerId = this.getProxy().getSecurity().getOwner();
}
final TransitionResult tr = sc.doSpatialTransition( cell, this.world, spc.getMin(), spc.getMax(), playerId );
@@ -472,7 +472,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
if( this.cellHandler != null && this.cellHandler.getChannel() == channel )
{
return (IMEMonitor<T>) this.cellHandler;
return this.cellHandler;
}
return null;
}
@@ -878,7 +878,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
if( TileChest.this.cellHandler != null && TileChest.this.cellHandler
.getChannel() == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{
return TANK_PROPS;
return this.TANK_PROPS;
}
return null;
}
+20 -40
View File
@@ -33,63 +33,43 @@ public class ItemSorters
private static SortDir Direction = SortDir.ASCENDING;
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_NAME = new Comparator<IAEItemStack>()
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_NAME = ( o1, o2 ) ->
{
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
final int cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
return applyDirection( cmp );
}
final int cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
return applyDirection( cmp );
};
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_MOD = new Comparator<IAEItemStack>()
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_MOD = ( o1, o2 ) ->
{
final AEItemStack op1 = (AEItemStack) o1;
final AEItemStack op2 = (AEItemStack) o2;
int cmp = op1.getModID().compareToIgnoreCase( op2.getModID() );
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
if( cmp == 0 )
{
final AEItemStack op1 = (AEItemStack) o1;
final AEItemStack op2 = (AEItemStack) o2;
int cmp = op1.getModID().compareToIgnoreCase( op2.getModID() );
if( cmp == 0 )
{
cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
}
return applyDirection( cmp );
cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
}
return applyDirection( cmp );
};
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_SIZE = new Comparator<IAEItemStack>()
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_SIZE = ( o1, o2 ) ->
{
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
final int cmp = Long.compare( o2.getStackSize(), o1.getStackSize() );
return applyDirection( cmp );
}
final int cmp = Long.compare( o2.getStackSize(), o1.getStackSize() );
return applyDirection( cmp );
};
private static IInvTweaks api;
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_INV_TWEAKS = new Comparator<IAEItemStack>()
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_INV_TWEAKS = ( o1, o2 ) ->
{
@Override
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
if( api == null )
{
if( api == null )
{
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
}
final int cmp = api.compareItems( o1.createItemStack(), o2.createItemStack() );
return applyDirection( cmp );
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
}
final int cmp = api.compareItems( o1.createItemStack(), o2.createItemStack() );
return applyDirection( cmp );
};
public static void init()
@@ -42,7 +42,7 @@ public class ItemListIgnoreCrafting<T extends IAEStack<T>> implements IItemList<
{
if( option != null && option.isCraftable() )
{
option = (T) option.copy();
option = option.copy();
option.setCraftable( false );
}