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
@@ -349,7 +349,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return Math.min(AEFluidInventory.this.capacity, Integer.MAX_VALUE);
|
||||
return AEFluidInventory.this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -82,7 +82,6 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
}
|
||||
|
||||
public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) {
|
||||
// sometimes i wish 1.7.10 has cap system.
|
||||
TileEntity inter = capProvider.getWorldObj().getTileEntity(
|
||||
capProvider.xCoord + face.offsetX,
|
||||
capProvider.yCoord + face.offsetY,
|
||||
@@ -376,9 +375,8 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
}
|
||||
if (tank != null && tank.getTankInfo(direction) != null) {
|
||||
List<FluidTankInfo[]> tankInfos = new LinkedList<>();
|
||||
if (Util.getPart(tank, direction) instanceof PartP2PLiquids) {
|
||||
if (Util.getPart(tank, direction) instanceof PartP2PLiquids invFluidsP2P) {
|
||||
// read other ends of p2p for blocking mode
|
||||
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) Util.getPart(tank, direction);
|
||||
try {
|
||||
Iterator<PartP2PLiquids> it = invFluidsP2P.getOutputs().iterator();
|
||||
boolean checkedInput = false;
|
||||
|
||||
@@ -22,7 +22,6 @@ public class FluidConvertingInventoryCrafting extends InventoryCrafting {
|
||||
if (fluid != null) {
|
||||
super.setInventorySlotContents(index, ItemFluidPacket.newStack(new FluidStack(fluid, stack.stackSize)));
|
||||
} else {
|
||||
// wtf?
|
||||
super.setInventorySlotContents(
|
||||
index,
|
||||
ItemFluidPacket.newStack(new FluidStack(FluidRegistry.WATER, 1000)));
|
||||
|
||||
@@ -181,10 +181,8 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
}
|
||||
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
|
||||
Iterator<?> var2 = this.cache.iterator();
|
||||
|
||||
while (var2.hasNext()) {
|
||||
IAEFluidStack fs = (IAEFluidStack) var2.next();
|
||||
for (IAEFluidStack fs : this.cache) {
|
||||
out.addStorage(fs);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -30,9 +30,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
if (te instanceof ITileStorageMonitorable
|
||||
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable
|
||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
|
||||
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import appeng.helpers.IPriorityHost;
|
||||
|
||||
public enum GuiType {
|
||||
|
||||
RENAMER(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -39,7 +39,7 @@ public enum GuiType {
|
||||
return new GuiRenamer(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
FLUID_AUTO_FILLER(new TileGuiFactory<TileFluidAutoFiller>(TileFluidAutoFiller.class) {
|
||||
FLUID_AUTO_FILLER(new TileGuiFactory<>(TileFluidAutoFiller.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidAutoFiller inv) {
|
||||
@@ -52,7 +52,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_LEVEL_EMITTER(new PartGuiFactory<PartFluidLevelEmitter>(PartFluidLevelEmitter.class) {
|
||||
FLUID_LEVEL_EMITTER(new PartGuiFactory<>(PartFluidLevelEmitter.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartFluidLevelEmitter inv) {
|
||||
@@ -65,7 +65,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
LEVEL_MAINTAINER(new TileGuiFactory<TileLevelMaintainer>(TileLevelMaintainer.class) {
|
||||
LEVEL_MAINTAINER(new TileGuiFactory<>(TileLevelMaintainer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) {
|
||||
@@ -78,7 +78,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
OC_PATTERN_EDITOR(new TileGuiFactory<TileOCPatternEditor>(TileOCPatternEditor.class) {
|
||||
OC_PATTERN_EDITOR(new TileGuiFactory<>(TileOCPatternEditor.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) {
|
||||
@@ -91,7 +91,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
DUAL_INTERFACE(new TileOrPartGuiFactory<IInterfaceHost>(IInterfaceHost.class) {
|
||||
DUAL_INTERFACE(new TileOrPartGuiFactory<>(IInterfaceHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IInterfaceHost inv) {
|
||||
@@ -104,7 +104,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<IDualHost>(IDualHost.class) {
|
||||
DUAL_INTERFACE_FLUID(new TileOrPartGuiFactory<>(IDualHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IDualHost inv) {
|
||||
@@ -117,7 +117,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
PRIORITY(new TileOrPartGuiFactory<IPriorityHost>(IPriorityHost.class) {
|
||||
PRIORITY(new TileOrPartGuiFactory<>(IPriorityHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IPriorityHost inv) {
|
||||
@@ -130,7 +130,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_BUS_IO(new PartGuiFactory<FCSharedFluidBus>(FCSharedFluidBus.class) {
|
||||
FLUID_BUS_IO(new PartGuiFactory<>(FCSharedFluidBus.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCSharedFluidBus inv) {
|
||||
@@ -143,7 +143,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_STORAGE_BUS(new PartGuiFactory<PartFluidStorageBus>(PartFluidStorageBus.class) {
|
||||
FLUID_STORAGE_BUS(new PartGuiFactory<>(PartFluidStorageBus.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartFluidStorageBus inv) {
|
||||
@@ -156,7 +156,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
INGREDIENT_BUFFER(new TileGuiFactory<TileIngredientBuffer>(TileIngredientBuffer.class) {
|
||||
INGREDIENT_BUFFER(new TileGuiFactory<>(TileIngredientBuffer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileIngredientBuffer inv) {
|
||||
@@ -169,7 +169,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<TileLargeIngredientBuffer>(TileLargeIngredientBuffer.class) {
|
||||
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<>(TileLargeIngredientBuffer.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
|
||||
@@ -182,7 +182,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
CRAFTING_STATUS(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
CRAFTING_STATUS(new PartOrItemGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -195,7 +195,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_TERMINAL(new TileOrPartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
FLUID_TERMINAL(new TileOrPartGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -208,7 +208,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
PORTABLE_FLUID_CELL(new ItemGuiFactory<IFluidPortableCell>(IFluidPortableCell.class) {
|
||||
PORTABLE_FLUID_CELL(new ItemGuiFactory<>(IFluidPortableCell.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IFluidPortableCell inv) {
|
||||
@@ -221,7 +221,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_FLUID_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -234,7 +234,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_ESSENTIA_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -247,7 +247,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_FLUID_PATTERN_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -259,7 +259,7 @@ public enum GuiType {
|
||||
return new GuiFluidPatternWireless(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_FLUID_PATTERN_TERMINAL_EX(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -271,7 +271,7 @@ public enum GuiType {
|
||||
return new GuiFluidPatternExWireless(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_INTERFACE_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -284,7 +284,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
WIRELESS_CRAFTING_TERMINAL(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -297,7 +297,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
FLUID_PATTERN_TERMINAL(new PartGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -310,7 +310,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
FLUID_PATTERN_TERMINAL_EX(new PartGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -323,7 +323,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_ENCODER(new TileGuiFactory<TileFluidPatternEncoder>(TileFluidPatternEncoder.class) {
|
||||
FLUID_PATTERN_ENCODER(new TileGuiFactory<>(TileFluidPatternEncoder.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidPatternEncoder inv) {
|
||||
@@ -336,7 +336,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<FCPart>(FCPart.class) {
|
||||
FLUID_CRAFTING_CONFIRM(new PartGuiFactory<>(FCPart.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, FCPart inv) {
|
||||
@@ -349,7 +349,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<IWirelessTerminal>(IWirelessTerminal.class) {
|
||||
FLUID_CRAFTING_CONFIRM_ITEM(new ItemGuiFactory<>(IWirelessTerminal.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
|
||||
@@ -362,7 +362,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
@@ -375,7 +375,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_PACKET_DECODER(new TileGuiFactory<TileFluidPacketDecoder>(TileFluidPacketDecoder.class) {
|
||||
FLUID_PACKET_DECODER(new TileGuiFactory<>(TileFluidPacketDecoder.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileFluidPacketDecoder inv) {
|
||||
@@ -388,7 +388,7 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
PATTERN_VALUE_SET(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
PATTERN_VALUE_SET(new PartOrItemGuiFactory<>(ITerminalHost.class) {
|
||||
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
|
||||
+4
-5
@@ -177,9 +177,8 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern
|
||||
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
|
||||
final ICraftingPatternDetails details = craftingPatternItem
|
||||
.getPatternForItem(is, this.getActionableNode().getWorld());
|
||||
|
||||
if (details != null) {
|
||||
@@ -373,8 +372,8 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
|
||||
|
||||
@Override
|
||||
public void sortCraftingItems() {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
List<ItemStack> fluids = new ArrayList<ItemStack>();
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
List<ItemStack> fluids = new ArrayList<>();
|
||||
for (ItemStack is : this.crafting) {
|
||||
if (is == null) continue;
|
||||
if (is.getItem() instanceof ItemFluidPacket) {
|
||||
|
||||
+4
-5
@@ -174,9 +174,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
ItemStack newStack) {
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern
|
||||
if (is != null && is.getItem() instanceof final ICraftingPatternItem craftingPatternItem) {
|
||||
final ICraftingPatternDetails details = craftingPatternItem
|
||||
.getPatternForItem(is, this.getActionableNode().getWorld());
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
@@ -345,8 +344,8 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
|
||||
|
||||
@Override
|
||||
public void sortCraftingItems() {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
List<ItemStack> fluids = new ArrayList<ItemStack>();
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
List<ItemStack> fluids = new ArrayList<>();
|
||||
for (ItemStack is : this.crafting) {
|
||||
if (is == null) continue;
|
||||
if (is.getItem() instanceof ItemFluidPacket) {
|
||||
|
||||
Reference in new issue
Block a user