Skip to content

Commit

Permalink
Allow specifying the amount of fluid for chemical bath processing (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALongStringOfNumbers authored Aug 21, 2021
1 parent 98e3bef commit e0d55c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/unification/material/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,12 @@ public Builder washedIn(Material m) {
return this;
}

public Builder washedIn(Material m, int washedAmount) {
properties.ensureSet(PropertyKey.ORE);
properties.getProperty(PropertyKey.ORE).setWashedIn(m, washedAmount);
return this;
}

public Builder separatedInto(Material... m) {
properties.ensureSet(PropertyKey.ORE);
properties.getProperty(PropertyKey.ORE).setSeparatedInto(m);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gregtech.api.unification.material.properties;

import gregtech.api.unification.material.Material;
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nullable;
import java.util.ArrayList;
Expand Down Expand Up @@ -53,6 +54,14 @@ public class OreProperty implements IMaterialProperty<OreProperty> {
@Nullable
private Material washedIn;

/**
* The amount of Material that the ore should be washed in
* in the Chemical Bath.
* <p>
* Default 100 mb
*/
private int washedAmount = 100;

/**
* During Electromagnetic Separation, this Ore will be separated
* into this Material and the Material specified by this field.
Expand Down Expand Up @@ -105,9 +114,14 @@ public void setWashedIn(@Nullable Material m) {
this.washedIn = m;
}

public void setWashedIn(@Nullable Material m, int washedAmount) {
this.washedIn = m;
this.washedAmount = washedAmount;
}

@Nullable
public Material getWashedIn() {
return this.washedIn;
public Pair<Material, Integer> getWashedIn() {
return Pair.of(this.washedIn, this.washedAmount);
}

public void setSeparatedInto(Material... materials) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import gregtech.api.unification.stack.UnificationEntry;
import gregtech.api.util.GTUtility;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.Pair;

import java.util.List;

Expand Down Expand Up @@ -168,9 +169,10 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material,

if (property.getWashedIn() != null) {
Material washingByproduct = GTUtility.selectItemInList(3, material, property.getOreByProducts(), Material.class);
Pair<Material, Integer> washedInTuple = property.getWashedIn();
RecipeMaps.CHEMICAL_BATH_RECIPES.recipeBuilder()
.input(crushedPrefix, material)
.fluidInputs(property.getWashedIn().getFluid(property.getWashedIn() == Materials.SodiumPersulfate ? 100 : 1000))
.fluidInputs(washedInTuple.getKey().getFluid(washedInTuple.getRight()))
.outputs(crushedPurifiedOre)
.chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), 7000, 580)
.chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000, 650)
Expand Down

0 comments on commit e0d55c8

Please sign in to comment.