Code cleanup
Added missing this, annotations, etc.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user