aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorMaxim <maxim235@gmx.de>2023-07-17 10:06:27 +0200
committerGitHub <noreply@github.com>2023-07-17 10:06:27 +0200
commitd17d3b8ebcaf7eccd7b8f3036f5161bf190690d6 (patch)
treeb3a3e0ca6bf8ec4d5f4a539a1f2a488ac6efdba0 /src/main/java/com
parentfbfca2f60c6c83f77c9d80517b62db902fcc3c85 (diff)
downloadGT5-Unofficial-d17d3b8ebcaf7eccd7b8f3036f5161bf190690d6.tar.gz
GT5-Unofficial-d17d3b8ebcaf7eccd7b8f3036f5161bf190690d6.tar.bz2
GT5-Unofficial-d17d3b8ebcaf7eccd7b8f3036f5161bf190690d6.zip
Implement generic processing logic (#340)
* Migrated MegaMultiBlockBase to ExtendedPowerBase * Migrated MOC * Migrated MCR * Migrated MCR * Migrated MVF * Migrated MEBF * Migrated MDT * Use Energy.or(ExoticEnergy) instead of TTEnabledEnergyHatchElement * Set GPL power to be totalEU voltage at 1 ampere * Fix coil tier of MEBF * Migrated CAL * Migrated EIC * Migrated vat * Fixed MDT void protection * Clean up code * Updated dep * Updated deps * Update dependencies.gradle * Update dependencies.gradle * Update dependencies.gradle * Fix EIC power * Update src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java Co-authored-by: miozune <miozune@gmail.com> * Update src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java Co-authored-by: miozune <miozune@gmail.com> * Addressed reviews --------- Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: miozune <miozune@gmail.com> Former-commit-id: 32ebaeb20cd9b9d1338d990b647c5f05b366116c
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java4
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java163
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java95
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java102
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java106
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java251
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java152
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java138
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java291
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaOilCracker.java153
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java117
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/util/ResultWrongSievert.java86
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/TecTechEnabledMulti.java129
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/IHasCoils.java23
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java173
15 files changed, 384 insertions, 1599 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
index d656e9840f..cf88fe51bb 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
@@ -61,6 +61,7 @@ import com.github.bartimaeusnek.bartworks.system.material.Werkstoff;
import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader;
import com.github.bartimaeusnek.bartworks.system.material.processingLoaders.DownTierLoader;
import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler;
+import com.github.bartimaeusnek.bartworks.util.ResultWrongSievert;
import com.github.bartimaeusnek.bartworks.util.log.DebugLog;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -75,6 +76,7 @@ import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Mods;
+import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
@@ -180,6 +182,8 @@ public final class MainMod {
WerkstoffLoader.run();
LocalisationLoader.localiseAll();
+ CheckRecipeResultRegistry.register(new ResultWrongSievert(0, ResultWrongSievert.NeededSievertType.EXACTLY));
+
RadioHatchMaterialLoader.run();
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
index bb01ef8cce..b8a9bdecaa 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java
@@ -21,7 +21,6 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAn
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
-import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW;
@@ -31,7 +30,6 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import javax.annotation.Nullable;
@@ -48,6 +46,8 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
+import org.jetbrains.annotations.NotNull;
+
import com.github.bartimaeusnek.bartworks.API.SideReference;
import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
@@ -60,6 +60,7 @@ import com.github.bartimaeusnek.bartworks.util.BW_Util;
import com.github.bartimaeusnek.bartworks.util.BioCulture;
import com.github.bartimaeusnek.bartworks.util.Coords;
import com.github.bartimaeusnek.bartworks.util.MathUtils;
+import com.github.bartimaeusnek.bartworks.util.ResultWrongSievert;
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
@@ -69,13 +70,15 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_BioVat> {
@@ -86,7 +89,6 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
private final HashSet<EntityPlayerMP> playerMPHashSet = new HashSet<>();
private final ArrayList<GT_MetaTileEntity_RadioHatch> mRadHatches = new ArrayList<>();
private int height = 1;
- private GT_Recipe mLastRecipe;
private Fluid mFluid = FluidRegistry.LAVA;
private BioCulture mCulture;
private ItemStack mStack;
@@ -168,14 +170,6 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
return ret;
}
- public boolean isLiquidInput(byte aSide) {
- return false;
- }
-
- public boolean isLiquidOutput(byte aSide) {
- return false;
- }
-
private int getInputCapacity() {
return this.mInputHatches.stream().mapToInt(GT_MetaTileEntity_Hatch_Input::getCapacity).sum();
}
@@ -230,115 +224,60 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa
return MathUtils.clamp(1, ret, ConfigHandler.bioVatMaxParallelBonus);
}
- private List<ItemStack> getItemInputs() {
- ArrayList<ItemStack> tInputList = this.getStoredInputs();
- int tInputList_sS = tInputList.size();
- for (int i = 0; i < tInputList_sS - 1; i++) {
- for (int j = i + 1; j < tInputList_sS; j++) {
- if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
- if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
- tInputList.remove(j--);
- tInputList_sS = tInputList.size();
- } else {
- tInputList.remove(i--);
- tInputList_sS = tInputList.size();
- break;
+ @Override
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic() {
+
+ @NotNull
+ @Override
+ protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) {
+ if (!BW_Util.areStacksEqualOrNull((ItemStack) recipe.mSpecialItems, getControllerSlot()))
+ return CheckRecipeResultRegistry.NO_RECIPE;
+ int[] conditions = GT_TileEntity_BioVat.specialValueUnpack(recipe.mSpecialValue);
+ mNeededSievert = conditions[3];
+
+ if (mGlassTier < conditions[0]) {
+ return CheckRecipeResultRegistry.insufficientMachineTier(conditions[0]);
+ }
+
+ if (conditions[2] == 0) {
+ if (mSievert < mNeededSievert) {
+ return ResultWrongSievert.insufficientSievert(mNeededSievert);
+ }
+ } else {
+ if (mSievert != conditions[3]) {
+ return ResultWrongSievert.wrongSievert(conditions[3]);
}
}
+
+ return CheckRecipeResultRegistry.SUCCESSFUL;
}
- }
- return tInputList;
- }
-
- private List<FluidStack> getFluidInputs() {
- ArrayList<FluidStack> tFluidList = this.getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; i++) {
- for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
+
+ @NotNull
+ @Override
+ public CheckRecipeResult process() {
+ CheckRecipeResult result = super.process();
+ if (!result.wasSuccessful()) {
+ return result;
+ }
+ // We already made sure the recipe runs. Now the vat looks for as many "parallels" as it can do
+ mExpectedMultiplier = getExpectedMultiplier(lastRecipe.getFluidOutput(0), true);
+ mTimes = 1;
+ for (int i = 1; i < mExpectedMultiplier; i++) {
+ if (depleteInput(lastRecipe.mFluidInputs[0])) {
+ mTimes++;
}
}
+ this.outputFluids[0].amount *= mTimes;
+ return result;
}
- }
- return tFluidList;
+ };
}
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- GT_Recipe.GT_Recipe_Map gtRecipeMap = this.getRecipeMap();
-
- if (gtRecipeMap == null) return false;
-
- ItemStack[] tInputs = getItemInputs().toArray(new ItemStack[0]);
- FluidStack[] tFluids = getFluidInputs().toArray(new FluidStack[0]);
-
- if (tFluids.length <= 0) return false;
-
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- long tEnergy = V[tTier];
-
- GT_Recipe gtRecipe = gtRecipeMap.findRecipe(
- this.getBaseMetaTileEntity(),
- this.mLastRecipe,
- false,
- tEnergy,
- tFluids,
- itemStack,
- tInputs);
-
- if (gtRecipe == null) return false;
-
- assert gtRecipe.mFluidInputs.length == 1;
- assert gtRecipe.mFluidOutputs.length == 1;
-
- if (!BW_Util.areStacksEqualOrNull((ItemStack) gtRecipe.mSpecialItems, itemStack)) return false;
-
- int[] conditions = GT_TileEntity_BioVat.specialValueUnpack(gtRecipe.mSpecialValue);
-
- this.mNeededSievert = conditions[3];
-
- if (conditions[2] == 0 ? (this.mSievert < this.mNeededSievert || this.mGlassTier < conditions[0])
- : (this.mSievert != conditions[3] || this.mGlassTier < conditions[0]))
- return false;
-
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- if (!canOutputAll(gtRecipe)) return false;
- if (!gtRecipe.isRecipeInputEqual(true, tFluids, tInputs)) return false;
-
- final FluidStack recipeFluidOutput = gtRecipe.getFluidOutput(0);
- final FluidStack recipeFluidInput = gtRecipe.mFluidInputs[0];
-
- this.mExpectedMultiplier = this.getExpectedMultiplier(recipeFluidOutput, true);
-
- this.mTimes = 1;
- for (int i = 1; i < this.mExpectedMultiplier; i++) {
- if (this.depleteInput(recipeFluidInput)) {
- this.mTimes++;
- }
- }
-
- this.mOutputFluids = new FluidStack[] {
- new FluidStack(recipeFluidOutput, recipeFluidOutput.amount * this.mTimes) };
-
- BW_Util.calculateOverclockedNessMulti(gtRecipe.mEUt, gtRecipe.mDuration, 1, tEnergy, this);
-
- if (this.mEUt > 0) this.mEUt = -this.mEUt;
- this.mProgresstime = 0;
-
- if (gtRecipe.mCanBeBuffered) this.mLastRecipe = gtRecipe;
-
- this.updateSlots();
- return true;
+ protected void setupProcessingLogic(ProcessingLogic logic) {
+ super.setupProcessingLogic(logic);
+ logic.setSpecialSlotItem(getControllerSlot());
}
public FluidStack getStoredFluidOutputs() {
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
index c64ae704ca..e46199d654 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
@@ -30,8 +30,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -43,11 +41,12 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import org.jetbrains.annotations.NotNull;
+
import com.github.bartimaeusnek.bartworks.system.material.CircuitGeneration.BW_Meta_Items;
import com.github.bartimaeusnek.bartworks.system.material.CircuitGeneration.CircuitImprintLoader;
import com.github.bartimaeusnek.bartworks.util.BWRecipes;
import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
@@ -57,14 +56,18 @@ import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.SoundResource;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
@@ -82,6 +85,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends
private static final String STRUCTURE_PIECE_NEXT = "next";
private String imprintedItemName;
+ private ItemStack imprintedStack;
private static final IStructureDefinition<GT_TileEntity_CircuitAssemblyLine> STRUCTURE_DEFINITION = StructureDefinition
.<GT_TileEntity_CircuitAssemblyLine>builder()
@@ -148,7 +152,6 @@ public class GT_TileEntity_CircuitAssemblyLine extends
}
private NBTTagCompound type = new NBTTagCompound();
- private GT_Recipe bufferedRecipe;
public GT_TileEntity_CircuitAssemblyLine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -204,64 +207,38 @@ public class GT_TileEntity_CircuitAssemblyLine extends
super.saveNBTData(aNBT);
}
- private final Collection<GT_Recipe> GT_RECIPE_COLLECTION = new HashSet<>();
-
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- if (this.type.equals(new NBTTagCompound())) if (!this.imprintMachine(itemStack)) return false;
-
- if (this.bufferedRecipe != null && this.bufferedRecipe.isRecipeInputEqual(
- true,
- false,
- BW_Util.getFluidsFromInputHatches(this),
- getStoredInputs().toArray(new ItemStack[0]))) {
- setRecipeStats();
- return true;
- }
-
- ItemStack stack = ItemStack.loadItemStackFromNBT(this.type);
- imprintedItemName = GT_LanguageManager.getTranslateableItemStackName(stack);
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return BWRecipes.instance.getMappingsFor((byte) 3);
+ }
- if (stack == null) return false;
+ @Override
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic().enablePerfectOverclock();
+ }
- if (this.GT_RECIPE_COLLECTION.isEmpty()) {
- for (GT_Recipe recipe : BWRecipes.instance.getMappingsFor((byte) 3).mRecipeList) {
- if (GT_Utility.areStacksEqual(recipe.mOutputs[0], stack, true)) {
- this.GT_RECIPE_COLLECTION.add(recipe);
- }
- }
+ @NotNull
+ @Override
+ public CheckRecipeResult checkProcessing() {
+ if (this.type.equals(new NBTTagCompound()) && !this.imprintMachine(getControllerSlot()))
+ return SimpleCheckRecipeResult.ofFailure("no_imprint");
+ if (imprintedItemName == null || imprintedStack == null) {
+ imprintedStack = new ItemStack(BW_Meta_Items.getNEWCIRCUITS(), 1, 0);
+ imprintedStack.setTagCompound(type);
+ imprintedItemName = GT_LanguageManager.getTranslateableItemStackName(imprintedStack);
}
+ return super.checkProcessing();
+ }
- for (GT_Recipe recipe : this.GT_RECIPE_COLLECTION) {
- if (!canOutputAll(recipe)) return false;
- if (recipe.isRecipeInputEqual(
- true,
- false,
- BW_Util.getFluidsFromInputHatches(this),
- getStoredInputs().toArray(new ItemStack[0])))
- this.bufferedRecipe = recipe;
- else continue;
-
- this.setRecipeStats();
- return true;
- }
- return false;
+ @Override
+ protected void setupProcessingLogic(ProcessingLogic logic) {
+ super.setupProcessingLogic(logic);
+ logic.setSpecialSlotItem(imprintedStack);
}
- private void setRecipeStats() {
- calculatePerfectOverclockedNessMulti(
- this.bufferedRecipe.mEUt,
- this.bufferedRecipe.mDuration,
- 1,
- this.getMaxInputVoltage());
- if (this.mEUt > 0) this.mEUt = -this.mEUt;
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = this.bufferedRecipe.mOutputs;
- this.mOutputFluids = this.bufferedRecipe.mFluidOutputs;
- sendLoopStart((byte) 20);
- this.updateSlots();
+ @Override
+ protected SoundResource getProcessStartSound() {
+ return SoundResource.IC2_MACHINES_MAGNETIZER_LOOP;
}
@Override
@@ -445,6 +422,11 @@ public class GT_TileEntity_CircuitAssemblyLine extends
}
@Override
+ public boolean supportsBatchMode() {
+ return true;
+ }
+
+ @Override
public boolean isRecipeLockingEnabled() {
return imprintedItemName != null && !imprintedItemName.equals("");
}
@@ -466,7 +448,6 @@ public class GT_TileEntity_CircuitAssemblyLine extends
int z) {
super.getWailaNBTData(player, tile, tag, world, x, y, z);
String imprintedWith = getTypeForDisplay();
- if (imprintedWith != "") tag.setString("ImprintedWith", imprintedWith);
-
+ if (!imprintedWith.isEmpty()) tag.setString("ImprintedWith", imprintedWith);
}
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java
deleted file mode 100644
index 2f14088a3d..0000000000
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CrackingDistillTower.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package com.github.bartimaeusnek.bartworks.common.tileentities.multis;
-
-import java.util.ArrayList;
-
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
-
-import com.github.bartimaeusnek.bartworks.util.BWRecipes;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.MathUtils;
-
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DistillationTower;
-
-public class GT_TileEntity_CrackingDistillTower extends GT_MetaTileEntity_DistillationTower {
-
- public GT_TileEntity_CrackingDistillTower(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
-
- public GT_TileEntity_CrackingDistillTower(String aName) {
- super(aName);
- }
-
- @Override
- public boolean checkRecipe(ItemStack itemStack) {
- if (!GT_Utility.areStacksEqual(itemStack, GT_Utility.getIntegratedCircuit(0), true)) return false;
- else {
- FluidStack[] array = new FluidStack[0];
- ArrayList<FluidStack> fluidInputs = new ArrayList<>();
- for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) {
- if (hatch != null) {
- fluidInputs.add(hatch.getFluid());
- }
- }
- array = fluidInputs.toArray(array);
- GT_Recipe.GT_Recipe_Map rMapCracking = GT_Recipe.GT_Recipe_Map.sCrakingRecipes;
- GT_Recipe.GT_Recipe_Map rMapDistillTower = GT_Recipe.GT_Recipe_Map.sDistillationRecipes;
- GT_Recipe recipeCracking = rMapCracking
- .findRecipe(this.getBaseMetaTileEntity(), false, this.getMaxInputVoltage(), array, itemStack);
- if (recipeCracking == null) return false;
- GT_Recipe recipeDistill = rMapDistillTower.findRecipe(
- this.getBaseMetaTileEntity(),
- false,
- this.getMaxInputVoltage(),
- recipeCracking.mFluidOutputs);
- if (recipeDistill == null) return false;
- float ratio = (float) recipeCracking.mFluidOutputs[0].amount / (float) recipeDistill.mFluidInputs[0].amount;
- FluidStack[] nuoutputs = new FluidStack[recipeDistill.mFluidOutputs.length];
- for (int i = 0; i < nuoutputs.length; i++) {
- nuoutputs[i] = recipeDistill.mFluidOutputs[i];
- nuoutputs[i].amount = MathUtils.floorInt(recipeDistill.mFluidOutputs[i].amount * ratio);
- }
- BWRecipes.DynamicGTRecipe combined = new BWRecipes.DynamicGTRecipe(
- true,
- null,
- recipeDistill.mOutputs,
- null,
- recipeDistill.mChances,
- recipeCracking.mFluidInputs,
- nuoutputs,
- (MathUtils.floorInt(recipeDistill.mDuration * ratio)) + recipeCracking.mDuration,
- Math.max((MathUtils.floorInt(recipeDistill.mEUt * ratio)), recipeCracking.mEUt),
- 0);
- if (combined.isRecipeInputEqual(true, array)) {
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- BW_Util.calculateOverclockedNessMulti(
- combined.mEUt,
- combined.mDuration,
- 1,
- this.getMaxInputVoltage(),
- this);
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputFluids = combined.mFluidOutputs.clone();
- this.mOutputItems = combined.mOutputs.clone();
- this.updateSlots();
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java
index b09d512fff..2466ff6c53 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java
@@ -18,7 +18,6 @@ import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTI
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.TT;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.enums.GT_HatchElement.*;
-import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
@@ -27,16 +26,14 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
-import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.tuple.Pair;
+import org.jetbrains.annotations.NotNull;
import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.client.renderer.BW_EICPistonVisualizer;
@@ -64,6 +61,7 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
@@ -138,9 +136,7 @@ public class GT_TileEntity_ElectricImplosionCompressor
if (te.piston) {
Block candidate = world.getBlock(x, y, z);
int candidateMeta = world.getBlockMetadata(x, y, z);
- if (getTierOfBlock(candidate, candidateMeta) == -1) {
- return false;
- }
+ return getTierOfBlock(candidate, candidateMeta) != -1;
}
return true;
}
@@ -190,7 +186,6 @@ public class GT_TileEntity_ElectricImplosionCompressor
add(Pair.of(GregTech_API.sBlockMetal9, 8));
}
- ;
};
}
@@ -260,67 +255,31 @@ public class GT_TileEntity_ElectricImplosionCompressor
}
@Override
- public boolean checkRecipe(ItemStack aStack) {
- lEUt = 0;
- mOutputItems = null;
- mOutputFluids = null;
- long tTotalEU = getMaxInputEu();
-
- // Only allow up to one tier skip
- byte tTier = (byte) (mMaxHatchTier + 1);
-
- ItemStack[] tItemInputs = getStoredInputs().toArray(new ItemStack[0]);
- FluidStack[] tFluidInputs = getStoredFluids().toArray(new FluidStack[0]);
-
- if ((tItemInputs.length > 0) || (tFluidInputs.length > 0)) {
- GT_Recipe tRecipe = eicMap.findRecipe(getBaseMetaTileEntity(), false, V[tTier], tFluidInputs, tItemInputs);
- if (tRecipe == null) {
- return false;
- }
-
- int tCurrentMaxParallel = 1;
- if (mBlockTier > 1) {
- tCurrentMaxParallel = (int) Math.pow(4, Math.max(mBlockTier - 1, 0));
- }
-
- GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(tRecipe).setItemInputs(tItemInputs)
- .setFluidInputs(tFluidInputs).setAvailableEUt(tTotalEU).setMaxParallel(tCurrentMaxParallel)
- .enableConsumption().enableOutputCalculation().setController(this);
-
- if (batchMode) {
- helper.enableBatchMode(128);
- }
-
- helper.build();
-
- if (helper.getCurrentParallel() == 0) {
- return false;
- }
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt).setEUt(tTotalEU)
- .setDuration(tRecipe.mDuration)
- .setParallel((int) Math.floor(helper.getCurrentParallel() / helper.getDurationMultiplier()))
- .calculate();
-
- lEUt = -calculator.getConsumption();
- mMaxProgresstime = (int) Math.ceil(calculator.getDuration() * helper.getDurationMultiplier());
-
- this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000;
- this.mEfficiencyIncrease = 10000;
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return eicMap;
+ }
- // In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && lEUt == Long.MAX_VALUE - 1) return false;
- if (this.lEUt > 0) {
- this.lEUt = -this.lEUt;
+ @Override
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic() {
+
+ @NotNull
+ @Override
+ protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe,
+ @NotNull GT_ParallelHelper helper) {
+ // For overclocking we'll allow all power to be used
+ return super.createOverclockCalculator(recipe, helper).setEUt(getMaxInputEu()).setAmperage(1);
}
+ }.setMaxParallelSupplier(() -> (int) Math.pow(4, Math.max(mBlockTier - 1, 0)));
+ }
- this.mOutputItems = helper.getItemOutputs();
- this.mOutputFluids = helper.getFluidOutputs();
-
- this.updateSlots();
- return true;
- }
- return false;
+ @Override
+ protected void setProcessingLogicPower(ProcessingLogic logic) {
+ long amperage = getMaxInputAmps();
+ long voltage = getAverageInputVoltage();
+ // We allow one OC, if there is enough amperage, no matter which type of hatch is used
+ logic.setAvailableVoltage(amperage >= 4 ? voltage * 4 : voltage);
+ logic.setAvailableAmperage(amperage >= 4 ? amperage / 4 : amperage);
}
private void updateChunkCoordinates() {
@@ -520,21 +479,6 @@ public class GT_TileEntity_ElectricImplosionCompressor
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 6, 0, elementBudget, env, false, true);
}
- public boolean onWireCutterRightClick(ForgeDirection side, byte aWrenchingSide, EntityPlayer aPlayer, float aX,
- float aY, float aZ) {
- if (aPlayer.isSneaking()) {
- batchMode = !batchMode;
- if (batchMode) {
- GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn"));
- } else {
- GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff"));
- }
- return true;
- }
-
- return false;
- }
-
@Override
public boolean supportsBatchMode() {
return true;
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
index 3003a1141b..4ef6a5f7d1 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
@@ -14,18 +14,9 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel;
-import static gregtech.api.enums.GT_HatchElement.InputBus;
-import static gregtech.api.enums.GT_HatchElement.InputHatch;
-import static gregtech.api.enums.GT_HatchElement.Maintenance;
-import static gregtech.api.enums.GT_HatchElement.Muffler;
-import static gregtech.api.enums.GT_HatchElement.OutputBus;
-import static gregtech.api.enums.GT_HatchElement.OutputHatch;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
+import static gregtech.api.enums.GT_HatchElement.*;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW;
@@ -36,10 +27,8 @@ import static gregtech.api.util.GT_StructureUtility.ofCoil;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -53,38 +42,31 @@ import net.minecraftforge.fluids.FluidStack;
import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.Pair;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.Mods;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_OverclockCalculator;
+import gregtech.api.util.GT_ParallelHelper;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlockBase<GT_TileEntity_MegaBlastFurnace>
implements ISurvivalConstructable {
@@ -115,18 +97,12 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
(byte) 0,
(byte) 1,
Byte.MAX_VALUE,
- (te, t) -> te.glasTier = t,
- te -> te.glasTier)))
+ (te, t) -> te.glassTier = t,
+ te -> te.glassTier)))
.addElement(
'b',
buildHatchAdder(GT_TileEntity_MegaBlastFurnace.class)
- .atLeast(
- InputHatch,
- OutputHatch,
- InputBus,
- OutputBus,
- Maintenance,
- TTEnabledEnergyHatchElement.INSTANCE)
+ .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy))
.casingIndex(CASING_INDEX).dot(1).buildAndChain(GregTech_API.sBlockCasings1, CASING_INDEX))
.build();
@@ -173,9 +149,8 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
protected final FluidStack[] pollutionFluidStacks = { Materials.CarbonDioxide.getGas(1000),
Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000) };
private int mHeatingCapacity;
- private byte glasTier;
- private int polPtick = ConfigHandler.basePollutionMBFSecond / 20 * ConfigHandler.megaMachinesMax;
- private int mufflerTier = -1;
+ private byte glassTier;
+ private final static int polPtick = ConfigHandler.basePollutionMBFSecond / 20 * ConfigHandler.megaMachinesMax;
public GT_TileEntity_MegaBlastFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -201,7 +176,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
"For each perfect overclock the EBF will reduce recipe time 4 times (instead of 2) (100% efficiency)")
.addInfo("Additionally gives +100K for every tier past MV")
.addPollutionAmount(20 * getPollutionPerTick(null)).addSeparator().beginStructureBlock(15, 20, 15, true)
- .addController("3rd layer center").addCasingInfo("Heat Proof Machine Casing", 0)
+ .addController("3rd layer center").addCasingInfoRange("Heat Proof Machine Casing", 0, 279, false)
.addOtherStructurePart("864x Heating Coils", "Inner 13x18x13 (Hollow)")
.addOtherStructurePart("1007x Borosilicate Glass", "Outer 15x18x15")
.addStructureInfo("The glass tier limits the Energy Input tier")
@@ -219,8 +194,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- this.circuitMode = aNBT.getByte("circuitMode");
- this.glasTier = aNBT.getByte("glasTier");
+ this.glassTier = aNBT.getByte("glasTier");
if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) {
inputSeparation = aNBT.getBoolean("isBussesSeparate");
}
@@ -229,23 +203,6 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
}
}
- private byte circuitMode = 0;
-
- @Override
- public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (aPlayer.isSneaking()) {
- --circuitMode;
- if (circuitMode < 0) circuitMode = 24;
- } else {
- ++circuitMode;
- if (circuitMode > 24) circuitMode = 0;
- }
-
- GT_Utility.sendChatToPlayer(
- aPlayer,
- circuitMode > 0 ? "MEBF will prioritise circuit: " + circuitMode : "Circuit prioritisation disabled.");
- }
-
@Override
public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer,
float aX, float aY, float aZ) {
@@ -285,13 +242,12 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- aNBT.setByte("glasTier", glasTier);
- aNBT.setByte("circuitMode", circuitMode);
+ aNBT.setByte("glasTier", glassTier);
}
@Override
public int getPollutionPerTick(ItemStack aStack) {
- return this.polPtick;
+ return polPtick;
}
public boolean addOutputHatchToTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
@@ -305,13 +261,6 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
return false;
}
- protected boolean addBottomHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- return addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex)
- || addInputToMachineList(aTileEntity, aBaseCasingIndex)
- || addOutputToMachineList(aTileEntity, aBaseCasingIndex)
- || addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex);
- }
-
@Override
protected String[] getExtendedInfoData() {
return new String[] { StatCollector.translateToLocal("GT5U.EBF.heat") + ": "
@@ -322,118 +271,24 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
}
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- ItemStack[] tInputs = null;
- FluidStack[] tFluids = this.getStoredFluids().toArray(new FluidStack[0]);
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
-
- byte tTier = (byte) Math.max(1, Math.min(GT_Utility.getTier(nominalV), V.length - 1));
- GT_Recipe tRecipe = null;
-
- if (inputSeparation) {
- for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
- ArrayList<ItemStack> tInputList = new ArrayList<>();
- tBus.mRecipeMap = getRecipeMap();
-
- if (isValidMetaTileEntity(tBus)) {
- for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
- if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) {
- tInputList.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
- }
- }
- }
- tInputs = Arrays
- .copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size());
- tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(
- this.getBaseMetaTileEntity(),
- false,
- gregtech.api.enums.GT_Values.V[tTier],
- tFluids,
- tInputs);
- if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(false, tFluids, tInputs))) {
- break;
- }
- }
- } else {
- tInputs = this.getStoredInputs().toArray(new ItemStack[0]);
- if (circuitMode > 0 && Arrays.stream(tInputs)
- .anyMatch(e -> GT_Utility.areStacksEqual(e, GT_Utility.getIntegratedCircuit(circuitMode), true))) {
- List<ItemStack> modInputs = Arrays.stream(tInputs).filter(Objects::nonNull)
- .filter(e -> !e.getItem().equals(GT_Utility.getIntegratedCircuit(circuitMode).getItem()))
- .collect(Collectors.toList());
- modInputs.add(GT_Utility.getIntegratedCircuit(circuitMode));
- tInputs = modInputs.toArray(new ItemStack[0]);
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic() {
+
+ @Nonnull
+ @Override
+ protected GT_OverclockCalculator createOverclockCalculator(@Nonnull GT_Recipe recipe,
+ @Nonnull GT_ParallelHelper helper) {
+ return new GT_OverclockCalculator().setRecipeEUt(recipe.mEUt).setDuration(recipe.mDuration)
+ .setEUt(availableVoltage).setRecipeHeat(recipe.mSpecialValue).setMultiHeat(mHeatingCapacity)
+ .enableHeatOC().enableHeatDiscount().calculate();
}
- tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes
- .findRecipe(this.getBaseMetaTileEntity(), false, V[tTier], tFluids, tInputs);
- if (tRecipe == null) {
- if (circuitMode == 0) return false;
- tInputs = this.getStoredInputs().toArray(new ItemStack[0]);
- tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes
- .findRecipe(this.getBaseMetaTileEntity(), false, V[tTier], tFluids, tInputs);
- }
- }
-
- if (tRecipe == null) return false;
-
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- ArrayList<FluidStack> outputFluids = new ArrayList<>();
-
- boolean found_Recipe = false;
- int processed = 0;
-
- int tHeatCapacityDivTiers = (this.mHeatingCapacity - tRecipe.mSpecialValue) / 900;
- long precutRecipeVoltage = (long) (tRecipe.mEUt * Math.pow(0.95, tHeatCapacityDivTiers));
-
- long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / precutRecipeVoltage);
- if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) {
- tMaxPara *= 128;
- }
- float tBatchMultiplier = 1.0f;
- if (this.mHeatingCapacity >= tRecipe.mSpecialValue) {
- int tCurrentPara = handleParallelRecipe(tRecipe, tFluids, tInputs, (int) tMaxPara);
- tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f;
- this.updateSlots();
- if (tCurrentPara <= 0) return false;
- processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax);
- found_Recipe = true;
- Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> Outputs = getMultiOutput(tRecipe, tCurrentPara);
- outputFluids = Outputs.getKey();
- outputItems = Outputs.getValue();
- }
- if (found_Recipe) {
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt)
- .setParallel(processed).setDuration(tRecipe.mDuration).setEUt(nominalV)
- .setRecipeHeat(tRecipe.mSpecialValue).setMultiHeat(mHeatingCapacity).enableHeatOC()
- .enableHeatDiscount().calculate();
-
- this.mMaxProgresstime = calculator.getDuration();
- this.lEUt = calculator.getConsumption();
-
- // In case recipe is too OP for that machine
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.lEUt == Integer.MAX_VALUE - 1) return false;
-
- if (this.lEUt > 0) this.lEUt = (-this.lEUt);
-
- if (batchMode) {
- this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier);
+ @Override
+ protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) {
+ return recipe.mSpecialValue <= mHeatingCapacity ? CheckRecipeResultRegistry.SUCCESSFUL
+ : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue);
}
-
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
-
- this.polPtick = ConfigHandler.basePollutionMBFSecond / 20 * processed;
- this.mOutputItems = new ItemStack[outputItems.size()];
- this.mOutputItems = outputItems.toArray(this.mOutputItems);
- this.mOutputFluids = new FluidStack[outputFluids.size()];
- this.mOutputFluids = outputFluids.toArray(this.mOutputFluids);
- return true;
- }
- return false;
+ }.setMaxParallel(ConfigHandler.megaMachinesMax);
}
@Override
@@ -455,7 +310,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) {
if (mMachine) return -1;
int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5);
- glasTier = 0;
+ glassTier = 0;
setCoilLevel(HeatingCoilLevel.None);
return survivialBuildPiece("main", stackSize, 7, 17, 0, realBudget, source, actor, false, true);
}
@@ -497,14 +352,8 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
@Override
public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
- if (TecTech.isModLoaded()) {
- this.getTecTechEnergyMultis().clear();
- this.getTecTechEnergyTunnels().clear();
- }
-
this.mHeatingCapacity = 0;
- glasTier = 0;
- mufflerTier = -1;
+ glassTier = 0;
setCoilLevel(HeatingCoilLevel.None);
@@ -516,29 +365,22 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
if (mMaintenanceHatches.size() != 1) return false;
- if (TecTech.isModLoaded() && this.glasTier < 8)
- if (!areLazorsLowPowa() || areThingsNotProperlyTiered(this.getTecTechEnergyTunnels())
- || areThingsNotProperlyTiered(this.getTecTechEnergyMultis()))
- return false;
+ if (glassTier < 8) {
+ for (GT_MetaTileEntity_Hatch hatch : mExoticEnergyHatches) {
+ if (hatch.getConnectionType() == GT_MetaTileEntity_Hatch.ConnectionType.LASER) {
+ return false;
+ }
+ if (glassTier < hatch.mTier) {
+ return false;
+ }
+ }
+ }
- if (this.glasTier < 8 && !this.mEnergyHatches.isEmpty())
- for (GT_MetaTileEntity_Hatch_Energy hatchEnergy : this.mEnergyHatches)
- if (this.glasTier < hatchEnergy.mTier) return false;
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
- this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (BW_Util.getTier(nominalV) - 2);
+ this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (BW_Util.getTier(getMaxInputEu()) - 2);
return true;
}
- @SuppressWarnings("rawtypes")
- @Optional.Method(modid = Mods.Names.TECTECH)
- private boolean areThingsNotProperlyTiered(Collection collection) {
- if (!collection.isEmpty()) for (Object tecTechEnergyMulti : collection)
- if (((GT_MetaTileEntity_TieredMachineBlock) tecTechEnergyMulti).mTier > this.glasTier) return true;
- return false;
- }
-
@Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
return GT_Recipe.GT_Recipe_Map.sBlastRecipes;
@@ -553,4 +395,9 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock
public boolean supportsBatchMode() {
return true;
}
+
+ @Override
+ public boolean supportsVoidProtection() {
+ return true;
+ }
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java
index ddd716d661..52f5d55f23 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java
@@ -14,18 +14,10 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTWORKS;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
-import static gregtech.api.enums.GT_HatchElement.InputBus;
-import static gregtech.api.enums.GT_HatchElement.InputHatch;
-import static gregtech.api.enums.GT_HatchElement.Maintenance;
-import static gregtech.api.enums.GT_HatchElement.OutputBus;
-import static gregtech.api.enums.GT_HatchElement.OutputHatch;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
+import static gregtech.api.enums.GT_HatchElement.*;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW;
@@ -33,49 +25,35 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICA
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
-import java.util.ArrayList;
-import java.util.Collection;
-
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;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.Pair;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Mods;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.logic.ProcessingLogic;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public class GT_TileEntity_MegaChemicalReactor
extends GT_TileEntity_MegaMultiBlockBase<GT_TileEntity_MegaChemicalReactor> implements ISurvivalConstructable {
- private byte glasTier;
+ private byte glassTier;
public GT_TileEntity_MegaChemicalReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -126,12 +104,12 @@ public class GT_TileEntity_MegaChemicalReactor
@Override
public boolean supportsSingleRecipeLocking() {
- return false;
- } // TO IMPLEMENT
+ return true;
+ }
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes;
}
@Override
@@ -158,74 +136,8 @@ public class GT_TileEntity_MegaChemicalReactor
}
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- ItemStack[] tInputs = this.getStoredInputs().toArray(new ItemStack[0]);
- FluidStack[] tInputFluids = this.getStoredFluids().toArray(new FluidStack[0]);
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- ArrayList<FluidStack> outputFluids = new ArrayList<>();
-
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
-
- byte tTier = (byte) Math.max(1, Math.min(GT_Utility.getTier(nominalV), V.length - 1));
-
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes
- .findRecipe(this.getBaseMetaTileEntity(), false, V[tTier], tInputFluids, tInputs);
- boolean found_Recipe = false;
- int processed = 0;
- float tBatchMultiplier = 1.0f;
-
- if (tRecipe != null) {
- found_Recipe = true;
- long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt);
- if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) {
- tMaxPara *= 128;
- }
-
- int tCurrentPara = handleParallelRecipe(tRecipe, tInputFluids, tInputs, (int) tMaxPara);
- tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f;
-
- this.updateSlots();
- if (tCurrentPara <= 0) {
- return false;
- }
- processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax);
- Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> Outputs = getMultiOutput(tRecipe, tCurrentPara);
- outputFluids = Outputs.getKey();
- outputItems = Outputs.getValue();
- }
-
- if (found_Recipe) {
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt)
- .setParallel(processed).setDuration(tRecipe.mDuration).setEUt(nominalV).enablePerfectOC()
- .calculate();
-
- this.mMaxProgresstime = calculator.getDuration();
- this.lEUt = calculator.getConsumption();
-
- // In case recipe is too OP for that machine
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.lEUt == Integer.MAX_VALUE - 1) {
- return false;
- }
-
- if (batchMode) {
- this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier);
- }
-
- if (this.lEUt > 0) {
- this.lEUt = (-this.lEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[outputItems.size()];
- this.mOutputItems = outputItems.toArray(this.mOutputItems);
- this.mOutputFluids = new FluidStack[outputFluids.size()];
- this.mOutputFluids = outputFluids.toArray(this.mOutputFluids);
- return true;
- }
- return false;
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic().enablePerfectOverclock().setMaxParallel(ConfigHandler.megaMachinesMax);
}
@Override
@@ -243,24 +155,22 @@ public class GT_TileEntity_MegaChemicalReactor
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- glasTier = 0;
- if (TecTech.isModLoaded()) {
- this.getTecTechEnergyMultis().clear();
- this.getTecTechEnergyTunnels().clear();
- }
+ glassTier = 0;
if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 2, 0)) return false;
if (mMaintenanceHatches.size() != 1) return false;
- if (TecTech.isModLoaded() && this.glasTier < 8)
- if (!areLazorsLowPowa() || areThingsNotProperlyTiered(this.getTecTechEnergyTunnels())
- || areThingsNotProperlyTiered(this.getTecTechEnergyMultis()))
- return false;
-
- if (this.glasTier < 8 && !this.mEnergyHatches.isEmpty())
- for (GT_MetaTileEntity_Hatch_Energy hatchEnergy : this.mEnergyHatches)
- if (this.glasTier < hatchEnergy.mTier) return false;
+ if (glassTier < 8) {
+ for (GT_MetaTileEntity_Hatch hatch : mExoticEnergyHatches) {
+ if (hatch.getConnectionType() == GT_MetaTileEntity_Hatch.ConnectionType.LASER) {
+ return false;
+ }
+ if (glassTier < hatch.mTier) {
+ return false;
+ }
+ }
+ }
return true;
}
@@ -289,9 +199,8 @@ public class GT_TileEntity_MegaChemicalReactor
.addElement('r', Maintenance.newAny(CASING_INDEX, 2))
.addElement(
'e',
- ofChain(
- TTEnabledEnergyHatchElement.INSTANCE.newAny(CASING_INDEX, 3),
- ofBlock(GregTech_API.sBlockCasings8, 0)))
+ buildHatchAdder(GT_TileEntity_MegaChemicalReactor.class).atLeast(Energy.or(ExoticEnergy))
+ .casingIndex(CASING_INDEX).dot(3).buildAndChain(GregTech_API.sBlockCasings8, 0))
.addElement('c', ofChain(ofBlock(GregTech_API.sBlockCasings4, 7), ofBlock(GregTech_API.sBlockCasings5, 13)))
.addElement(
'g',
@@ -299,8 +208,8 @@ public class GT_TileEntity_MegaChemicalReactor
(byte) 0,
(byte) 1,
Byte.MAX_VALUE,
- (te, t) -> te.glasTier = t,
- te -> te.glasTier))
+ (te, t) -> te.glassTier = t,
+ te -> te.glassTier))
.build();
@Override
@@ -308,16 +217,13 @@ public class GT_TileEntity_MegaChemicalReactor
return STRUCTURE_DEFINITION;
}
- @SuppressWarnings("rawtypes")
- @Optional.Method(modid = Mods.Names.TECTECH)
- private boolean areThingsNotProperlyTiered(Collection collection) {
- if (!collection.isEmpty()) for (Object tecTechEnergyMulti : collection)
- if (((GT_MetaTileEntity_TieredMachineBlock) tecTechEnergyMulti).mTier > this.glasTier) return true;
- return false;
+ @Override
+ public boolean supportsBatchMode() {
+ return true;
}
@Override
- public boolean supportsBatchMode() {
+ public boolean supportsVoidProtection() {
return true;
}
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
index c7f1bc2380..913d706c50 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
@@ -14,18 +14,10 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
-import static gregtech.api.enums.GT_HatchElement.InputBus;
-import static gregtech.api.enums.GT_HatchElement.InputHatch;
-import static gregtech.api.enums.GT_HatchElement.Maintenance;
-import static gregtech.api.enums.GT_HatchElement.OutputBus;
-import static gregtech.api.enums.GT_HatchElement.OutputHatch;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
+import static gregtech.api.enums.GT_HatchElement.*;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW;
@@ -45,35 +37,26 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.Pair;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElementCheckOnly;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Mods;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.fluid.IFluidStore;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlockBase<GT_TileEntity_MegaDistillTower>
implements ISurvivalConstructable {
@@ -151,22 +134,20 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock
.addElement('=', StructureElementAirNoHint.getInstance())
.addElement(
'b',
- buildHatchAdder(GT_TileEntity_MegaDistillTower.class)
- .atLeast(
- InputHatch,
- OutputHatch,
- InputBus,
- OutputBus,
- Maintenance,
- TTEnabledEnergyHatchElement.INSTANCE)
- .casingIndex(CASING_INDEX).dot(1).buildAndChain(
+ buildHatchAdder(GT_TileEntity_MegaDistillTower.class).atLeast(
+ InputHatch,
+ OutputHatch,
+ InputBus,
+ OutputBus,
+ Maintenance,
+ Energy.or(ExoticEnergy)).casingIndex(CASING_INDEX).dot(1).buildAndChain(
onElementPass(
GT_TileEntity_MegaDistillTower::onCasingFound,
ofBlock(GregTech_API.sBlockCasings4, 1))))
.addElement(
'l',
buildHatchAdder(GT_TileEntity_MegaDistillTower.class)
- .atLeast(layeredOutputHatch, Maintenance, TTEnabledEnergyHatchElement.INSTANCE)
+ .atLeast(layeredOutputHatch, Maintenance, Energy.or(ExoticEnergy))
.casingIndex(CASING_INDEX).dot(1).buildAndChain(
onElementPass(
GT_TileEntity_MegaDistillTower::onCasingFound,
@@ -295,10 +276,6 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- if (TecTech.isModLoaded()) {
- this.getTecTechEnergyMultis().clear();
- this.getTecTechEnergyTunnels().clear();
- }
// reset
mOutputHatchesByLayer.forEach(List::clear);
mHeight = 1;
@@ -403,87 +380,8 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock
}
@Override
- public boolean checkRecipe(ItemStack aStack) {
-
- ItemStack[] tItems = getCompactedInputs();
-
- ArrayList<FluidStack> tFluidList = this.getStoredFluids();
-
- for (int i = 0; i < tFluidList.size() - 1; ++i) {
- for (int j = i + 1; j < tFluidList.size(); ++j) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount < tFluidList.get(j).amount) {
- tFluidList.remove(i--);
- break;
- }
- tFluidList.remove(j--);
- }
- }
- }
-
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
- byte tTier = (byte) Math.max(0, Math.min(GT_Utility.getTier(nominalV), V.length - 1));
-
- FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]);
- if (tFluids.length > 0) {
- for (FluidStack tFluid : tFluids) {
- ArrayList<FluidStack> outputFluids = new ArrayList<>();
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> Outputs;
- int processed = 0;
- boolean found_Recipe = false;
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe(
- this.getBaseMetaTileEntity(),
- false,
- GT_Values.V[tTier],
- new FluidStack[] { tFluid },
- tItems);
- float tBatchMultiplier = 1.0f;
- if (tRecipe != null) {
- found_Recipe = true;
- long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt);
- if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) {
- tMaxPara *= 128;
- }
- int tCurrentPara = handleParallelRecipe(tRecipe, new FluidStack[] { tFluid }, null, (int) tMaxPara);
- tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f)
- : 1.0f;
- this.updateSlots();
- processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax);
- Outputs = getMultiOutput(tRecipe, tCurrentPara);
- outputFluids = Outputs.getKey();
- outputItems = Outputs.getValue();
- }
-
- if (!found_Recipe) continue;
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt)
- .setParallel(processed).setDuration(tRecipe.mDuration).setEUt(nominalV).calculate();
-
- this.mMaxProgresstime = calculator.getDuration();
- this.lEUt = calculator.getConsumption();
-
- // In case recipe is too OP for that machine
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.lEUt == Integer.MAX_VALUE - 1) return false;
- if (this.lEUt > 0) {
- this.lEUt = (-this.lEUt);
- }
-
- if (batchMode) {
- this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier);
- }
-
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputFluids = outputFluids.toArray(new FluidStack[0]);
- if (!outputItems.isEmpty()) this.mOutputItems = outputItems.toArray(new ItemStack[0]);
- else this.mOutputItems = null;
- return true;
- }
- }
- return false;
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic().setMaxParallel(ConfigHandler.megaMachinesMax);
}
@Override
@@ -496,7 +394,17 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock
}
@Override
+ public List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput) {
+ return this.getFluidOutputSlotsByLayer(toOutput, mOutputHatchesByLayer);
+ }
+
+ @Override
public boolean supportsBatchMode() {
return true;
}
+
+ @Override
+ public boolean supportsVoidProtection() {
+ return true;
+ }
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java
index eb396caae7..8850df1d3b 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java
@@ -1,13 +1,6 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
-import static gregtech.api.enums.GT_HatchElement.Energy;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
-
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -18,35 +11,20 @@ import net.minecraft.world.World;
import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.MegaUtils;
-import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
-import com.github.bartimaeusnek.crossmod.tectech.tileentites.tiered.LowPowerLaser;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
-import com.google.common.collect.ImmutableList;
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
-import cpw.mods.fml.common.Optional;
-import gregtech.api.enums.Mods;
-import gregtech.api.interfaces.IHatchElement;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
+import gregtech.api.logic.ProcessingLogic;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.IGT_HatchAdder;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_MegaMultiBlockBase<T>>
- extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements TecTechEnabledMulti {
+ extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> {
protected GT_TileEntity_MegaMultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -56,94 +34,32 @@ public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_M
super(aName);
}
- long lEUt = 0;
- private int energyTier = -1;
-
- public ArrayList<Object> TTTunnels = new ArrayList<>();
- public ArrayList<Object> TTMultiAmp = new ArrayList<>();
-
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- this.lEUt = aNBT.getLong("lEUt");
- }
-
- @Override
- public void clearHatches() {
- super.clearHatches();
- this.energyTier = -1;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setLong("lEUt", lEUt);
- }
-
- @SuppressWarnings("rawtypes")
- @Optional.Method(modid = Mods.Names.TECTECH)
- boolean areLazorsLowPowa() {
- Collection collection = this.getTecTechEnergyTunnels();
- if (!collection.isEmpty()) for (Object tecTechEnergyMulti : collection)
- if (!(tecTechEnergyMulti instanceof LowPowerLaser)) return false;
- return true;
- }
-
- @Override
- @Optional.Method(modid = Mods.Names.TECTECH)
- public List<GT_MetaTileEntity_Hatch_Energy> getVanillaEnergyHatches() {
- return this.mEnergyHatches;
- }
-
- @Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Optional.Method(modid = Mods.Names.TECTECH)
- public List getTecTechEnergyTunnels() {
- return TTTunnels;
- }
-
- @Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Optional.Method(modid = Mods.Names.TECTECH)
- public List getTecTechEnergyMultis() {
- return TTMultiAmp;
- }
-
- @Override
- public boolean drainEnergyInput(long aEU) {
- if (TecTech.isModLoaded()) return TecTechUtils.drainEnergyMEBFTecTech(this, aEU);
- return MegaUtils.drainEnergyMegaVanilla(this, aEU);
- }
-
- @Override
- public long getMaxInputVoltage() {
- if (TecTech.isModLoaded()) return TecTechUtils.getMaxInputVoltage(this);
- return super.getMaxInputVoltage();
+ // Migration code
+ if (aNBT.hasKey("lEUt")) {
+ this.lEUt = aNBT.getLong("lEUt");
+ }
}
- @Deprecated
- @Override
- protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) {
- calculateOverclockedNessMultiInternal((long) aEUt, aDuration, maxInputVoltage, false);
+ protected String[] getExtendedInfoData() {
+ return new String[0];
}
- @Deprecated
- @Override
- protected void calculatePerfectOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) {
- calculateOverclockedNessMultiInternal((long) aEUt, aDuration, maxInputVoltage, true);
+ protected long[] getCurrentInfoData() {
+ long storedEnergy = 0, maxEnergy = 0;
+ for (GT_MetaTileEntity_Hatch hatch : getExoticAndNormalEnergyHatchList()) {
+ if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) {
+ storedEnergy += hatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += hatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+ return new long[] { storedEnergy, maxEnergy };
}
@Override
public String[] getInfoData() {
- return TecTech.isModLoaded() ? this.getInfoDataArray(this) : super.getInfoData();
- }
-
- protected String[] getExtendedInfoData() {
- return new String[0];
- }
-
- @Override
- public String[] getInfoDataArray(GT_MetaTileEntity_MultiBlockBase multiBlockBase) {
int mPollutionReduction = 0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) {
@@ -163,8 +79,7 @@ public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_M
}
}
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
+ long nominalV = getMaxInputEu();
String tName = BW_Util.getTierNameFromVoltage(nominalV);
if (tName.equals("MAX+")) tName = EnumChatFormatting.OBFUSCATED + "MAX+";
@@ -199,7 +114,7 @@ public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_M
+ GT_Utility.formatNumbers(this.getMaxInputVoltage())
+ EnumChatFormatting.RESET
+ " EU/t(*"
- + GT_Utility.formatNumbers(TecTechUtils.getMaxInputAmperage(this))
+ + GT_Utility.formatNumbers(getMaxInputAmps())
+ "A) = "
+ EnumChatFormatting.YELLOW
+ GT_Utility.formatNumbers(nominalV)
@@ -234,141 +149,6 @@ public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_M
return combinedInfo;
}
- /**
- * Calculates the overclock for megas. Will set this.mMaxProgressTime and this.lEUt automatically
- *
- * @deprecated Use GT_OverclockCalculator instead
- *
- * @param aEUt EUt of the recipe
- * @param aDuration Duration of the recipe
- * @param maxInputVoltage Max input voltage of the mega (nominal, so 1A)
- * @param perfectOC Flag if the multi has perfect OC
- * @return Number of performed overclocks
- */
- @Deprecated
- protected byte calculateOverclockedNessMultiInternal(long aEUt, int aDuration, long maxInputVoltage,
- boolean perfectOC) {
- byte mTier = (byte) Math.max(0, BW_Util.getTier(maxInputVoltage)), overclockCount = 0;
- if (mTier == 0) {
- // Long time calculation
- long xMaxProgresstime = ((long) aDuration) << 1;
- if (xMaxProgresstime > Integer.MAX_VALUE - 1) {
- // make impossible if too long
- this.lEUt = Integer.MAX_VALUE - 1;
- this.mMaxProgresstime = Integer.MAX_VALUE - 1;
- } else {
- this.lEUt = aEUt >> 2;
- this.mMaxProgresstime = (int) xMaxProgresstime;
- }
- } else {
- // Long EUt calculation
- long xEUt = aEUt;
- // Isnt too low EUt check?
- long tempEUt = Math.max(xEUt, V[1]);
-
- this.mMaxProgresstime = aDuration;
-
- while (tempEUt <= BW_Util.getTierVoltage(mTier - 1)) {
- tempEUt <<= 2; // this actually controls overclocking
- // xEUt *= 4;//this is effect of everclocking
- this.mMaxProgresstime >>= perfectOC ? 2 : 1; // this is effect of overclocking
- xEUt = this.mMaxProgresstime <= 0 ? xEUt >> 1 : xEUt << 2; // U know, if the time is less than 1 tick
- // make the machine use less power
- overclockCount++;
- }
-
- while (xEUt > maxInputVoltage && xEUt >= aEUt) {
- // downclock one notch until we are good again, we have overshot.
- xEUt >>= 2;
- this.mMaxProgresstime <<= perfectOC ? 2 : 1;
- overclockCount--;
- }
-
- if (xEUt < aEUt) {
- xEUt <<= 2;
- this.mMaxProgresstime >>= perfectOC ? 2 : 1;
- overclockCount++;
- }
-
- this.lEUt = xEUt;
- if (this.lEUt == 0) this.lEUt = 1;
- if (this.mMaxProgresstime <= 0) this.mMaxProgresstime = 1; // set time to 1 tick
- }
- return overclockCount;
- }
-
- /**
- * Calculates the overclock for megas. Will set this.mMaxProgressTime and this.lEUt automatically
- *
- * @deprecated Use GT_OverclockCalculator instead
- *
- * @param aEUt EUt of the recipe
- * @param aDuration Duration of the recipe
- * @param maxInputVoltage Max input voltage of the mega (nominal, so 1A)
- */
- protected void calculateOverclockedNessMulti(long aEUt, int aDuration, long maxInputVoltage) {
- calculateOverclockedNessMultiInternal(aEUt, aDuration, maxInputVoltage, false);
- }
-
- /**
- * Calculates the overclock for megas. Will set this.mMaxProgressTime and this.lEUt automatically
- *
- * @deprecated Use GT_OverclockCalculator instead
- *
- * @param aEUt EUt of the recipe
- * @param aDuration Duration of the recipe
- * @param maxInputVoltage Max input voltage of the mega (nominal, so 1A)
- */
- @Deprecated
- protected void calculatePerfectOverclockedNessMulti(long aEUt, int aDuration, long maxInputVoltage) {
- calculateOverclockedNessMultiInternal(aEUt, aDuration, maxInputVoltage, true);
- }
-
- @Override
- public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (TecTech.isModLoaded()) {
- int tier = TecTechUtils.addEnergyInputToMachineList(this, aTileEntity, aBaseCasingIndex, energyTier);
- if (energyTier == -1) energyTier = tier;
- return tier != -1;
- } else {
- if (aTileEntity == null) {
- return false;
- } else {
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
- if (energyTier == -1) energyTier = ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier;
- if (((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier != energyTier) return false;
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity);
- } else {
- return false;
- }
- }
- }
- }
-
- @Override
- public void stopMachine() {
- this.lEUt = 0L;
- super.stopMachine();
- }
-
- @Override
- public boolean onRunningTick(ItemStack aStack) {
- if (this.lEUt > 0) {
- this.addEnergyOutput(this.lEUt * (long) this.mEfficiency / 10000L);
- return true;
- } else if (this.lEUt < 0
- && !this.drainEnergyInput((-this.lEUt) * 10000L / (long) Math.max(1000, this.mEfficiency))) {
- this.stopMachine();
- return false;
- } else {
- return true;
- }
- }
-
@Override
public boolean isCorrectMachinePart(ItemStack itemStack) {
return true;
@@ -389,33 +169,10 @@ public abstract class GT_TileEntity_MegaMultiBlockBase<T extends GT_TileEntity_M
return 10000;
}
- protected enum TTEnabledEnergyHatchElement implements IHatchElement<GT_TileEntity_MegaMultiBlockBase<?>> {
-
- INSTANCE;
-
- private static final List<? extends Class<? extends IMetaTileEntity>> mteClasses;
-
- static {
- ImmutableList.Builder<Class<? extends IMetaTileEntity>> builder = ImmutableList
- .<Class<? extends IMetaTileEntity>>builder().addAll(Energy.mteClasses());
- if (TecTech.isModLoaded()) builder.add(GT_MetaTileEntity_Hatch_EnergyMulti.class);
- mteClasses = builder.build();
- }
-
- @Override
- public List<? extends Class<? extends IMetaTileEntity>> mteClasses() {
- return mteClasses;
- }
-
- @Override
- public IGT_HatchAdder<? super GT_TileEntity_MegaMultiBlockBase<?>> adder() {
- return GT_TileEntity_MegaMultiBlockBase::addEnergyInputToMachineList;
- }
-
- @Override
- public long count(GT_TileEntity_MegaMultiBlockBase<?> t) {
- return t.mEnergyHatches.size() + t.TTTunnels.size() + t.TTMultiAmp.size();
- }
+ @Override
+ protected void setProcessingLogicPower(ProcessingLogic logic) {
+ logic.setAvailableVoltage(getMaxInputEu());
+ logic.setAvailableAmperage(1);
}
protected static class StructureElementAirNoHint<T> implements IStructureElement<T> {
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaOilCracker.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaOilCracker.java
index d7a6af2b4c..ff07c65acb 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaOilCracker.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaOilCracker.java
@@ -14,16 +14,11 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTWORKS;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel;
-import static gregtech.api.enums.GT_HatchElement.InputHatch;
-import static gregtech.api.enums.GT_HatchElement.Maintenance;
-import static gregtech.api.enums.GT_HatchElement.OutputHatch;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
+import static gregtech.api.enums.GT_HatchElement.*;
+import static gregtech.api.enums.GT_HatchElement.ExoticEnergy;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW;
@@ -33,9 +28,10 @@ import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
import static gregtech.api.util.GT_StructureUtility.ofCoil;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
+import javax.annotation.Nonnull;
+
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@@ -43,35 +39,26 @@ import net.minecraftforge.fluids.FluidStack;
import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.Pair;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
-import gregtech.api.enums.Mods;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.logic.ProcessingLogic;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_OverclockCalculator;
+import gregtech.api.util.GT_ParallelHelper;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBase<GT_TileEntity_MegaOilCracker>
implements ISurvivalConstructable {
@@ -123,9 +110,8 @@ public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBa
.newAny(CASING_INDEX, 3))
.addElement(
'm',
- buildHatchAdder(GT_TileEntity_MegaOilCracker.class)
- .atLeast(TTEnabledEnergyHatchElement.INSTANCE, Maintenance).casingIndex(CASING_INDEX).dot(1)
- .buildAndChain(GregTech_API.sBlockCasings4, 1))
+ buildHatchAdder(GT_TileEntity_MegaOilCracker.class).atLeast(Energy.or(ExoticEnergy), Maintenance)
+ .casingIndex(CASING_INDEX).dot(1).buildAndChain(GregTech_API.sBlockCasings4, 1))
.addElement(
'M',
InputHatch.withAdder(GT_TileEntity_MegaOilCracker::addMiddleInputToMachineList)
@@ -138,10 +124,10 @@ public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBa
(byte) 0,
(byte) 1,
Byte.MAX_VALUE,
- (te, t) -> te.glasTier = t,
- te -> te.glasTier)))
+ (te, t) -> te.glassTier = t,
+ te -> te.glassTier)))
.build();
- private byte glasTier;
+ private byte glassTier;
private HeatingCoilLevel heatLevel;
protected final List<GT_MetaTileEntity_Hatch_Input> mMiddleInputHatches = new ArrayList<>();
protected int mInputOnSide = -1;
@@ -201,73 +187,17 @@ public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBa
}
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- ItemStack[] tInputs = this.getStoredInputs().toArray(new ItemStack[0]);
- FluidStack[] tInputFluids = this.getStoredFluids().toArray(new FluidStack[0]);
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- ArrayList<FluidStack> outputFluids = new ArrayList<>();
-
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
-
- byte tTier = (byte) Math.max(1, Math.min(GT_Utility.getTier(nominalV), V.length - 1));
-
- GT_Recipe tRecipe = getRecipeMap().findRecipe(
- getBaseMetaTileEntity(),
- false,
- gregtech.api.enums.GT_Values.V[tTier],
- tInputFluids,
- mInventory[1]);
-
- boolean found_Recipe = false;
- int processed = 0;
-
- if (tRecipe != null) {
- found_Recipe = true;
- long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt);
- int tCurrentPara = handleParallelRecipe(tRecipe, tInputFluids, tInputs, (int) tMaxPara);
- this.updateSlots();
- if (tCurrentPara <= 0) {
- return false;
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic() {
+
+ @Nonnull
+ @Override
+ protected GT_OverclockCalculator createOverclockCalculator(@Nonnull GT_Recipe recipe,
+ @Nonnull GT_ParallelHelper helper) {
+ return super.createOverclockCalculator(recipe, helper)
+ .setEUtDiscount(Math.max((0.1F * (heatLevel.getTier() + 1.0F)), 0.5F));
}
- processed = tCurrentPara;
- Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> Outputs = getMultiOutput(tRecipe, tCurrentPara);
- outputFluids = Outputs.getKey();
- outputItems = Outputs.getValue();
- }
-
- if (found_Recipe) {
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt)
- .setParallel(processed).setDuration(tRecipe.mDuration).setEUt(nominalV).calculate();
-
- this.mMaxProgresstime = calculator.getDuration();
- this.lEUt = calculator.getConsumption();
-
- // In case recipe is too OP for that machine
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.lEUt == Integer.MAX_VALUE - 1) {
- return false;
- }
-
- if (this.getCoilLevel().getTier() < 5) {
- this.lEUt *= 1 - (0.1D * (this.getCoilLevel().getTier() + 1));
- } else {
- this.lEUt *= 0.5;
- }
-
- if (this.lEUt > 0) {
- this.lEUt = (-this.lEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[outputItems.size()];
- this.mOutputItems = outputItems.toArray(this.mOutputItems);
- this.mOutputFluids = new FluidStack[outputFluids.size()];
- this.mOutputFluids = outputFluids.toArray(this.mOutputFluids);
- return true;
- }
- return false;
+ }.setMaxParallel(ConfigHandler.megaMachinesMax);
}
public HeatingCoilLevel getCoilLevel() {
@@ -293,28 +223,25 @@ public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBa
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- glasTier = 0;
+ glassTier = 0;
mInputOnSide = -1;
mOutputOnSide = -1;
mMiddleInputHatches.clear();
- if (TecTech.isModLoaded()) {
- this.getTecTechEnergyMultis().clear();
- this.getTecTechEnergyTunnels().clear();
- }
-
if (!checkPiece(STRUCTURE_PIECE_MAIN, 6, 6, 0)) return false;
if (mMaintenanceHatches.size() != 1) return false;
- if (TecTech.isModLoaded() && this.glasTier < 8)
- if (!areLazorsLowPowa() || areThingsNotProperlyTiered(this.getTecTechEnergyTunnels())
- || areThingsNotProperlyTiered(this.getTecTechEnergyMultis()))
- return false;
-
- if (this.glasTier < 8 && !this.mEnergyHatches.isEmpty())
- for (GT_MetaTileEntity_Hatch_Energy hatchEnergy : this.mEnergyHatches)
- if (this.glasTier < hatchEnergy.mTier) return false;
+ if (glassTier < 8) {
+ for (GT_MetaTileEntity_Hatch hatch : mExoticEnergyHatches) {
+ if (hatch.getConnectionType() == GT_MetaTileEntity_Hatch.ConnectionType.LASER) {
+ return false;
+ }
+ if (glassTier < hatch.mTier) {
+ return false;
+ }
+ }
+ }
return true;
}
@@ -428,11 +355,13 @@ public class GT_TileEntity_MegaOilCracker extends GT_TileEntity_MegaMultiBlockBa
return STRUCTURE_DEFINITION;
}
- @SuppressWarnings("rawtypes")
- @Optional.Method(modid = Mods.Names.TECTECH)
- private boolean areThingsNotProperlyTiered(Collection collection) {
- if (!collection.isEmpty()) for (Object tecTechEnergyMulti : collection)
- if (((GT_MetaTileEntity_TieredMachineBlock) tecTechEnergyMulti).mTier > this.glasTier) return true;
- return false;
+ @Override
+ public boolean supportsBatchMode() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsVoidProtection() {
+ return true;
}
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java
index daf87fd707..40d42f6598 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java
@@ -14,18 +14,11 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTWORKS;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput;
-import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
-import static gregtech.api.enums.GT_HatchElement.InputBus;
-import static gregtech.api.enums.GT_HatchElement.InputHatch;
-import static gregtech.api.enums.GT_HatchElement.Maintenance;
-import static gregtech.api.enums.GT_HatchElement.OutputBus;
-import static gregtech.api.enums.GT_HatchElement.OutputHatch;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.TecTech;
+import static gregtech.api.enums.GT_HatchElement.*;
+import static gregtech.api.enums.GT_HatchElement.ExoticEnergy;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW;
@@ -33,41 +26,29 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZE
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
-import java.util.ArrayList;
-
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;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
-import com.github.bartimaeusnek.bartworks.util.Pair;
-import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Mods;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.logic.ProcessingLogic;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_OverclockCalculator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-@Optional.Interface(
- iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti",
- modid = Mods.Names.TECTECH,
- striprefs = true)
public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBlockBase<GT_TileEntity_MegaVacuumFreezer>
implements ISurvivalConstructable {
@@ -157,13 +138,9 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc
.addElement('=', StructureElementAirNoHint.getInstance())
.addElement(
'c',
- buildHatchAdder(GT_TileEntity_MegaVacuumFreezer.class).atLeast(
- TTEnabledEnergyHatchElement.INSTANCE,
- InputHatch,
- InputBus,
- OutputHatch,
- OutputBus,
- Maintenance).casingIndex(CASING_INDEX).dot(1)
+ buildHatchAdder(GT_TileEntity_MegaVacuumFreezer.class)
+ .atLeast(Energy.or(ExoticEnergy), InputHatch, InputBus, OutputHatch, OutputBus, Maintenance)
+ .casingIndex(CASING_INDEX).dot(1)
.buildAndChain(onElementPass(x -> x.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 1))))
.build();
@@ -225,88 +202,17 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc
}
@Override
- public boolean checkRecipe(ItemStack itemStack) {
- ItemStack[] tInputs = this.getStoredInputs().toArray(new ItemStack[0]);
- FluidStack[] tInputFluids = this.getStoredFluids().toArray(new FluidStack[0]);
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- ArrayList<FluidStack> outputFluids = new ArrayList<>();
-
- long nominalV = TecTech.isModLoaded() ? TecTechUtils.getnominalVoltageTT(this)
- : BW_Util.getnominalVoltage(this);
-
- byte tTier = (byte) Math.max(1, Math.min(GT_Utility.getTier(nominalV), V.length - 1));
-
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes
- .findRecipe(this.getBaseMetaTileEntity(), false, V[tTier], tInputFluids, tInputs);
- boolean found_Recipe = false;
- int processed = 0;
- float tBatchMultiplier = 1.0f;
-
- if (tRecipe != null) {
- found_Recipe = true;
- long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt);
-
- if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) {
- tMaxPara *= 128;
- }
-
- int tCurrentPara = handleParallelRecipe(tRecipe, tInputFluids, tInputs, (int) tMaxPara);
- tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f;
-
- this.updateSlots();
- if (tCurrentPara <= 0) return false;
- processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax);
- Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> Outputs = getMultiOutput(tRecipe, tCurrentPara);
- outputFluids = Outputs.getKey();
- outputItems = Outputs.getValue();
- }
-
- if (found_Recipe) {
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
-
- GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt)
- .setParallel(processed).setDuration(tRecipe.mDuration).setEUt(nominalV).calculate();
-
- this.mMaxProgresstime = calculator.getDuration();
- this.lEUt = calculator.getConsumption();
-
- // In case recipe is too OP for that machine
- if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.lEUt == Integer.MAX_VALUE - 1) return false;
- if (this.lEUt > 0) {
- this.lEUt = (-this.lEUt);
- }
-
- if (batchMode) {
- this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier);
- }
-
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[outputItems.size()];
- this.mOutputItems = outputItems.toArray(this.mOutputItems);
- this.mOutputFluids = new FluidStack[outputFluids.size()];
- this.mOutputFluids = outputFluids.toArray(this.mOutputFluids);
- return true;
- }
- return false;
+ protected ProcessingLogic createProcessingLogic() {
+ return new ProcessingLogic().setMaxParallel(ConfigHandler.megaMachinesMax);
}
// -------------- TEC TECH COMPAT ----------------
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- if (TecTech.isModLoaded()) {
- this.getTecTechEnergyMultis().clear();
- this.getTecTechEnergyTunnels().clear();
- }
this.mCasing = 0;
if (!checkPiece(STRUCTURE_PIECE_MAIN, 7, 7, 0)) return false;
- return this.mMaintenanceHatches.size() == 1
- && (TecTech.isModLoaded()
- ? (!this.getTecTechEnergyMultis().isEmpty() || !this.getTecTechEnergyTunnels().isEmpty()
- || !this.mEnergyHatches.isEmpty())
- : !this.mEnergyHatches.isEmpty())
- && this.mCasing >= 900;
+ return this.mMaintenanceHatches.size() == 1 && this.mCasing >= 900;
}
@Override
@@ -335,4 +241,9 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc
public boolean supportsBatchMode() {
return true;
}
+
+ @Override
+ public boolean supportsVoidProtection() {
+ return true;
+ }
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ResultWrongSievert.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ResultWrongSievert.java
new file mode 100644
index 0000000000..6acd417840
--- /dev/null
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/ResultWrongSievert.java
@@ -0,0 +1,86 @@
+package com.github.bartimaeusnek.bartworks.util;
+
+import net.minecraft.network.PacketBuffer;
+import net.minecraft.util.StatCollector;
+
+import gregtech.api.recipe.check.CheckRecipeResult;
+import gregtech.api.util.GT_Utility;
+
+public class ResultWrongSievert implements CheckRecipeResult {
+
+ public enum NeededSievertType {
+ EXACTLY,
+ MINIMUM
+ }
+
+ private NeededSievertType type;
+ private int required;
+
+ public ResultWrongSievert(int required, NeededSievertType type) {
+ this.required = required;
+ this.type = type;
+ }
+
+ public String getID() {
+ return "wrong_sievert";
+ }
+
+ @Override
+ public boolean wasSuccessful() {
+ return false;
+ }
+
+ @Override
+ public String getDisplayString() {
+ switch (type) {
+ case EXACTLY:
+ return StatCollector.translateToLocalFormatted(
+ "GT5U.gui.text.wrong_sievert_exactly",
+ GT_Utility.formatNumbers(required));
+ case MINIMUM:
+ return StatCollector.translateToLocalFormatted(
+ "GT5U.gui.text.wrong_sievert_min",
+ GT_Utility.formatNumbers(required));
+ }
+ return "";
+ }
+
+ @Override
+ public CheckRecipeResult newInstance() {
+ return new ResultWrongSievert(0, NeededSievertType.EXACTLY);
+ }
+
+ @Override
+ public void encode(PacketBuffer buffer) {
+ buffer.writeVarIntToBuffer(required);
+ buffer.writeVarIntToBuffer(type.ordinal());
+ }
+
+ @Override
+ public void decode(PacketBuffer buffer) {
+ required = buffer.readVarIntFromBuffer();
+ type = NeededSievertType.values()[buffer.readVarIntFromBuffer()];
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ResultWrongSievert that = (ResultWrongSievert) o;
+ return required == that.required;
+ }
+
+ /**
+ * Cannot process recipe because the machine doesn't have the minimum amount of sievert
+ */
+ public static CheckRecipeResult insufficientSievert(int required) {
+ return new ResultWrongSievert(required, NeededSievertType.MINIMUM);
+ }
+
+ /**
+ * Cannot process recipe because the machine doesn't have the exact amount of sievert
+ */
+ public static CheckRecipeResult wrongSievert(int required) {
+ return new ResultWrongSievert(required, NeededSievertType.EXACTLY);
+ }
+}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/TecTechEnabledMulti.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/TecTechEnabledMulti.java
deleted file mode 100644
index f5e07545b1..0000000000
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/TecTechEnabledMulti.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package com.github.bartimaeusnek.crossmod.tectech;
-
-import java.util.List;
-
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
-
-import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.util.GT_Utility;
-
-public interface TecTechEnabledMulti {
-
- List<GT_MetaTileEntity_Hatch_Energy> getVanillaEnergyHatches();
-
- List<GT_MetaTileEntity_Hatch_EnergyTunnel> getTecTechEnergyTunnels();
-
- List<GT_MetaTileEntity_Hatch_EnergyMulti> getTecTechEnergyMultis();
-
- default long[] getCurrentInfoData() {
- long storedEnergy = 0, maxEnergy = 0;
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : this.getTecTechEnergyTunnels()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
- }
-
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : this.getTecTechEnergyMultis()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
- }
- return new long[] { storedEnergy, maxEnergy };
- }
-
- default String[] getInfoDataArray(GT_MetaTileEntity_MultiBlockBase multiBlockBase) {
- int mPollutionReduction = 0;
-
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : multiBlockBase.mMufflerHatches) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
- }
-
- long[] ttHatches = getCurrentInfoData();
- long storedEnergy = ttHatches[0];
- long maxEnergy = ttHatches[1];
-
- for (GT_MetaTileEntity_Hatch_Energy tHatch : multiBlockBase.mEnergyHatches) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
- }
-
- return new String[] {
- StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": "
- + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(multiBlockBase.mProgresstime / 20)
- + EnumChatFormatting.RESET
- + " s / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(multiBlockBase.mMaxProgresstime / 20)
- + EnumChatFormatting.RESET
- + " s",
- StatCollector.translateToLocal("GT5U.multiblock.energy") + ": "
- + EnumChatFormatting.GREEN
- + GT_Utility.formatNumbers(storedEnergy)
- + EnumChatFormatting.RESET
- + " EU / "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(maxEnergy)
- + EnumChatFormatting.RESET
- + " EU",
- StatCollector.translateToLocal("GT5U.multiblock.usage") + ": "
- + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(-multiBlockBase.mEUt)
- + EnumChatFormatting.RESET
- + " EU/t",
- StatCollector.translateToLocal("GT5U.multiblock.mei") + ": "
- + EnumChatFormatting.YELLOW
- + GT_Utility.formatNumbers(multiBlockBase.getMaxInputVoltage())
- + EnumChatFormatting.RESET
- + " EU/t(*2A) "
- + StatCollector.translateToLocal("GT5U.machines.tier")
- + ": "
- + EnumChatFormatting.YELLOW
- + GT_Values.VN[GT_Utility.getTier(multiBlockBase.getMaxInputVoltage())]
- + EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.multiblock.problems") + ": "
- + EnumChatFormatting.RED
- + (multiBlockBase.getIdealStatus() - multiBlockBase.getRepairStatus())
- + EnumChatFormatting.RESET
- + " "
- + StatCollector.translateToLocal("GT5U.multiblock.efficiency")
- + ": "
- + EnumChatFormatting.YELLOW
- + (float) multiBlockBase.mEfficiency / 100.0F
- + EnumChatFormatting.RESET
- + " %",
- StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
- + EnumChatFormatting.GREEN
- + mPollutionReduction
- + EnumChatFormatting.RESET
- + " %",
- BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() };
- }
-}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/IHasCoils.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/IHasCoils.java
deleted file mode 100644
index e61bc68cee..0000000000
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/IHasCoils.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package com.github.bartimaeusnek.crossmod.tectech.helper;
-
-import gregtech.api.enums.HeatingCoilLevel;
-
-public interface IHasCoils {
-
- void setCoilHeat(HeatingCoilLevel coilMeta);
-
- HeatingCoilLevel getCoilHeat();
-}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java
deleted file mode 100644
index 57c58f5d3a..0000000000
--- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/TecTechUtils.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
- * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package com.github.bartimaeusnek.crossmod.tectech.helper;
-
-import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel;
-
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-
-public class TecTechUtils {
-
- @Deprecated
- public static boolean addEnergyInputToMachineList(TecTechEnabledMulti baseTE, IGregTechTileEntity te,
- int aBaseCasingIndex) {
- return addEnergyInputToMachineList(baseTE, te, aBaseCasingIndex, -1) != -1;
- }
-
- public static int addEnergyInputToMachineList(TecTechEnabledMulti baseTE, IGregTechTileEntity te,
- int aBaseCasingIndex, int aTier) {
- if (te == null || !(te.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch)) return -1;
- else {
- GT_MetaTileEntity_Hatch mte = (GT_MetaTileEntity_Hatch) te.getMetaTileEntity();
-
- if (mte.mTier != aTier && aTier != -1) return -1;
-
- if (mte instanceof GT_MetaTileEntity_Hatch_EnergyTunnel)
- if (baseTE.getVanillaEnergyHatches().isEmpty() && baseTE.getTecTechEnergyMultis().isEmpty())
- baseTE.getTecTechEnergyTunnels().add((GT_MetaTileEntity_Hatch_EnergyTunnel) mte);
- else return -1;
- else if (baseTE.getTecTechEnergyTunnels().isEmpty()) {
- if (mte instanceof GT_MetaTileEntity_Hatch_Energy)
- baseTE.getVanillaEnergyHatches().add((GT_MetaTileEntity_Hatch_Energy) mte);
- else if (mte instanceof GT_MetaTileEntity_Hatch_EnergyMulti)
- baseTE.getTecTechEnergyMultis().add((GT_MetaTileEntity_Hatch_EnergyMulti) mte);
- else return -1;
- } else return -1;
-
- mte.updateTexture(aBaseCasingIndex);
- return mte.mTier;
- }
- }
-
- public static boolean drainEnergyMEBFTecTech(TecTechEnabledMulti multi, long aEU) {
- if (aEU <= 0) return true;
-
- long allTheEu = 0;
- int hatches = 0;
- for (GT_MetaTileEntity_Hatch_Energy tHatch : multi.getVanillaEnergyHatches())
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- allTheEu += tHatch.getEUVar();
- hatches++;
- }
-
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : multi.getTecTechEnergyTunnels())
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- allTheEu += tHatch.getEUVar();
- hatches++;
- }
-
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : multi.getTecTechEnergyMultis())
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- allTheEu += tHatch.getEUVar();
- hatches++;
- }
-
- if (allTheEu < aEU) return false;
-
- if (hatches == 0) return false;
-
- long euperhatch = aEU / hatches;
-
- boolean hasDrained = true;
-
- for (GT_MetaTileEntity_Hatch_Energy tHatch : multi.getVanillaEnergyHatches())
- hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
-
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : multi.getTecTechEnergyTunnels())
- hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
-
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : multi.getTecTechEnergyMultis())
- hasDrained &= tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euperhatch, false);
-
- return hasDrained && (multi.getVanillaEnergyHatches().size() > 0 || multi.getTecTechEnergyTunnels().size() > 0
- || multi.getTecTechEnergyMultis().size() > 0);
- }
-
- public static long getnominalVoltageTT(TecTechEnabledMulti base) {
- long rVoltage = 0L;
- long rAmperage = 0L;
-
- for (GT_MetaTileEntity_Hatch_Energy tHatch : base.getVanillaEnergyHatches()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage = Math.max(tHatch.getBaseMetaTileEntity().getInputVoltage(), rVoltage);
- rAmperage += tHatch.getBaseMetaTileEntity().getInputAmperage();
- }
- }
-
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : base.getTecTechEnergyMultis()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage = Math.max(tHatch.getBaseMetaTileEntity().getInputVoltage(), rVoltage);
- rAmperage += tHatch.Amperes;
- }
- }
-
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : base.getTecTechEnergyTunnels()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage = Math.max(getEUPerTickFromLaser(tHatch), rVoltage);
- rAmperage += 1;
- }
- }
-
- return rVoltage * rAmperage;
- }
-
- public static long getMaxInputVoltage(TecTechEnabledMulti base) {
- long rVoltage = 0L;
- for (GT_MetaTileEntity_Hatch_Energy tHatch : base.getVanillaEnergyHatches()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
- }
- }
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : base.getTecTechEnergyMultis()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
- }
- }
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : base.getTecTechEnergyTunnels()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rVoltage += tHatch.maxEUInput();
- }
- }
- return rVoltage;
- }
-
- public static long getMaxInputAmperage(TecTechEnabledMulti base) {
- long rAmperage = 0L;
- for (GT_MetaTileEntity_Hatch_Energy tHatch : base.getVanillaEnergyHatches()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rAmperage += tHatch.getBaseMetaTileEntity().getInputAmperage();
- }
- }
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : base.getTecTechEnergyMultis()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rAmperage += tHatch.getBaseMetaTileEntity().getInputAmperage();
- }
- }
- for (GT_MetaTileEntity_Hatch_EnergyTunnel tHatch : base.getTecTechEnergyTunnels()) {
- if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) {
- rAmperage += tHatch.Amperes;
- }
- }
- return rAmperage;
- }
-
- public static long getEUPerTickFromLaser(GT_MetaTileEntity_Hatch_EnergyTunnel tHatch) {
- return tHatch.Amperes * tHatch.maxEUInput() /* - (tHatch.Amperes / 20) */;
- }
-}