aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-13 13:18:18 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-13 13:18:18 +0000
commit44815f49166572398396f3540edcc2ae71df3de0 (patch)
tree4fc2a7e6c1c1502b70329efe633ec95c60ff8371 /src
parentaed9ee9f560200a7139e1f3f80ff087cf80c0be6 (diff)
downloadGT5-Unofficial-44815f49166572398396f3540edcc2ae71df3de0.tar.gz
GT5-Unofficial-44815f49166572398396f3540edcc2ae71df3de0.tar.bz2
GT5-Unofficial-44815f49166572398396f3540edcc2ae71df3de0.zip
Re-add Dehydrator recipe for Fluorite.
Adjust Thermal Centrifuge & Centrifuge recipes for GT++ ores to be inline with GT values. Time is now based on material mass.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java105
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java8
2 files changed, 106 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java
index 82d6de4498..85f239c12e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java
@@ -7,9 +7,14 @@ import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
+import gtPlusPlus.core.material.MaterialStack;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
+import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
@@ -139,7 +144,7 @@ public class RecipeGen_Fluorite extends RecipeGen_Base {
if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{matDust, matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){
Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'");
}
- if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), tinyDustA, dustStone)){
+ if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), material.getCrushedCentrifuged(1), tinyDustA, dustStone)){
Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustA.getDisplayName()+", "+dustStone.getDisplayName()+".");
}
@@ -171,7 +176,7 @@ public class RecipeGen_Fluorite extends RecipeGen_Base {
matDust, tinyDustA,null,
null, null,null,
new int[]{10000, 10000}, //Chances
- 5*20, //Time
+ (int) Math.max(1L, material.getMass() * 8L), //Time
tVoltageMultiplier/2)){ //Eu
Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust");
}
@@ -184,11 +189,105 @@ public class RecipeGen_Fluorite extends RecipeGen_Base {
matDust, tinyDustB,null,
null, null,null,
new int[]{10000, 10000}, //Chances
- 5*20, //Time
+ (int) Math.max(1L, material.getMass() * 8L), //Time
tVoltageMultiplier/2)){ //Eu
Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust");
}
+ AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<Pair<Integer, Material>>();
+ for (MaterialStack r : material.getComposites()){
+ if (r != null){
+ componentMap.put(new Pair<Integer, Material>(r.getPartsPerOneHundred(), r.getStackMaterial()));
+ }
+ }
+
+ //Process Dust
+ if (componentMap.size() > 1 && componentMap.size() <= 9){
+ Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead.");
+
+ ItemStack mInternalOutputs[] = new ItemStack[9];
+ int mChances[] = new int[9];
+ int mCellCount = 0;
+
+ int mTotalCount = 0;
+
+ int mCounter = 0;
+ for (Pair<Integer, Material> f : componentMap){
+ if (f.getValue().getState() != MaterialState.SOLID && f.getValue().getState() != MaterialState.ORE){
+ Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+".");
+ mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey());
+ mCellCount += f.getKey();
+ mTotalCount += f.getKey();
+ Logger.MATERIALS("[Dehydrator] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing.");
+ }
+ else {
+ Logger.MATERIALS("[Dehydrator] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+".");
+ mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey());
+ mTotalCount += f.getKey();
+ }
+ }
+
+ //Build Output Array
+ for (int g=0;g<mInternalOutputs.length;g++){
+ Logger.MATERIALS("[Dehydrator] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0));
+ mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0);
+ }
+
+ ItemStack emptyCell = null;
+ if (mCellCount > 0){
+ emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount);
+ Logger.MATERIALS("[Dehydrator] Recipe now requires "+mCellCount+" empty cells as input.");
+ }
+
+ ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing);
+ if (mainDust != null){
+ Logger.MATERIALS("[Dehydrator] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input.");
+ }
+ else {
+ mainDust = material.getDust(mTotalCount);
+ Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative.");
+ if (mainDust != null){
+ Logger.MATERIALS("[Dehydrator] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input.");
+ }
+ else {
+ Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting.");
+ }
+ }
+
+ for (int j=0;j<mInternalOutputs.length;j++){
+ if (mInternalOutputs[j] == null){
+ mInternalOutputs[j] = GT_Values.NI;
+ Logger.MATERIALS("[Dehydrator] Set slot "+j+" to null.");
+ }
+ else {
+ Logger.MATERIALS("[Dehydrator] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+".");
+ }
+ }
+
+ try{
+
+
+ if (CORE.RA.addDehydratorRecipe(
+ new ItemStack[]{mainDust, emptyCell},
+ null,
+ null,
+ mInternalOutputs,
+ mChances,
+ (int) Math.max(material.getMass() * 8L, 1),
+ tVoltageMultiplier)){
+ Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for "+matDust.getDisplayName());
+ }
+ else {
+ Logger.MATERIALS("[Dehydrator] Failed to generate Dehydrator recipe for "+matDust.getDisplayName());
+ }
+ }
+ catch(Throwable t){
+ t.printStackTrace();
+ }
+
+
+ }
+
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
index b7043b5983..54c99775f0 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
@@ -225,13 +225,13 @@ public class RecipeGen_Ore extends RecipeGen_Base {
try {
//.08 compat
- if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), tinyDustB, dustStone)){
+ if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), material.getCrushedCentrifuged(1), tinyDustB, dustStone)){
Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore' | Input: "+material.getCrushed(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustB.getDisplayName()+", "+dustStone.getDisplayName()+".");
}
}
catch (Throwable t) {}
try {
- if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), tinyDustA, dustStone)){
+ if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), material.getCrushedCentrifuged(1), tinyDustA, dustStone)){
Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustA.getDisplayName()+", "+dustStone.getDisplayName()+".");
}
}
@@ -262,7 +262,7 @@ public class RecipeGen_Ore extends RecipeGen_Base {
matDust, tinyDustA,null,
null, null,null,
new int[]{10000, 10000}, //Chances
- 5*20, //Time
+ (int) Math.max(1L, material.getMass() * 8L), //Time
tVoltageMultiplier/2)){ //Eu
Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust");
}
@@ -275,7 +275,7 @@ public class RecipeGen_Ore extends RecipeGen_Base {
matDust, tinyDustB,null,
null, null,null,
new int[]{10000, 10000}, //Chances
- 5*20, //Time
+ (int) Math.max(1L, material.getMass() * 8L), //Time
tVoltageMultiplier/2)){ //Eu
Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust");
}