aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2022-06-22 02:18:45 +0900
committerGitHub <noreply@github.com>2022-06-21 19:18:45 +0200
commit171ac8ff9971e43f7e84d624f7c3f792eb1bdad5 (patch)
treee9b72997aa933bfe43ea715dcc4b7e3858893c15 /src/main/java/goodgenerator
parent5558de940b1a6a29f50179e8737e7cc1aa530dfd (diff)
downloadGT5-Unofficial-171ac8ff9971e43f7e84d624f7c3f792eb1bdad5.tar.gz
GT5-Unofficial-171ac8ff9971e43f7e84d624f7c3f792eb1bdad5.tar.bz2
GT5-Unofficial-171ac8ff9971e43f7e84d624f7c3f792eb1bdad5.zip
Limit PASS recipes by energy hatch tier as well (#48)
Diffstat (limited to 'src/main/java/goodgenerator')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java b/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java
index d1306110df..848cda3540 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java
@@ -6,8 +6,6 @@ import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import cpw.mods.fml.common.network.NetworkRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_TooltipMultiBlockBase_EM;
import goodgenerator.loader.Loaders;
import goodgenerator.main.GoodGenerator;
@@ -30,7 +28,6 @@ import gregtech.api.util.GT_Utility;
import ic2.core.Ic2Items;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
@@ -58,6 +55,7 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM
protected int casingTier;
protected int machineTier;
protected int mode;
+ protected int energyHatchTier;
public PreciseAssembler(String name) {
super(name);
@@ -274,8 +272,8 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM
public long getMachineVoltageLimit() {
if (machineTier <= 0) return 0;
- if (machineTier >= 10) return Integer.MAX_VALUE - 7;
- else return GT_Values.V[machineTier - 1];
+ if (machineTier >= 10) return GT_Values.V[energyHatchTier];
+ else return GT_Values.V[Math.min(machineTier - 1, energyHatchTier)];
}
public ItemStack[] getStoredItemFromHatch(GT_MetaTileEntity_Hatch_InputBus tHatch) {
@@ -341,7 +339,9 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM
this.machineTier = 0;
this.casingAmount = 0;
this.casingTier = 0;
+ this.energyHatchTier = 0;
if (structureCheck_EM(mName, 4, 4, 0)) {
+ energyHatchTier = checkEnergyHatchTier();
if (casingTier != 0) {
reUpdate(1538 + casingTier);
}
@@ -360,8 +360,8 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM
.addInfo("Can assemble precise component in Precise Mode.")
.addInfo("Can work like a normal assembler in Normal Mode.")
.addInfo("Use screwdriver to change mode.")
- .addInfo("The Machine Casing limits the voltage tier the machine can work on.")
- .addInfo("UHV Machine Casing will unlock all voltage.")
+ .addInfo("Machine Casing and Energy Hatch limits the voltage tier the machine can work on.")
+ .addInfo("UHV Machine Casing will unlock all voltage, but you still need good Energy Hatch.")
.addInfo("Precise Electronic Unit Casing won't limit recipe in Normal Mode.")
.addInfo("But gives more parallel with more advanced one.")
.addInfo("It is 100% faster in Normal Mode.")
@@ -397,6 +397,21 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM
return new PreciseAssembler(this.mName);
}
+ private int checkEnergyHatchTier() {
+ int tier = 0;
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ tier = Math.max(tHatch.mTier, tier);
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) {
+ if (isValidMetaTileEntity(tHatch)) {
+ tier = Math.max(tHatch.mTier, tier);
+ }
+ }
+ return tier;
+ }
+
public int getCasingTier() {
return casingTier;
}