mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
Code cleanup (#133)
* gradle updateBuildScript * fix comments and commented-out code Code deletion, converting comments into javadocs, and refactoring code to not need comments. * remove redundant suppressions * replace C-style array declaration with Java-style * make private field final * remove unnecessary semicolon * extract a common part from an if * simplify boolean expression * simplify ternary if * remove unused imports * convert escaped characters for clarity * replace while with for * replace explicit types with diamond operators * replace anonymous type with lambda * enable modern Java syntax * migrate to enhanced switch * migrate to pattern variables for instanceof * remove empty javadoc * add Nonnull annotation to overrides of Nonnull methods * replace wailaStack with null When wailaStack is not null, the flow breaks out of the loop, so there's no need to confuse the reader with putting wailaStack both as the result and the parameter of the call - there's no recursion. * int cannot be bigger than its max value * suppress dataflow warning * remove redundant initializer The default value of int is 0. * null check is covered by instanceof * simplify some calls of addVertexWithUV * fix typos and add TODOs * make flipState more understandable
This commit is contained in:
1 parent
f87b76347e
commit
d5b8ef6ea9
89 files changed
+421
-633
No files matched your search
@@ -99,9 +99,8 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
if (drained == null || drained.amount < fluid.amount) {
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
|
||||
FluidStack externallyDrained = tank.drain(
|
||||
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
|
||||
FluidStack externallyDrained = tileCertusQuartzTank.drain(
|
||||
new FluidStack(fluid.getFluid(), fluid.amount - (drained != null ? drained.amount : 0)),
|
||||
doDrain,
|
||||
false);
|
||||
@@ -158,16 +157,18 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
if (filled < fluid.amount) {
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) offTE;
|
||||
return filled + tank.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
|
||||
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
|
||||
return filled + tileCertusQuartzTank
|
||||
.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
|
||||
}
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
||||
/* IFluidHandler */
|
||||
/**
|
||||
* An override for {@link IFluidHandler}
|
||||
*/
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
if (resource == null || this.tank.getFluid() != null && resource.getFluid() != this.tank.getFluid().getFluid())
|
||||
@@ -223,7 +224,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
private TileCertusQuartzTank getTankBelow(TileEntity tile) {
|
||||
TileEntity tank = new BlockPos(tile).getOffSet(0, -1, 0).getTileEntity();
|
||||
if (tank != null && tank instanceof TileCertusQuartzTank) {
|
||||
if (tank instanceof TileCertusQuartzTank) {
|
||||
return (TileCertusQuartzTank) tank;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -50,9 +50,7 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
|
||||
.findPrecise(AEFluidStack.create(fs));
|
||||
this.invFluids.setFluidInSlot(0, ias);
|
||||
if (ias != null) return true;
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,9 +65,7 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
|
||||
this.source);
|
||||
if (notInserted != null) return fluidStack.amount -= notInserted.getStackSize();
|
||||
return fluidStack.amount;
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -92,9 +88,7 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
|
||||
.extractItems(ias, actionable, this.source);
|
||||
if (extracted == null) return null;
|
||||
return extracted.getFluidStack();
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -113,9 +107,7 @@ public class TileFluidBuffer extends AENetworkTile implements IAEFluidInventory,
|
||||
try {
|
||||
return this.getProxy().getStorage().getFluidInventory().getStorageList()
|
||||
.findPrecise(this.getAEFluidStack());
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
// based
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,7 +211,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
@Override
|
||||
public boolean isValid(Object verificationToken) {
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
|
||||
return fluidGrid != null && fluidGrid == verificationToken /* && !conflict */;
|
||||
return fluidGrid != null && fluidGrid == verificationToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user