Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Config Option for deterministic Ore Processing #2641

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/gregtech/common/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ public static class RecipeOptions {
"Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).",
"Default: false" })
public boolean harderCircuitRecipes = false;

@Config.Comment({
"Whether to change the byproducts in Ore Processing from a chanced output for a full dust into a guaranteed output for tiny dusts. For example a 33% chance of getting a full dust would change into a 100% chance of getting 3 tiny dusts.",
"Default: false" })
public boolean deterministicOreProcessing = false;
}

public static class CompatibilityOptions {
Expand Down
90 changes: 66 additions & 24 deletions src/main/java/gregtech/integration/jei/basic/OreByProduct.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.client.utils.TooltipHelper;
import gregtech.common.ConfigHolder;
import gregtech.common.metatileentities.MetaTileEntities;

import net.minecraft.client.resources.I18n;
Expand Down Expand Up @@ -169,51 +170,83 @@ public OreByProduct(Material material) {

// macerate ore -> crushed
addToOutputs(material, OrePrefix.crushed, 2 * oreMultiplier);
if (!OreDictUnifier.get(OrePrefix.gem, byproducts[0]).isEmpty()) {
addToOutputs(byproducts[0], OrePrefix.gem, 1);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[0], OrePrefix.dustTiny, 2);
} else {
addToOutputs(byproducts[0], OrePrefix.dust, 1);
if (!OreDictUnifier.get(OrePrefix.gem, byproducts[0]).isEmpty()) {
addToOutputs(byproducts[0], OrePrefix.gem, 1);
} else {
addToOutputs(byproducts[0], OrePrefix.dust, 1);
}
addChance(1400, 850);
}
addChance(1400, 850);

// macerate crushed -> impure
addToOutputs(material, OrePrefix.dustImpure, 1);
addToOutputs(byproducts[0], OrePrefix.dust, byproductMultiplier);
addChance(1400, 850);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[0], OrePrefix.dustTiny, 2 * byproductMultiplier);
} else {
addToOutputs(byproducts[0], OrePrefix.dust, byproductMultiplier);
addChance(1400, 850);
}

// centrifuge impure -> dust
addToOutputs(material, OrePrefix.dust, 1);
addToOutputs(byproducts[0], OrePrefix.dust, 1);
addChance(1111, 0);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[0], OrePrefix.dustTiny, 1);
} else {
addToOutputs(byproducts[0], OrePrefix.dust, 1);
addChance(1111, 0);
}

// ore wash crushed -> crushed purified
addToOutputs(material, OrePrefix.crushedPurified, 1);
addToOutputs(byproducts[0], OrePrefix.dust, 1);
addChance(3333, 0);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[0], OrePrefix.dustTiny, 3);
} else {
addToOutputs(byproducts[0], OrePrefix.dust, 1);
addChance(3333, 0);
}
List<FluidStack> fluidStacks = new ArrayList<>();
fluidStacks.add(Materials.Water.getFluid(1000));
fluidStacks.add(Materials.DistilledWater.getFluid(100));
fluidInputs.add(fluidStacks);

// TC crushed/crushed purified -> centrifuged
addToOutputs(material, OrePrefix.crushedCentrifuged, 1);
addToOutputs(byproducts[1], OrePrefix.dust, byproductMultiplier);
addChance(3333, 0);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[1], OrePrefix.dustTiny, 3 * byproductMultiplier);
} else {
addToOutputs(byproducts[1], OrePrefix.dust, byproductMultiplier);
addChance(3333, 0);
}

// macerate centrifuged -> dust
addToOutputs(material, OrePrefix.dust, 1);
addToOutputs(byproducts[2], OrePrefix.dust, 1);
addChance(1400, 850);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[2], OrePrefix.dustTiny, 2);
} else {
addToOutputs(byproducts[2], OrePrefix.dust, 1);
addChance(1400, 850);
}

// macerate crushed purified -> purified
addToOutputs(material, OrePrefix.dustPure, 1);
addToOutputs(byproducts[1], OrePrefix.dust, 1);
addChance(1400, 850);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[1], OrePrefix.dustTiny, 2);
} else {
addToOutputs(byproducts[1], OrePrefix.dust, 1);
addChance(1400, 850);
}

// centrifuge purified -> dust
addToOutputs(material, OrePrefix.dust, 1);
addToOutputs(byproducts[1], OrePrefix.dust, 1);
addChance(1111, 0);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[1], OrePrefix.dustTiny, 1);
} else {
addToOutputs(byproducts[1], OrePrefix.dust, 1);
addChance(1111, 0);
}

// cauldron/simple washer
addToOutputs(material, OrePrefix.crushed, 1);
Expand All @@ -228,8 +261,12 @@ public OreByProduct(Material material) {
// chem bath
if (hasChemBath) {
addToOutputs(material, OrePrefix.crushedPurified, 1);
addToOutputs(byproducts[3], OrePrefix.dust, byproductMultiplier);
addChance(7000, 580);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(byproducts[3], OrePrefix.dustTiny, 7 * byproductMultiplier);
} else {
addToOutputs(byproducts[3], OrePrefix.dust, byproductMultiplier);
addChance(7000, 580);
}
List<FluidStack> washedFluid = new ArrayList<>();
washedFluid.add(washedIn.getKey().getFluid(washedIn.getValue()));
fluidInputs.add(washedFluid);
Expand All @@ -248,10 +285,15 @@ public OreByProduct(Material material) {
prefix == OrePrefix.nugget ? 2 : 1);

addToOutputs(material, OrePrefix.dust, 1);
addToOutputs(separatedInto.get(0), OrePrefix.dust, 1);
addChance(1000, 250);
addToOutputs(separatedStack2);
addChance(prefix == OrePrefix.dust ? 500 : 2000, prefix == OrePrefix.dust ? 150 : 600);
if (ConfigHolder.recipes.deterministicOreProcessing) {
addToOutputs(separatedInto.get(0), OrePrefix.dustTiny, 1);
addToOutputs(separatedStack2);
} else {
addToOutputs(separatedInto.get(0), OrePrefix.dust, 1);
addChance(1000, 250);
addToOutputs(separatedStack2);
addChance(prefix == OrePrefix.dust ? 500 : 2000, prefix == OrePrefix.dust ? 150 : 600);
}
} else {
addEmptyOutputs(3);
}
Expand Down
Loading
Loading