Skip to content

Commit

Permalink
Add Polybenimidazole, refactor circuit recipe code
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Jul 1, 2021
1 parent b247b1b commit b865be1
Show file tree
Hide file tree
Showing 14 changed files with 1,255 additions and 289 deletions.
15 changes: 15 additions & 0 deletions src/main/java/gregtech/api/unification/material/IMaterial.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.collect.ImmutableList;
import gregtech.api.unification.stack.MaterialStack;
import gregtech.api.util.GTControlledRegistry;
import gregtech.api.util.SmallDigits;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -63,6 +64,20 @@ static int getIntValueOfFlag(long value) {
return index;
}

// TODO Fix isotope tooltips being set toSmallDownNumbers
static String calculateChemicalFormula(String unformattedFormula) {
StringBuilder sb = new StringBuilder();
if (unformattedFormula != null && !unformattedFormula.isEmpty()) {
for (char c : unformattedFormula.toCharArray()) {
if (Character.isDigit(c))
sb.append(SmallDigits.toSmallDownNumbers(Character.toString(c)));
else
sb.append(c);
}
}
return sb.toString(); // returns "" if no formula, like other method
}

@Nullable
FluidStack getFluid(int amount);
}
15 changes: 13 additions & 2 deletions src/main/java/gregtech/api/unification/material/Materials.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void register() {
public static FluidMaterial Fluorine = new FluidMaterial(36, "fluorine", 0xFFFFFF, GAS, of(), STATE_GAS, Elements.get("Fluorine")).setFluidTemperature(253);
public static IngotMaterial Francium = new IngotMaterial(37, "francium", 0xAAAAAA, SHINY, 2, of(), 0, Elements.get("Francium"));
public static IngotMaterial Gadolinium = new IngotMaterial(38, "gadolinium", 0xDDDDFF, METALLIC, 2, of(), 0, Elements.get("Gadolinium"), 1585);
public static IngotMaterial Gallium = new IngotMaterial(39, "gallium", 0xDCDCFF, SHINY, 2, of(), GENERATE_PLATE, Elements.get("Gallium"));
public static IngotMaterial Gallium = new IngotMaterial(39, "gallium", 0xDCDCFF, SHINY, 2, of(), GENERATE_PLATE | GENERATE_FOIL, Elements.get("Gallium"));
public static IngotMaterial Germanium = new IngotMaterial(40, "germanium", 0x434343, SHINY, 2, of(), 0, Elements.get("Germanium"));
public static IngotMaterial Gold = new IngotMaterial(41, "gold", 0xFFFF1E, SHINY, 2, of(), EXT2_METAL | GENERATE_ORE | MORTAR_GRINDABLE | EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, Elements.get("Gold"));
public static IngotMaterial Hafnium = new IngotMaterial(42, "hafnium", 0x99999a, SHINY, 2, of(), 0, Elements.get("Hafnium"));
Expand Down Expand Up @@ -138,7 +138,7 @@ public static void register() {
public static IngotMaterial Sodium = new IngotMaterial(101, "sodium", 0x000096, METALLIC, 2, of(), STD_METAL, Elements.get("Sodium"));
public static IngotMaterial Strontium = new IngotMaterial(102, "strontium", 0xC8C8C8, METALLIC, 2, of(), STD_METAL, Elements.get("Strontium"));
public static DustMaterial Sulfur = new DustMaterial(103, "sulfur", 0xC8C800, DULL, 2, of(), NO_SMASHING | NO_SMELTING | FLAMMABLE | GENERATE_ORE, Elements.get("Sulfur"));
public static IngotMaterial Tantalum = new IngotMaterial(104, "tantalum", 0xFFFFFF, METALLIC, 2, of(), STD_METAL, Elements.get("Tantalum"));
public static IngotMaterial Tantalum = new IngotMaterial(104, "tantalum", 0xFFFFFF, METALLIC, 2, of(), STD_METAL | GENERATE_FOIL, Elements.get("Tantalum"));
public static IngotMaterial Technetium = new IngotMaterial(105, "technetium", 0x545455, SHINY, 2, of(), 0, Elements.get("Technetium"));
public static IngotMaterial Tellurium = new IngotMaterial(106, "tellurium", 0xFFFFFF, METALLIC, 2, of(), STD_METAL, Elements.get("Tellurium"));
public static IngotMaterial Tennessine = new IngotMaterial(107, "tennessine" , 0x977fd6, SHINY, 2, of(), 0, Elements.get("Tennessine"));
Expand Down Expand Up @@ -573,6 +573,17 @@ public static void register() {
public static DustMaterial Wheat = new DustMaterial(353, "wheat", 0xFFFFC4, FINE, 0, of(), 0);
public static DustMaterial Meat = new DustMaterial(354, "meat", 12667980, SAND, 1, of(), DISABLE_DECOMPOSITION);

// TODO Put these in good places, PBI Tools
public static final IngotMaterial Polybenzimidazole = new IngotMaterial(356, "polybenzimidazole", 0x2D2D2D, DULL, 0, of(new MaterialStack(Carbon, 20), new MaterialStack(Hydrogen, 12), new MaterialStack(Nitrogen, 4)), EXCLUDE_BLOCK_CRAFTING_RECIPES | SMELT_INTO_FLUID | NO_SMASHING | DISABLE_DECOMPOSITION | GENERATE_FOIL);
public static final SimpleFluidMaterial DiphenylIsophtalate = new SimpleFluidMaterial(122, "diphenyl_isophthalate", 0x246E57, DULL, of(new MaterialStack(Carbon, 20), new MaterialStack(Hydrogen, 14), new MaterialStack(Oxygen, 4)), DISABLE_DECOMPOSITION);
public static final SimpleFluidMaterial PhthalicAcid = new SimpleFluidMaterial(123, "phthalic_acid", 0xD1D1D1, FLUID, of(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 4)), GENERATE_FLUID_BLOCK | DISABLE_DECOMPOSITION);
public static final SimpleFluidMaterial Dimethylbenzene = new SimpleFluidMaterial(124, "dimethylbenzene", 0x669C40, FLUID, of(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 10)), DISABLE_DECOMPOSITION).setFormula("C6H4(CH3)2");
public static final SimpleFluidMaterial Diaminobenzidine = new SimpleFluidMaterial(125, "diaminobenzidine", 0x337D59, DULL, of(new MaterialStack(Carbon, 12), new MaterialStack(Hydrogen, 14), new MaterialStack(Nitrogen, 4)), DISABLE_DECOMPOSITION);
public static final SimpleFluidMaterial Dichlorobenzidine = new SimpleFluidMaterial(126, "dichlorobenzidine", 0xA1DEA6, DULL, of(new MaterialStack(Carbon, 12), new MaterialStack(Hydrogen, 10), new MaterialStack(Chlorine, 2), new MaterialStack(Nitrogen, 2)), DISABLE_DECOMPOSITION);
public static final SimpleFluidMaterial Nitrochlorobenzene = new SimpleFluidMaterial(127, "nitrochlorobenzene", 0x8FB51A, DULL, of(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Chlorine, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 2)), DISABLE_DECOMPOSITION);
public static final SimpleFluidMaterial Chlorobenzene = new SimpleFluidMaterial(128, "chlorobenzene", 0x326A3E, DULL, of(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)), DISABLE_DECOMPOSITION);
public static final SimpleDustMaterial PotassiumDichromate = new SimpleDustMaterial(845, "potassium_dichromate", 0xFF084E, DULL, of(new MaterialStack(Potassium, 2), new MaterialStack(Chrome, 2), new MaterialStack(Oxygen, 7)), GENERATE_SMALL_TINY);
public static final SimpleDustMaterial ChromiumTrioxide = new SimpleDustMaterial(848, "chromium_trioxide", 0xFFE4E1, DULL, of(new MaterialStack(Chrome, 1), new MaterialStack(Oxygen, 3)), GENERATE_SMALL_TINY);


static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private String calculateChemicalFormula() {
}

public T setFormula(String formula) {
this.chemicalFormula = formula;
this.chemicalFormula = IMaterial.calculateChemicalFormula(formula);
return (T)this;
}

Expand Down
12 changes: 7 additions & 5 deletions src/main/java/gregtech/common/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public class ConfigHolder {
@Config.Comment("Chance with which flint and steel will create fire. Default: 50")
public static int flintChanceToCreateFire = 50;

@Config.Comment("Recipes for machine hulls use more materials. Default: false")
@Config.Comment("Recipes for machine hulls use more materials. Default: true")
@Config.RequiresMcRestart
public static boolean harderMachineHulls = false;
public static boolean harderMachineHulls = true;

@Config.Comment("If true, insufficient energy supply will reset recipe progress to zero. If false, progress will decrease to zero with 2x speed. Default: false")
@Config.RequiresWorldRestart
Expand Down Expand Up @@ -185,12 +185,11 @@ public static class UnofficialOptions {

public static class GT5U {

@Config.Comment("Set these to true to enable certain Batteries.")
@Config.Name("Batteries - Enable an extra ZPM and UV Battery (this also makes the Ultimate Battery harder to make)")
@Config.Comment("Enable an extra ZPM and UV Battery (this also makes the Ultimate Battery harder to make). Default: false")
@Config.RequiresMcRestart
public boolean enableZPMandUVBats = false;

@Config.Name("Batteries - Replace the Ultimate Battery with a MAX Battery")
@Config.Comment("Replace the Ultimate Battery with a MAX Battery. Default: false")
@Config.RequiresMcRestart
public boolean replaceUVwithMAXBat = false;

Expand All @@ -210,6 +209,9 @@ public static class GT5U {

@Config.Comment("Change the recipe of rods to result in 1 stick and 2 small piles of dusts. Default: false")
public boolean harderRods = false;

@Config.Comment("Whether or not to use polymers instead of rare metals for Carbon Fibers. REMOVES THE CHANCED OUTPUT! Default: false")
public boolean polymerCarbonFiber = false;
}

public static class GT6 {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/gregtech/common/items/MetaItem1.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ public void registerRecipes() {
.EUt(16)
.buildAndRegister();

RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(4)
.input(OrePrefix.dust, Materials.Tantalum)
.input(OrePrefix.foil, Materials.Manganese)
.fluidInputs(Materials.Polyethylene.getFluid(144))
.outputs(MetaItems.BATTERY_RE_ULV_TANTALUM.getStackForm(8))
.buildAndRegister();

RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder()
.inputs(BATTERY_SU_LV_SULFURIC_ACID.getStackForm())
.outputs(BATTERY_HULL_LV.getStackForm())
Expand Down
Loading

0 comments on commit b865be1

Please sign in to comment.