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
@@ -78,16 +78,12 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
switch (meta) {
|
||||
case 1:
|
||||
return this.sideTopIcon;
|
||||
case 2:
|
||||
return this.sideBottomIcon;
|
||||
case 3:
|
||||
return this.sideMiddleIcon;
|
||||
default:
|
||||
return side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
|
||||
}
|
||||
return switch (meta) {
|
||||
case 1 -> this.sideTopIcon;
|
||||
case 2 -> this.sideBottomIcon;
|
||||
case 3 -> this.sideMiddleIcon;
|
||||
default -> side == 0 ? this.bottomIcon : side == 1 ? this.topIcon : this.sideIcon;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,8 +99,7 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileCertusQuartzTank) {
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) tile;
|
||||
if (tile instanceof TileCertusQuartzTank tank) {
|
||||
return tank.getFluidLightLevel();
|
||||
}
|
||||
return super.getLightValue(world, x, y, z);
|
||||
|
||||
@@ -76,21 +76,11 @@ public class BlockWalrus extends BaseBlockContainer {
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
|
||||
case NORTH:
|
||||
setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case EAST:
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case SOUTH:
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
|
||||
break;
|
||||
case WEST:
|
||||
setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
default:
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case NORTH -> setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
|
||||
case EAST -> setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
|
||||
case SOUTH -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
|
||||
case WEST -> setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
default -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,11 +86,6 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
// if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
// return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
// }
|
||||
//
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
@@ -101,8 +96,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
|
||||
if (inventory instanceof IFluidCellInventoryHandler) {
|
||||
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
|
||||
if (inventory instanceof final IFluidCellInventoryHandler handler) {
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if (cellInventory != null) {
|
||||
|
||||
@@ -46,41 +46,42 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
|
||||
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
case Cell1kPart -> {
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4kPart:
|
||||
}
|
||||
case Cell4kPart -> {
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16kPart:
|
||||
}
|
||||
case Cell16kPart -> {
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell64kPart:
|
||||
}
|
||||
case Cell64kPart -> {
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell256kPart:
|
||||
}
|
||||
case Cell256kPart -> {
|
||||
this.idleDrain = 2.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell1024kPart:
|
||||
}
|
||||
case Cell1024kPart -> {
|
||||
this.idleDrain = 3.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4096kPart:
|
||||
}
|
||||
case Cell4096kPart -> {
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
}
|
||||
case Cell16384kPart -> {
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
@@ -109,8 +108,7 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
|
||||
if (inventory instanceof IFluidCellInventoryHandler) {
|
||||
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
|
||||
if (inventory instanceof final IFluidCellInventoryHandler handler) {
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if (GuiScreen.isCtrlKeyDown()) {
|
||||
|
||||
@@ -47,41 +47,42 @@ public class ItemMultiFluidStorageCell extends FCBaseItemCell
|
||||
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + kilobytes);
|
||||
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
case Cell1kPart -> {
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4kPart:
|
||||
}
|
||||
case Cell4kPart -> {
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 32;
|
||||
break;
|
||||
case Cell16kPart:
|
||||
}
|
||||
case Cell16kPart -> {
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 128;
|
||||
break;
|
||||
case Cell64kPart:
|
||||
}
|
||||
case Cell64kPart -> {
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 512;
|
||||
break;
|
||||
case Cell256kPart:
|
||||
}
|
||||
case Cell256kPart -> {
|
||||
this.idleDrain = 2.5;
|
||||
this.perType = 2048;
|
||||
break;
|
||||
case Cell1024kPart:
|
||||
}
|
||||
case Cell1024kPart -> {
|
||||
this.idleDrain = 3.0;
|
||||
this.perType = 8192;
|
||||
break;
|
||||
case Cell4096kPart:
|
||||
}
|
||||
case Cell4096kPart -> {
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 32768;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
}
|
||||
case Cell16384kPart -> {
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 131072;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,7 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
if (inventory instanceof IFluidCellInventoryHandler) {
|
||||
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
|
||||
if (inventory instanceof final IFluidCellInventoryHandler handler) {
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
if (cellInventory != null) {
|
||||
lines.add(
|
||||
@@ -132,7 +131,6 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@@ -102,9 +102,7 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -153,9 +151,7 @@ public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
|
||||
player.openContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,9 +163,7 @@ public class PartFluidExportBus extends FCSharedFluidBus implements ICraftingReq
|
||||
}
|
||||
this.updateSchedulingMode(this.getSchedulingMode(), i);
|
||||
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
} catch (GridAccessException e) {
|
||||
// Ignore
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
|
||||
@@ -130,10 +130,16 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean flipState = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER)
|
||||
== RedstoneMode.LOW_SIGNAL;
|
||||
return flipState ? this.reportingValue >= this.lastReportedValue + 1
|
||||
: this.reportingValue < this.lastReportedValue + 1;
|
||||
final Enum<?> redstoneEmitterSetting = this.getConfigManager().getSetting(Settings.REDSTONE_EMITTER);
|
||||
final boolean result;
|
||||
|
||||
if (redstoneEmitterSetting == RedstoneMode.LOW_SIGNAL) {
|
||||
result = this.reportingValue >= this.lastReportedValue + 1;
|
||||
} else {
|
||||
result = this.reportingValue < this.lastReportedValue + 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -181,9 +187,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
this.myWatcher.add(myStack);
|
||||
}
|
||||
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
|
||||
} catch (final GridAccessException e1) {
|
||||
// :/
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
private void updateReportingValue(final IMEMonitor<IAEFluidStack> monitor) {
|
||||
@@ -282,9 +286,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
public void onListUpdate() {
|
||||
try {
|
||||
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
|
||||
} catch (final GridAccessException e) {
|
||||
// ;P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -304,40 +306,23 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
this.renderTorchAtAngle(0, -0.5, 0);
|
||||
Tessellator.instance.draw();
|
||||
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
|
||||
// rh.renderInventoryBox( renderer );
|
||||
}
|
||||
|
||||
private void renderTorchAtAngle(double baseX, double baseY, double baseZ) {
|
||||
final boolean isOn = this.isLevelEmitterOn();
|
||||
final IIcon offTexture = this.getItemStack().getIconIndex();
|
||||
final IIcon IIcon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture);
|
||||
//
|
||||
this.centerX = baseX + 0.5;
|
||||
this.centerY = baseY + 0.5;
|
||||
this.centerZ = baseZ + 0.5;
|
||||
|
||||
baseY += 7.0 / 16.0;
|
||||
|
||||
// double par11 = 0;
|
||||
|
||||
/*
|
||||
* double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 =
|
||||
* (double)IIcon.func_94212_f(); double d8 = (double)IIcon.func_94210_h(); double d9 =
|
||||
* (double)IIcon.func_94214_a(7.0D); double d10 = (double)IIcon.func_94207_b(6.0D); double d11 =
|
||||
* (double)IIcon.func_94214_a(9.0D); double d12 = (double)IIcon.func_94207_b(8.0D); double d13 =
|
||||
* (double)IIcon.func_94214_a(7.0D); double d14 = (double)IIcon.func_94207_b(13.0D); double d15 =
|
||||
* (double)IIcon.func_94214_a(9.0D); double d16 = (double)IIcon.func_94207_b(15.0D);
|
||||
*/
|
||||
|
||||
final float var16 = IIcon.getMinU();
|
||||
final float var17 = IIcon.getMaxU();
|
||||
final float var18 = IIcon.getMinV();
|
||||
final float var19 = IIcon.getMaxV();
|
||||
/*
|
||||
* float var16 = (float)var14 / 256.0F; float var17 = ((float)var14 + 15.99F) / 256.0F; float var18 =
|
||||
* (float)var15 / 256.0F; float var19 = ((float)var15 + 15.99F) / 256.0F;
|
||||
*/
|
||||
|
||||
final double var20b = offTexture.getInterpolatedU(7.0D);
|
||||
final double var24b = offTexture.getInterpolatedU(9.0D);
|
||||
|
||||
@@ -376,56 +361,26 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
final double var44 = 0.0625D;
|
||||
final double Zero = 0;
|
||||
final double par10 = 0;
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) - var44,
|
||||
baseY + TorchLen - toff,
|
||||
baseZ + par10 * (1.0D - TorchLen) - var44,
|
||||
var20,
|
||||
var22);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) - var44,
|
||||
baseY + TorchLen - toff,
|
||||
baseZ + par10 * (1.0D - TorchLen) + var44,
|
||||
var20,
|
||||
var26);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) + var44,
|
||||
baseY + TorchLen - toff,
|
||||
baseZ + par10 * (1.0D - TorchLen) + var44,
|
||||
var24,
|
||||
var26);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) + var44,
|
||||
baseY + TorchLen - toff,
|
||||
baseZ + par10 * (1.0D - TorchLen) - var44,
|
||||
var24,
|
||||
var22);
|
||||
|
||||
final double x = baseX + Zero * (1.0D - TorchLen) - var44;
|
||||
final double x1 = baseX + Zero * (1.0D - TorchLen) + var44;
|
||||
|
||||
final double y = baseY + TorchLen - toff;
|
||||
final double var422 = 0.1915D + 1.0 / 16.0;
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) + var44,
|
||||
baseY + var422,
|
||||
baseZ + par10 * (1.0D - TorchLen) - var44,
|
||||
var24b,
|
||||
var22b);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) + var44,
|
||||
baseY + var422,
|
||||
baseZ + par10 * (1.0D - TorchLen) + var44,
|
||||
var24b,
|
||||
var26b);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) - var44,
|
||||
baseY + var422,
|
||||
baseZ + par10 * (1.0D - TorchLen) + var44,
|
||||
var20b,
|
||||
var26b);
|
||||
this.addVertexWithUV(
|
||||
baseX + Zero * (1.0D - TorchLen) - var44,
|
||||
baseY + var422,
|
||||
baseZ + par10 * (1.0D - TorchLen) - var44,
|
||||
var20b,
|
||||
var22b);
|
||||
final double y1 = baseY + var422;
|
||||
|
||||
final double z = baseZ + par10 * (1.0D - TorchLen) - var44;
|
||||
final double z1 = baseZ + par10 * (1.0D - TorchLen) + var44;
|
||||
|
||||
this.addVertexWithUV(x, y, z, var20, var22);
|
||||
this.addVertexWithUV(x, y, z1, var20, var26);
|
||||
this.addVertexWithUV(x1, y, z1, var24, var26);
|
||||
this.addVertexWithUV(x1, y, z, var24, var22);
|
||||
|
||||
this.addVertexWithUV(x1, y1, z, var24b, var22b);
|
||||
this.addVertexWithUV(x1, y1, z1, var24b, var26b);
|
||||
this.addVertexWithUV(x, y1, z1, var20b, var26b);
|
||||
this.addVertexWithUV(x, y1, z, var20b, var22b);
|
||||
|
||||
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30);
|
||||
this.addVertexWithUV(baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34);
|
||||
@@ -503,13 +458,6 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh,
|
||||
final RenderBlocks renderer) {
|
||||
rh.setTexture(this.getItemStack().getIconIndex());
|
||||
// rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() );
|
||||
|
||||
// rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
// rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
|
||||
// rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
@@ -523,8 +471,6 @@ public class PartFluidLevelEmitter extends PartUpgradeable
|
||||
|
||||
rh.setBounds(7, 7, 11, 9, 9, 12);
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
|
||||
// super.renderWorldBlock( world, x, y, z, block, modelId, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,9 +41,8 @@ public class PartFluidPatternTerminal extends FCFluidEncodeTerminal {
|
||||
final ItemStack removedStack, final 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.getHost().getTile().getWorldObj());
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
|
||||
@@ -40,9 +40,8 @@ public class PartFluidPatternTerminalEx extends FCFluidEncodeTerminal {
|
||||
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.getHost().getTile().getWorldObj());
|
||||
|
||||
if (details != null) {
|
||||
|
||||
@@ -348,8 +348,7 @@ public class PartFluidStorageBus extends PartUpgradeable
|
||||
if (esh != null) {
|
||||
final IMEInventory<?> inv = esh
|
||||
.getInventory(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
|
||||
if (inv instanceof MEMonitorIFluidHandler) {
|
||||
final MEMonitorIFluidHandler h = (MEMonitorIFluidHandler) inv;
|
||||
if (inv instanceof final MEMonitorIFluidHandler h) {
|
||||
h.setMode((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER));
|
||||
h.setActionSource(new MachineSource(this));
|
||||
this.monitor = (MEMonitorIFluidHandler) inv;
|
||||
|
||||
@@ -179,8 +179,8 @@ public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatte
|
||||
|
||||
@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) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public abstract class FCPart extends AEBasePart
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.getProxy().setIdlePowerUsage(1.0 / 2.0);
|
||||
} else {
|
||||
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little bit.
|
||||
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little
|
||||
}
|
||||
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
@@ -163,9 +163,7 @@ public abstract class FCPart extends AEBasePart
|
||||
if (this.getProxy().getNode().meetsChannelRequirements()) {
|
||||
this.clientFlags = this.getClientFlags() | FCPart.CHANNEL_FLAG;
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// um.. nothing.
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
|
||||
data.writeByte((byte) this.getClientFlags());
|
||||
}
|
||||
@@ -195,18 +193,10 @@ public abstract class FCPart extends AEBasePart
|
||||
}
|
||||
|
||||
switch (this.getSpin()) {
|
||||
case 0:
|
||||
this.spin = 1;
|
||||
break;
|
||||
case 1:
|
||||
this.spin = 3;
|
||||
break;
|
||||
case 2:
|
||||
this.spin = 0;
|
||||
break;
|
||||
case 3:
|
||||
this.spin = 2;
|
||||
break;
|
||||
case 0 -> this.spin = 1;
|
||||
case 1 -> this.spin = 3;
|
||||
case 2 -> this.spin = 0;
|
||||
case 3 -> this.spin = 2;
|
||||
}
|
||||
|
||||
this.getHost().markForUpdate();
|
||||
@@ -276,9 +266,7 @@ public abstract class FCPart extends AEBasePart
|
||||
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||
try {
|
||||
return this.getProxy().getStorage().getItemInventory();
|
||||
} catch (final GridAccessException e) {
|
||||
// err nope?
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -286,9 +274,7 @@ public abstract class FCPart extends AEBasePart
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
try {
|
||||
return this.getProxy().getStorage().getFluidInventory();
|
||||
} catch (final GridAccessException e) {
|
||||
// err nope?
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -434,27 +420,27 @@ public abstract class FCPart extends AEBasePart
|
||||
/**
|
||||
* The texture used for the bright front layer.
|
||||
* <p>
|
||||
* The final texture can overlap any of the the texture in no particular order.
|
||||
* The final texture can overlap any of the texture in no particular order.
|
||||
*/
|
||||
public abstract FCPartsTexture getFrontBright();
|
||||
|
||||
/**
|
||||
* The texture used for the colored (medium) front layer.
|
||||
* <p>
|
||||
* The final texture can overlap any of the the texture in no particular order.
|
||||
* The final texture can overlap any of the texture in no particular order.
|
||||
*/
|
||||
public abstract FCPartsTexture getFrontColored();
|
||||
|
||||
/**
|
||||
* The texture used for the dark front layer.
|
||||
* <p>
|
||||
* The final texture can overlap any of the the texture in no particular order.
|
||||
* The final texture can overlap any of the texture in no particular order.
|
||||
*/
|
||||
public abstract FCPartsTexture getFrontDark();
|
||||
|
||||
/**
|
||||
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and non
|
||||
* light source 9.
|
||||
* Should the part emit light. This actually only affects the light level, light source use a level of 15 and
|
||||
* non-light source 9.
|
||||
*/
|
||||
public abstract boolean isLightSource();
|
||||
}
|
||||
@@ -175,9 +175,7 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
|
||||
|
||||
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// >.>
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
protected void extractItem(final EntityPlayer player) {}
|
||||
@@ -248,41 +246,35 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
|
||||
}
|
||||
|
||||
private void tesrRenderScreen(final Tessellator tess, final IAEFluidStack ais) {
|
||||
// GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
final ForgeDirection d = this.getSide();
|
||||
|
||||
GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);
|
||||
|
||||
switch (d) {
|
||||
case UP:
|
||||
case UP -> {
|
||||
GL11.glScalef(1.0f, -1.0f, 1.0f);
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glRotatef(this.getSpin() * 90.0F, 0, 0, 1);
|
||||
break;
|
||||
case DOWN:
|
||||
}
|
||||
case DOWN -> {
|
||||
GL11.glScalef(1.0f, -1.0f, 1.0f);
|
||||
GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glRotatef(this.getSpin() * -90.0F, 0, 0, 1);
|
||||
break;
|
||||
case EAST:
|
||||
}
|
||||
case EAST -> {
|
||||
GL11.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
|
||||
break;
|
||||
case WEST:
|
||||
}
|
||||
case WEST -> {
|
||||
GL11.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
|
||||
break;
|
||||
case NORTH:
|
||||
GL11.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
break;
|
||||
case SOUTH:
|
||||
}
|
||||
case NORTH -> GL11.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
case SOUTH -> {
|
||||
GL11.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
final ItemStack sis = ItemFluidPacket.newDisplayStack(ais.getFluidStack());
|
||||
|
||||
@@ -296,7 +288,6 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
// RenderHelper.enableGUIStandardItemLighting();
|
||||
tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);
|
||||
|
||||
ClientHelper.proxy.doRenderItem(sis, this.getTile().getWorldObj());
|
||||
@@ -318,7 +309,6 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
|
||||
GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
|
||||
fr.drawString(renderedStackSize, 0, 0, 0);
|
||||
}
|
||||
// GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,9 +62,7 @@ public abstract class FCSharedFluidBus extends PartUpgradeable implements IGridT
|
||||
} else {
|
||||
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,24 +57,15 @@ public enum CellType {
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(CellType type) {
|
||||
switch (type) {
|
||||
case Cell1kPart:
|
||||
return EnumChatFormatting.GOLD;
|
||||
case Cell4kPart:
|
||||
return EnumChatFormatting.YELLOW;
|
||||
case Cell16kPart:
|
||||
return EnumChatFormatting.GREEN;
|
||||
case Cell64kPart:
|
||||
return EnumChatFormatting.AQUA;
|
||||
case Cell256kPart:
|
||||
return EnumChatFormatting.BLUE;
|
||||
case Cell1024kPart:
|
||||
return EnumChatFormatting.LIGHT_PURPLE;
|
||||
case Cell4096kPart:
|
||||
return EnumChatFormatting.RED;
|
||||
case Cell16384kPart:
|
||||
return EnumChatFormatting.DARK_PURPLE;
|
||||
}
|
||||
return EnumChatFormatting.WHITE;
|
||||
return switch (type) {
|
||||
case Cell1kPart -> EnumChatFormatting.GOLD;
|
||||
case Cell4kPart -> EnumChatFormatting.YELLOW;
|
||||
case Cell16kPart -> EnumChatFormatting.GREEN;
|
||||
case Cell64kPart -> EnumChatFormatting.AQUA;
|
||||
case Cell256kPart -> EnumChatFormatting.BLUE;
|
||||
case Cell1024kPart -> EnumChatFormatting.LIGHT_PURPLE;
|
||||
case Cell4096kPart -> EnumChatFormatting.RED;
|
||||
case Cell16384kPart -> EnumChatFormatting.DARK_PURPLE;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,7 @@ public class FluidCellHandler implements ICellHandler {
|
||||
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
|
||||
final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan) {
|
||||
if (chan == StorageChannel.FLUIDS) {
|
||||
if (chest instanceof TileEntity) {
|
||||
TileEntity te = (TileEntity) chest;
|
||||
if (chest instanceof TileEntity te) {
|
||||
InventoryHandler
|
||||
.openGui(player, te.getWorldObj(), new BlockPos(te), chest.getUp(), GuiType.FLUID_TERMINAL);
|
||||
}
|
||||
@@ -59,8 +58,7 @@ public class FluidCellHandler implements ICellHandler {
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(final ItemStack is, final IMEInventory handler) {
|
||||
if (handler instanceof FluidCellInventoryHandler) {
|
||||
final FluidCellInventoryHandler ci = (FluidCellInventoryHandler) handler;
|
||||
if (handler instanceof final FluidCellInventoryHandler ci) {
|
||||
return ci.getStatusForCell();
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -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