aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2023-04-01 20:06:12 +0100
committerGitHub <noreply@github.com>2023-04-01 19:06:12 +0000
commitb088958c9f6935d356b6c087c8e8106b400aa24f (patch)
treebe608fac08ba158f1226a4fb9f5b1ed459bac2a9 /src/main/java/gregtech/api/metatileentity
parente52cd9c3458584e58073df5cd9cde1302994f266 (diff)
downloadGT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.tar.gz
GT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.tar.bz2
GT5-Unofficial-b088958c9f6935d356b6c087c8e8106b400aa24f.zip
Jabel, Generic injection and mostly automatic code cleanup (#1829)
* Enable Jabel&Generic injection, fix type error caused by this * add missing <> * Infer generic types automatically * Parametrize cast types * Use enhanced for loops * Unnecessary boxing * Unnecessary unboxing * Use Objects.equals * Explicit type can be replaced with `<>` * Collapse identical catch blocks * Add SafeVarargs where applicable * Anonymous type can be replaced with lambda * Use List.sort directly * Lambda can be a method reference * Statement lambda can be an expression lambda * Use string switches * Instanceof pattern matching * Text block can be used * Migrate to enhanced switch * Java style array declarations * Unnecessary toString() * More unnecessary String conversions * Unnecessary modifiers * Unnecessary semicolons * Fix duplicate conditions * Extract common code from if branches * Replace switches with ifs for 1-2 cases * Inner class may be static * Minor performance issues * Replace string appending in loops with string builders * Fix IntelliJ using the wrong empty list method * Use Long.compare * Generic arguments: getSubItems * Generic arguments: getSubBlocks * Raw types warnings * Fix remaining missing generics * Too weak variable type leads to unnecessary cast * Redundant type casts * Redundant array length check * Redundant vararg arrays * Manual min/max implementations * A couple missed inspections * Goodbye explosion power ternary ladder * Apply spotless * Get rid of the other two big ternary ladders * Binary search explosion power * Don't overcomplicate things
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java28
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java32
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseTileEntity.java9
-rw-r--r--src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java23
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java35
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java35
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java116
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java120
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java39
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java49
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java826
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java68
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java23
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java16
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java40
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java18
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java43
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java4
23 files changed, 524 insertions, 1013 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index e1a83f5cc6..0bc1201827 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -346,36 +346,34 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (isClientSide()) {
issueTextureUpdate();
switch (aEventID) {
- case GregTechTileClientEvents.CHANGE_COMMON_DATA:
- mConnections = (byte) aValue;
- break;
- case GregTechTileClientEvents.CHANGE_CUSTOM_DATA:
+ case GregTechTileClientEvents.CHANGE_COMMON_DATA -> mConnections = (byte) aValue;
+ case GregTechTileClientEvents.CHANGE_CUSTOM_DATA -> {
if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue);
- break;
- case GregTechTileClientEvents.CHANGE_COLOR:
+ }
+ case GregTechTileClientEvents.CHANGE_COLOR -> {
if (aValue > 16 || aValue < 0) aValue = 0;
mColor = (byte) aValue;
- break;
- case GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT:
+ }
+ case GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT -> {
mSidedRedstone[0] = (byte) ((aValue & 1) == 1 ? 15 : 0);
mSidedRedstone[1] = (byte) ((aValue & 2) == 2 ? 15 : 0);
mSidedRedstone[2] = (byte) ((aValue & 4) == 4 ? 15 : 0);
mSidedRedstone[3] = (byte) ((aValue & 8) == 8 ? 15 : 0);
mSidedRedstone[4] = (byte) ((aValue & 16) == 16 ? 15 : 0);
mSidedRedstone[5] = (byte) ((aValue & 32) == 32 ? 15 : 0);
- break;
- case GregTechTileClientEvents.DO_SOUND:
+ }
+ case GregTechTileClientEvents.DO_SOUND -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case GregTechTileClientEvents.START_SOUND_LOOP:
+ }
+ case GregTechTileClientEvents.START_SOUND_LOOP -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case GregTechTileClientEvents.STOP_SOUND_LOOP:
+ }
+ case GregTechTileClientEvents.STOP_SOUND_LOOP -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
+ }
}
}
return true;
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 00e31ed9a0..0f908bdaa3 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -728,48 +728,46 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (isClientSide()) {
issueTextureUpdate();
switch (aEventID) {
- case GregTechTileClientEvents.CHANGE_COMMON_DATA:
+ case GregTechTileClientEvents.CHANGE_COMMON_DATA -> {
mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
// mLockUpgrade = ((aValue&32) != 0);
mWorks = ((aValue & 64) != 0);
- break;
- case GregTechTileClientEvents.CHANGE_CUSTOM_DATA:
+ }
+ case GregTechTileClientEvents.CHANGE_CUSTOM_DATA -> {
if (hasValidMetaTileEntity()) {
if ((aValue & 0x80) == 0) // Is texture index
mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F));
else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) // is texture page and hatch
((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
}
- break;
- case GregTechTileClientEvents.CHANGE_COLOR:
+ }
+ case GregTechTileClientEvents.CHANGE_COLOR -> {
if (aValue > 16 || aValue < 0) aValue = 0;
mColor = (byte) aValue;
- break;
- case GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT:
+ }
+ case GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT -> {
mSidedRedstone[0] = (byte) ((aValue & 1) == 1 ? 15 : 0);
mSidedRedstone[1] = (byte) ((aValue & 2) == 2 ? 15 : 0);
mSidedRedstone[2] = (byte) ((aValue & 4) == 4 ? 15 : 0);
mSidedRedstone[3] = (byte) ((aValue & 8) == 8 ? 15 : 0);
mSidedRedstone[4] = (byte) ((aValue & 16) == 16 ? 15 : 0);
mSidedRedstone[5] = (byte) ((aValue & 32) == 32 ? 15 : 0);
- break;
- case GregTechTileClientEvents.DO_SOUND:
+ }
+ case GregTechTileClientEvents.DO_SOUND -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case GregTechTileClientEvents.START_SOUND_LOOP:
+ }
+ case GregTechTileClientEvents.START_SOUND_LOOP -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case GregTechTileClientEvents.STOP_SOUND_LOOP:
+ }
+ case GregTechTileClientEvents.STOP_SOUND_LOOP -> {
if (hasValidMetaTileEntity() && mTickTimer > 20)
mMetaTileEntity.stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case GregTechTileClientEvents.CHANGE_LIGHT:
- mLightValue = (byte) aValue;
- break;
+ }
+ case GregTechTileClientEvents.CHANGE_LIGHT -> mLightValue = (byte) aValue;
}
}
return true;
diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
index 238dc6ba30..3ef732b1c8 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
@@ -861,8 +861,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje
final ItemStackHandler inventoryHandler = getInventoryHandler();
if (inventoryHandler == null) return;
- if (!(this instanceof IInventory)) return;
- final IInventory inv = (IInventory) this;
+ if (!(this instanceof IInventory inv)) return;
final IConfigurationCircuitSupport ccs = getConfigurationCircuitSupport();
if (ccs == null) return;
@@ -937,8 +936,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje
final IConfigurationCircuitSupport ccs = getConfigurationCircuitSupport();
if (ccs == null) return;
- if (!(this instanceof IInventory)) return;
- final IInventory inv = (IInventory) this;
+ if (!(this instanceof IInventory inv)) return;
final List<ItemStack> circuits = ccs.getConfigurationCircuits();
uiContext.openClientWindow(
@@ -965,8 +963,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje
final IConfigurationCircuitSupport ccs = getConfigurationCircuitSupport();
if (ccs == null) return;
- if (!(this instanceof IInventory)) return;
- final IInventory inv = (IInventory) this;
+ if (!(this instanceof IInventory inv)) return;
GT_Values.NW.sendToServer(new GT_Packet_SetConfigurationCircuit(this, selected));
// we will not do any validation on client side
diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
index f2929e7e1e..4167bf1701 100644
--- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
@@ -702,18 +702,17 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
.setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT))
.addChild(
new ItemDrawable(
- () -> { return getCoverItemAtSide(side); })
- .asWidget()
- .setPos(
- (COVER_TAB_WIDTH
- - ICON_SIZE)
- / 2
- + (flipHorizontally
- ? -1
- : 1),
- (COVER_TAB_HEIGHT
- - ICON_SIZE)
- / 2))
+ () -> getCoverItemAtSide(side)).asWidget()
+ .setPos(
+ (COVER_TAB_WIDTH
+ - ICON_SIZE)
+ / 2
+ + (flipHorizontally
+ ? -1
+ : 1),
+ (COVER_TAB_HEIGHT
+ - ICON_SIZE)
+ / 2))
.setEnabled(widget -> getCoverItemAtSide(side) != null));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index cf1cb5dc1b..a42525ae45 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -1,7 +1,6 @@
package gregtech.api.metatileentity;
import static gregtech.api.enums.GT_Values.GT;
-import static gregtech.api.enums.GT_Values.V;
import java.io.File;
import java.util.ArrayList;
@@ -33,6 +32,7 @@ import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
+import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IColoredTileEntity;
@@ -115,7 +115,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID);
tStack.getItem()
- .addInformation(tStack, null, new ArrayList<String>(), true);
+ .addInformation(tStack, null, new ArrayList<>(), true);
}
/**
@@ -754,36 +754,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
@Override
public void doExplosion(long aExplosionPower) {
- float tStrength = aExplosionPower < V[0] ? 1.0F
- : aExplosionPower < V[1] ? 2.0F
- : aExplosionPower < V[2] ? 3.0F
- : aExplosionPower < V[3] ? 4.0F
- : aExplosionPower < V[4] ? 5.0F
- : aExplosionPower < V[4] * 2 ? 6.0F
- : aExplosionPower < V[5] ? 7.0F
- : aExplosionPower < V[6] ? 8.0F
- : aExplosionPower < V[7] ? 9.0F
- : aExplosionPower < V[8] ? 10.0F
- : aExplosionPower < V[8] * 2
- ? 11.0F
- : aExplosionPower < V[9]
- ? 12.0F
- : aExplosionPower
- < V[10] ? 13.0F
- : aExplosionPower
- < V[11] ? 14.0F
- : aExplosionPower
- < V[12] ? 15.0F
- : aExplosionPower
- < V[12] * 2
- ? 16.0F
- : aExplosionPower
- < V[13] ? 17.0F
- : aExplosionPower
- < V[14] ? 18.0F
- : aExplosionPower
- < V[15] ? 19.0F
- : 20.0F;
+ float tStrength = GT_Values.getExplosionPowerForVoltage(aExplosionPower);
int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(),
tZ = getBaseMetaTileEntity().getZCoord();
World tWorld = getBaseMetaTileEntity().getWorld();
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index a017fca2e0..c929bd5677 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -1,7 +1,5 @@
package gregtech.api.metatileentity;
-import static gregtech.api.enums.GT_Values.V;
-
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -45,6 +43,7 @@ import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.SoundResource;
import gregtech.api.enums.SteamVariant;
import gregtech.api.gui.GT_GUIColorOverride;
@@ -846,8 +845,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void setInventorySlotContents(int aIndex, ItemStack aStack) {
markDirty();
- if (this instanceof IConfigurationCircuitSupport) {
- IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) this;
+ if (this instanceof IConfigurationCircuitSupport ccs) {
if (ccs.allowSelectCircuit() && aIndex == ccs.getCircuitSlot() && aStack != null) {
mInventory[aIndex] = GT_Utility.copyAmount(0, aStack);
return;
@@ -1090,28 +1088,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void doExplosion(long aExplosionPower) {
- // spotless:off
- float tStrength =
- aExplosionPower < V[0] ? 1.0F :
- aExplosionPower < V[1] ? 2.0F :
- aExplosionPower < V[2] ? 3.0F :
- aExplosionPower < V[3] ? 4.0F :
- aExplosionPower < V[4] ? 5.0F :
- aExplosionPower < V[4] * 2 ? 6.0F :
- aExplosionPower < V[5] ? 7.0F :
- aExplosionPower < V[6] ? 8.0F :
- aExplosionPower < V[7] ? 9.0F :
- aExplosionPower < V[8] ? 10.0F :
- aExplosionPower < V[8] * 2 ? 11.0F :
- aExplosionPower < V[9] ? 12.0F :
- aExplosionPower < V[10] ? 13.0F :
- aExplosionPower < V[11] ? 14.0F :
- aExplosionPower < V[12] ? 15.0F :
- aExplosionPower < V[12] * 2 ? 16.0F :
- aExplosionPower < V[13] ? 17.0F :
- aExplosionPower < V[14] ? 18.0F :
- aExplosionPower < V[15] ? 19.0F : 20.0F;
- // spotless:on
+ float tStrength = GT_Values.getExplosionPowerForVoltage(aExplosionPower);
final int tX = getBaseMetaTileEntity().getXCoord();
final int tY = getBaseMetaTileEntity().getYCoord();
final int tZ = getBaseMetaTileEntity().getZCoord();
@@ -1201,9 +1178,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing())
.name()));
- if (this instanceof IPowerChannelState) {
+ if (this instanceof IPowerChannelState state) {
// adapted from PowerStateWailaDataProvider
- final IPowerChannelState state = (IPowerChannelState) this;
NBTTagCompound tag = accessor.getNBTData();
final boolean isActive = tag.getBoolean("isActive");
final boolean isPowered = tag.getBoolean("isPowered");
@@ -1224,9 +1200,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac
@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
int z) {
- if (this instanceof IPowerChannelState) {
+ if (this instanceof IPowerChannelState state) {
// adapted from PowerStateWailaDataProvider
- final IPowerChannelState state = (IPowerChannelState) this;
final boolean isActive = state.isActive();
final boolean isPowered = state.isPowered();
final boolean isBooting = state.isBooting();
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index 790d4d6c1f..2a1ec3c22c 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -223,8 +223,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet<TileEntity> aAlreadyPassedSet) {
if (!getBaseMetaTileEntity().isServerSide() || !isConnectedAtSide(aSide) && aSide != 6) return 0;
final BaseMetaPipeEntity tBase = (BaseMetaPipeEntity) getBaseMetaTileEntity();
- if (!(tBase.getNode() instanceof PowerNode)) return 0;
- final PowerNode tNode = (PowerNode) tBase.getNode();
+ if (!(tBase.getNode() instanceof PowerNode tNode)) return 0;
if (tNode != null) {
int tPlace = 0;
final Node[] tToPower = new Node[tNode.mConsumers.size()];
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index a3e44640e8..b428d187d7 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -159,40 +159,24 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
protected static ITexture getRestrictorTexture(byte aMask) {
- switch (aMask) {
- case 1:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UP);
- case 2:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN);
- case 3:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UD);
- case 4:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT);
- case 5:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UL);
- case 6:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DL);
- case 7:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NR);
- case 8:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT);
- case 9:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UR);
- case 10:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DR);
- case 11:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NL);
- case 12:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LR);
- case 13:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_ND);
- case 14:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NU);
- case 15:
- return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR);
- default:
- return null;
- }
+ return switch (aMask) {
+ case 1 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UP);
+ case 2 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN);
+ case 3 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UD);
+ case 4 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT);
+ case 5 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UL);
+ case 6 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DL);
+ case 7 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NR);
+ case 8 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT);
+ case 9 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UR);
+ case 10 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DR);
+ case 11 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NL);
+ case 12 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LR);
+ case 13 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_ND);
+ case 14 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NU);
+ case 15 -> TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR);
+ default -> null;
+ };
}
@Override
@@ -349,22 +333,22 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
sendSound((byte) 9);
if (tTemperature > 320) {
try {
- for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld()
- .getEntitiesWithinAABB(
- EntityLivingBase.class,
- AxisAlignedBB.getBoundingBox(
- getBaseMetaTileEntity().getXCoord()
- - 2,
- getBaseMetaTileEntity().getYCoord()
- - 2,
- getBaseMetaTileEntity().getZCoord()
- - 2,
- getBaseMetaTileEntity().getXCoord()
- + 3,
- getBaseMetaTileEntity().getYCoord()
- + 3,
- getBaseMetaTileEntity().getZCoord()
- + 3))) {
+ for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld()
+ .getEntitiesWithinAABB(
+ EntityLivingBase.class,
+ AxisAlignedBB.getBoundingBox(
+ getBaseMetaTileEntity().getXCoord()
+ - 2,
+ getBaseMetaTileEntity().getYCoord()
+ - 2,
+ getBaseMetaTileEntity().getZCoord()
+ - 2,
+