aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/blocks/tileEntity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/goodgenerator/blocks/tileEntity')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java85
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/AntimatterGenerator.java6
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaHatch.java2
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaOutputHatchME.java2
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java4
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java10
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java4
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java2
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java5
9 files changed, 52 insertions, 68 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java
index 1749b07df8..c60f4e56ac 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java
@@ -90,27 +90,27 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
private static final float coefficientBaseExp = 0.5f;
private static final float baseSkew = 0.2f;
- private float[] modifiers = { 0.0f, 0.0f, 0.0f, 0.0f };
- private FluidStack[] upgradeFluids = { null, null, null, null };
- private int[] fluidConsumptions = { 0, 0, 0, 0 };
+ private final float[] modifiers = { 0.0f, 0.0f, 0.0f, 0.0f };
+ private final FluidStack[] upgradeFluids = { null, null, null, null };
+ private final int[] fluidConsumptions = { 0, 0, 0, 0 };
public static final String MAIN_NAME = "antimatterForge";
- private int speed = 100;
+ private final int speed = 100;
private long rollingCost = 0L;
private boolean isLoadedChunk;
public GTRecipe mLastRecipe;
public int para;
- private Random r = new Random();
+ private final Random r = new Random();
// Values for displaying cycle data
private long guiAntimatterAmount = 0;
private long guiAntimatterChange = 0;
private long guiPassiveEnergy = 0;
private long guiActiveEnergy = 0;
- private boolean canRender = false;
+ private final boolean canRender = false;
- private List<AntimatterOutputHatch> amOutputHatches = new ArrayList<>(16);
- private static final ClassValue<IStructureDefinition<AntimatterForge>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<AntimatterForge>>() {
+ private final List<AntimatterOutputHatch> amOutputHatches = new ArrayList<>(16);
+ private static final ClassValue<IStructureDefinition<AntimatterForge>> STRUCTURE_DEFINITION = new ClassValue<>() {
@Override
protected IStructureDefinition<AntimatterForge> computeValue(Class<?> type) {
@@ -189,10 +189,10 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
+ "Antimatter"
+ EnumChatFormatting.GRAY
+ " * "
- + String.valueOf(this.passiveBaseMult)
+ + passiveBaseMult
+ ")^"
+ EnumChatFormatting.GREEN
- + String.valueOf(this.passiveBaseExp)
+ + passiveBaseExp
+ EnumChatFormatting.GRAY
+ " EU/t passively. The consumption decays by 0.5% every tick when empty")
.addInfo(
@@ -200,10 +200,10 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
+ "Antimatter"
+ EnumChatFormatting.GRAY
+ " * "
- + String.valueOf(this.activeBaseMult)
+ + activeBaseMult
+ ")^"
+ EnumChatFormatting.DARK_PURPLE
- + String.valueOf(this.activeBaseExp)
+ + activeBaseExp
+ EnumChatFormatting.GRAY
+ " EU per operation to produce antimatter")
.addSeparator()
@@ -223,19 +223,19 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
+ EnumChatFormatting.GRAY
+ "^"
+ EnumChatFormatting.GOLD
- + String.valueOf(this.coefficientBaseExp)
+ + coefficientBaseExp
+ EnumChatFormatting.GRAY
+ ") * N("
+ EnumChatFormatting.AQUA
- + String.valueOf(this.baseSkew)
+ + baseSkew
+ EnumChatFormatting.GRAY
+ ", 0.25) of antimatter per cycle, consuming equal amounts of Protomatter")
.addInfo(
"The change is split between the 16 Antimatter Hatches, sampled from N(" + EnumChatFormatting.AQUA
- + String.valueOf(this.baseSkew)
+ + baseSkew
+ EnumChatFormatting.GRAY
+ ", 1) (Gaussian distribution with mean of "
- + String.valueOf(this.baseSkew)
+ + baseSkew
+ ")")
.addInfo("The total change can be negative!")
.addSeparator()
@@ -461,14 +461,10 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
private long calculateContainedAntimatter() {
long antimatterStored = 0;
- for (int i = 0; i < amOutputHatches.size(); i++) {
- if (amOutputHatches.get(i) == null || !amOutputHatches.get(i)
- .isValid()
- || amOutputHatches.get(i)
- .getFluid() == null)
- continue;
- antimatterStored += amOutputHatches.get(i)
- .getFluid().amount;
+ for (AntimatterOutputHatch amOutputHatch : amOutputHatches) {
+ if (amOutputHatch != null && amOutputHatch.isValid() && amOutputHatch.getFluid() != null) {
+ antimatterStored += amOutputHatch.getFluid().amount;
+ }
}
return antimatterStored;
}
@@ -507,17 +503,12 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
int ratioLosses = 0;
// Reduce the amount of antimatter in each hatch by half of the difference between the lowest amount and current
// hatch contents
- for (int i = 0; i < amOutputHatches.size(); i++) {
- if (amOutputHatches.get(i) == null || !amOutputHatches.get(i)
- .isValid()
- || amOutputHatches.get(i)
- .getFluid() == null)
- continue;
- FluidStack fluid = amOutputHatches.get(i)
- .getFluid()
- .copy();
- ratioLosses -= amOutputHatches.get(i)
- .drain((int) ((fluid.amount - minAntimatterAmount) * 0.5), true).amount;
+ for (AntimatterOutputHatch amOutputHatch : amOutputHatches) {
+ if (amOutputHatch != null && amOutputHatch.isValid() && amOutputHatch.getFluid() != null) {
+ FluidStack fluid = amOutputHatch.getFluid()
+ .copy();
+ ratioLosses -= amOutputHatch.drain((int) ((fluid.amount - minAntimatterAmount) * 0.5), true).amount;
+ }
}
// Check for upgrade fluids
@@ -534,8 +525,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
}
List<FluidStack> inputFluids = getStoredFluids();
- for (int i = 0; i < inputFluids.size(); i++) {
- FluidStack inputFluid = inputFluids.get(i);
+ for (FluidStack inputFluid : inputFluids) {
setModifiers(inputFluid, -0.15f, magneticUpgrades, MAGNETIC_ID);
setModifiers(inputFluid, -0.05f, gravityUpgrades, GRAVITY_ID);
setModifiers(inputFluid, 0.05f, containmentUpgrades, CONTAINMENT_ID);
@@ -571,7 +561,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
containedProtomatter);
// We didn't have enough protomatter, reduce antimatter by 10% and stop the machine.
- if (!this.depleteInput(MaterialsUEVplus.Protomatter.getFluid((long) Math.abs(antimatterChange)))) {
+ if (!this.depleteInput(MaterialsUEVplus.Protomatter.getFluid(Math.abs(antimatterChange)))) {
decimateAntimatter();
stopMachine(ShutDownReasonRegistry.outOfFluid(MaterialsUEVplus.Protomatter.getFluid(1L)));
endRecipeProcessing();
@@ -623,17 +613,12 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
}
private void decimateAntimatter() {
- for (int i = 0; i < amOutputHatches.size(); i++) {
- if (amOutputHatches.get(i) == null || !amOutputHatches.get(i)
- .isValid()
- || amOutputHatches.get(i)
- .getFluid() == null)
- continue;
- FluidStack fluid = amOutputHatches.get(i)
- .getFluid()
- .copy();
- amOutputHatches.get(i)
- .drain((int) Math.floor(fluid.amount * 0.1), true);
+ for (AntimatterOutputHatch amOutputHatch : amOutputHatches) {
+ if (amOutputHatch != null && amOutputHatch.isValid() && amOutputHatch.getFluid() != null) {
+ FluidStack fluid = amOutputHatch.getFluid()
+ .copy();
+ amOutputHatch.drain((int) Math.floor(fluid.amount * 0.1), true);
+ }
}
}
@@ -648,7 +633,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo
int change = (int) (Math.ceil((r.nextGaussian() + baseSkew + modifiers[ACTIVATION_ID]) * (coeff / 16)));
difference += change;
if (change >= 0) {
- hatch.fill(MaterialsUEVplus.Antimatter.getFluid((long) (change)), true);
+ hatch.fill(MaterialsUEVplus.Antimatter.getFluid(change), true);
} else {
hatch.drain(-change, true);
}
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterGenerator.java b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterGenerator.java
index 8cb3fed65b..b299c0d502 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterGenerator.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterGenerator.java
@@ -79,7 +79,7 @@ public class AntimatterGenerator extends MTEExtendedPowerMultiBlockBase
private float annihilationEfficiency = 0f;
public static final long ANTIMATTER_FUEL_VALUE = 1_000_000_000_000L;
- private static final ClassValue<IStructureDefinition<AntimatterGenerator>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<AntimatterGenerator>>() {
+ private static final ClassValue<IStructureDefinition<AntimatterGenerator>> STRUCTURE_DEFINITION = new ClassValue<>() {
@Override
protected IStructureDefinition<AntimatterGenerator> computeValue(Class<?> type) {
@@ -125,7 +125,7 @@ public class AntimatterGenerator extends MTEExtendedPowerMultiBlockBase
.extFacing()
.glow()
.build()));
- };
+ }
private boolean addLaserSource(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) {
IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity();
@@ -278,7 +278,7 @@ public class AntimatterGenerator extends MTEExtendedPowerMultiBlockBase
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new AntimatterGenerator(this.MAIN_NAME);
+ return new AntimatterGenerator(MAIN_NAME);
}
@Override
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaHatch.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaHatch.java
index d8680f5efd..fdc2445aee 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaHatch.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaHatch.java
@@ -169,7 +169,7 @@ public class MTEEssentiaHatch extends TileEntity implements IAspectContainer, IE
@Override
public boolean doesContainerContain(AspectList aspectList) {
- ArrayList<Boolean> ret = new ArrayList<Boolean>();
+ ArrayList<Boolean> ret = new ArrayList<>();
for (Aspect a : aspectList.aspects.keySet()) ret.add(current.aspects.containsKey(a));
return !ret.contains(false);
}
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaOutputHatchME.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaOutputHatchME.java
index 4e8bba61ec..a832cf72cc 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaOutputHatchME.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEEssentiaOutputHatchME.java
@@ -25,7 +25,7 @@ public class MTEEssentiaOutputHatchME extends MTEEssentiaOutputHatch implements
private AENetworkProxy gridProxy = null;
private IMEEssentiaMonitor monitor = null;
- private MachineSource asMachineSource = new MachineSource(this);
+ private final MachineSource asMachineSource = new MachineSource(this);
@Override
public void updateEntity() {
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java
index f2b83bb663..f855a864a6 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java
@@ -54,7 +54,7 @@ public class MTEFuelRefineFactory extends MTETooltipMultiBlockBaseEM implements
private IStructureDefinition<MTEFuelRefineFactory> multiDefinition = null;
private int Tier = -1;
- private int[] cnt = new int[] { 0, 0, 0, 0 };
+ private final int[] cnt = new int[] { 0, 0, 0, 0 };
private static final Block[] coils = new Block[] { Loaders.FRF_Coil_1, Loaders.FRF_Coil_2, Loaders.FRF_Coil_3,
Loaders.FRF_Coil_4 };
@@ -128,7 +128,7 @@ public class MTEFuelRefineFactory extends MTETooltipMultiBlockBaseEM implements
}
public static <T> IStructureElement<T> ofFieldCoil(int aIndex) {
- return new IStructureElement<T>() {
+ return new IStructureElement<>() {
@Override
public boolean check(T t, World world, int x, int y, int z) {
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java b/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java
index 43d066d5b5..8b69ee5e0a 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java
@@ -81,9 +81,9 @@ public class MTELargeEssentiaSmeltery extends MTETooltipMultiBlockBaseEM
protected int nodeIncrease = 0;
private IStructureDefinition<MTELargeEssentiaSmeltery> multiDefinition = null;
- private ArrayList<MTEEssentiaOutputHatch> mEssentiaOutputHatches = new ArrayList<>();
+ private final ArrayList<MTEEssentiaOutputHatch> mEssentiaOutputHatches = new ArrayList<>();
private int pTier = 0;
- private XSTR xstr = new XSTR();
+ private final XSTR xstr = new XSTR();
public MTELargeEssentiaSmeltery(String name) {
super(name);
@@ -131,8 +131,8 @@ public class MTELargeEssentiaSmeltery extends MTETooltipMultiBlockBaseEM
if (len > MAX_STRUCTURE_LENGTH - 1 || len < DEFAULT_STRUCTURE_LENGTH) return false;
if (!structureCheck_EM(STRUCTURE_PIECE_LAST, 2, 2, -len - 1)) return false;
if (this.mCasing >= 24 && this.mMaintenanceHatches.size() == 1
- && this.mInputBusses.size() >= 1
- && this.mEssentiaOutputHatches.size() >= 1) {
+ && !this.mInputBusses.isEmpty()
+ && !this.mEssentiaOutputHatches.isEmpty()) {
this.mParallel = Math.floor(this.mParallel += 1 << this.pTier);
return true;
}
@@ -288,7 +288,7 @@ public class MTELargeEssentiaSmeltery extends MTETooltipMultiBlockBaseEM
private boolean addEssentiaOutputHatchToMachineList(MTEEssentiaOutputHatch aTileEntity) {
if (aTileEntity instanceof MTEEssentiaOutputHatch) {
- return this.mEssentiaOutputHatches.add((MTEEssentiaOutputHatch) aTileEntity);
+ return this.mEssentiaOutputHatches.add(aTileEntity);
}
return false;
}
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java
index c83ef8c4fe..6ba3c48148 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java
@@ -338,7 +338,7 @@ public class MTEMultiNqGenerator extends MTETooltipMultiBlockBaseEM implements I
}
public void addAutoEnergy(long outputPower) {
- if (this.eDynamoMulti.size() > 0) for (MTEHatch tHatch : this.eDynamoMulti) {
+ if (!this.eDynamoMulti.isEmpty()) for (MTEHatch tHatch : this.eDynamoMulti) {
long voltage = tHatch.maxEUOutput();
long power = voltage * tHatch.maxAmperesOut();
long outputAmperes;
@@ -352,7 +352,7 @@ public class MTEMultiNqGenerator extends MTETooltipMultiBlockBaseEM implements I
addEnergyOutput_EM(outputPower, 1);
}
}
- if (this.mDynamoHatches.size() > 0) for (MTEHatch tHatch : this.mDynamoHatches) {
+ if (!this.mDynamoHatches.isEmpty()) for (MTEHatch tHatch : this.mDynamoHatches) {
long voltage = tHatch.maxEUOutput();
long power = voltage * tHatch.maxAmperesOut();
long outputAmperes;
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java
index 72ced183c3..f2302511fb 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java
@@ -76,7 +76,7 @@ public abstract class MTELargeFusionComputer extends MTETooltipMultiBlockBaseEM
public GTRecipe mLastRecipe;
public int para;
protected OverclockDescriber overclockDescriber;
- private static final ClassValue<IStructureDefinition<MTELargeFusionComputer>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<MTELargeFusionComputer>>() {
+ private static final ClassValue<IStructureDefinition<MTELargeFusionComputer>> STRUCTURE_DEFINITION = new ClassValue<>() {
@Override
protected IStructureDefinition<MTELargeFusionComputer> computeValue(Class<?> type) {
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
index 7b06dbb96d..076d8f54fd 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
@@ -45,7 +45,7 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
implements ISurvivalConstructable {
private static final String STRUCTURE_PIECE_MAIN = "main";
- private static final ClassValue<IStructureDefinition<MTELargeTurbineBase>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<MTELargeTurbineBase>>() {
+ private static final ClassValue<IStructureDefinition<MTELargeTurbineBase>> STRUCTURE_DEFINITION = new ClassValue<>() {
@Override
protected IStructureDefinition<MTELargeTurbineBase> computeValue(Class<?> type) {
@@ -270,7 +270,7 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
maxEnergy += tHatch.getBaseMetaTileEntity()
.getEUCapacity();
}
- String[] ret = new String[] {
+ return new String[] {
// 8 Lines available for information panels
tRunning + ": "
+ EnumChatFormatting.RED
@@ -315,7 +315,6 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
+ EnumChatFormatting.RESET
+ " %" /* 8 */
};
- return ret;
}
public boolean hasTurbine() {