Code cleanup
Added missing this, annotations, etc.
This commit is contained in:
@@ -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