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 Chemical Dyes and Recipes #247

Merged
merged 8 commits into from
Nov 20, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class Color {
public static final MarkerMaterial Lime = new MarkerMaterial("lime");
public static final MarkerMaterial Pink = new MarkerMaterial("pink");
public static final MarkerMaterial Gray = new MarkerMaterial("gray");
public static final MarkerMaterial Silver = new MarkerMaterial("silver");
public static final MarkerMaterial LightGray = new MarkerMaterial("light_gray");
public static final MarkerMaterial Cyan = new MarkerMaterial("cyan");
public static final MarkerMaterial Purple = new MarkerMaterial("purple");
public static final MarkerMaterial Blue = new MarkerMaterial("blue");
Expand All @@ -50,7 +50,7 @@ public static class Color {
* Arrays containing all possible color values (without Colorless!)
*/
public static final MarkerMaterial[] VALUES = new MarkerMaterial[]{
White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, Silver, Cyan, Purple, Blue, Brown, Green, Red, Black
White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black
};

/**
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/gregtech/api/unification/material/Materials.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gregtech.api.unification.material;

import gregtech.api.GregTechAPI;
import gregtech.api.unification.material.info.MaterialFlag;
import gregtech.api.unification.material.materials.*;

Expand Down Expand Up @@ -35,6 +34,8 @@ public class Materials {

private static final AtomicBoolean INIT = new AtomicBoolean(false);

public static Material[] CHEMICAL_DYES;

public static void register() {
if (INIT.getAndSet(true)) {
return;
Expand Down Expand Up @@ -96,6 +97,17 @@ public static void register() {
* - FREE RANGE 24000-31999
* - Reserved for CraftTweaker: 32000-32767
*/

CHEMICAL_DYES = new Material[]{
Materials.DyeWhite, Materials.DyeOrange,
Materials.DyeMagenta, Materials.DyeLightBlue,
Materials.DyeYellow, Materials.DyeLime,
Materials.DyePink, Materials.DyeGray,
Materials.DyeLightGray, Materials.DyeCyan,
Materials.DyePurple, Materials.DyeBlue,
Materials.DyeBrown, Materials.DyeGreen,
Materials.DyeRed, Materials.DyeBlack
};
}

public static final List<MaterialFlag> STD_SOLID = new ArrayList<>();
Expand Down Expand Up @@ -618,6 +630,22 @@ public static void register() {
public static Material RubySlurry;
public static Material SapphireSlurry;
public static Material GreenSapphireSlurry;
public static Material DyeBlack;
public static Material DyeRed;
public static Material DyeGreen;
public static Material DyeBrown;
public static Material DyeBlue;
public static Material DyePurple;
public static Material DyeCyan;
public static Material DyeLightGray;
public static Material DyeGray;
public static Material DyePink;
public static Material DyeLime;
public static Material DyeYellow;
public static Material DyeLightBlue;
public static Material DyeMagenta;
public static Material DyeOrange;
public static Material DyeWhite;

/**
* Second Degree Compounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,54 @@ public static void register() {

GreenSapphireSlurry = new Material.Builder(1622, "green_sapphire_slurry")
.fluid().color(0x64c882).build();

// These colors are much nicer looking than those in MC's EnumDyeColor
DyeBlack = new Material.Builder(1623, "dye_black")
.fluid().color(0x202020).build();

DyeRed = new Material.Builder(1624, "dye_red")
.fluid().color(0xFF0000).build();

DyeGreen = new Material.Builder(1625, "dye_green")
.fluid().color(0x00FF00).build();

DyeBrown = new Material.Builder(1626, "dye_brown")
.fluid().color(0x604000).build();

DyeBlue = new Material.Builder(1627, "dye_blue")
.fluid().color(0x0020FF).build();

DyePurple = new Material.Builder(1628, "dye_purple")
.fluid().color(0x800080).build();

DyeCyan = new Material.Builder(1629, "dye_cyan")
.fluid().color(0x00FFFF).build();

DyeLightGray = new Material.Builder(1630, "dye_light_gray")
.fluid().color(0xC0C0C0).build();

DyeGray = new Material.Builder(1631, "dye_gray")
.fluid().color(0x808080).build();

DyePink = new Material.Builder(1632, "dye_pink")
.fluid().color(0xFFC0C0).build();

DyeLime = new Material.Builder(1633, "dye_lime")
.fluid().color(0x80FF80).build();

DyeYellow = new Material.Builder(1634, "dye_yellow")
.fluid().color(0xFFFF00).build();

DyeLightBlue = new Material.Builder(1635, "dye_light_blue")
.fluid().color(0x6080FF).build();

DyeMagenta = new Material.Builder(1636, "dye_magenta")
.fluid().color(0xFF00FF).build();

DyeOrange = new Material.Builder(1637, "dye_orange")
.fluid().color(0xFF8000).build();

DyeWhite = new Material.Builder(1638, "dye_white")
.fluid().color(0xFFFFFF).build();
}
}
1 change: 0 additions & 1 deletion src/main/java/gregtech/api/util/GTUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,6 @@ public static String romanNumeralString(int num) {
return romanNumeralConversions.get(conversion) + romanNumeralString(num - conversion);
}


public static boolean isOre(Block block) {
OrePrefix orePrefix = OreDictUnifier.getPrefix(new ItemStack(block));
return orePrefix != null && orePrefix.name().startsWith("ore");
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/gregtech/common/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ public static class VanillaRecipes {
@Config.Comment("Whether to make miscellaneous recipes harder. Default: false")
public boolean hardMiscRecipes = false;

@Config.Comment("Whether to make coloring blocks like concrete or glass harder. Default: false")
public boolean hardDyeRecipes = false;

@Config.Comment("Whether to make flint and steel recipe require steel parts. Default: true.")
public boolean flintAndSteelRequireSteel = true;

Expand Down Expand Up @@ -268,7 +271,7 @@ public static class EnergyCompatibility {
}

public static class ClientConfig {

@Config.Comment("Terminal root path. Default: (config/)gregtech/terminal")
public String terminalRootPath = "gregtech/terminal";

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/gregtech/common/items/MetaItem1.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,10 @@ public void registerSubItems() {
ELITE_CIRCUIT_BOARD = addItem(406, "circuit_board.elite");
WETWARE_CIRCUIT_BOARD = addItem(407, "circuit_board.wetware");

// Dyes: ID 421-437
DYE_INDIGO = addItem(421, "dye.indigo").addOreDict("dyeBlue");
// Dyes: ID 421-436
for (int i = 0; i < EnumDyeColor.values().length; i++) {
EnumDyeColor dyeColor = EnumDyeColor.values()[i];
DYE_ONLY_ITEMS[i] = addItem(422 + i, "dye." + dyeColor.getName()).addOreDict(getOredictColorName(dyeColor));
DYE_ONLY_ITEMS[i] = addItem(421 + i, "dye." + dyeColor.getName()).addOreDict(getOredictColorName(dyeColor));
}

// Plant/Rubber Related: ID 438-445
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gregtech/common/items/MetaItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ private MetaItems() {

public static MetaItem<?>.MetaValueItem BOTTLE_PURPLE_DRINK;

public static MetaItem<?>.MetaValueItem DYE_INDIGO;
public static MetaItem<?>.MetaValueItem PLANT_BALL;
public static MetaItem<?>.MetaValueItem RUBBER_DROP;
public static MetaItem<?>.MetaValueItem ENERGIUM_DUST;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gregtech/loaders/recipe/CircuitRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ private static void waferRecipes() {
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(1920).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(7680).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16).buildAndRegister();

LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(120).input(SILICON_WAFER).notConsumable(craftingLens, Color.Silver).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(480).input(GLOWSTONE_WAFER).notConsumable(craftingLens, Color.Silver).output(RANDOM_ACCESS_MEMORY_WAFER, 4).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(1920).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Silver).output(RANDOM_ACCESS_MEMORY_WAFER, 8).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(7680).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Silver).output(RANDOM_ACCESS_MEMORY_WAFER, 16).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(120).input(SILICON_WAFER).notConsumable(craftingLens, Color.LightGray).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(480).input(GLOWSTONE_WAFER).notConsumable(craftingLens, Color.LightGray).output(RANDOM_ACCESS_MEMORY_WAFER, 4).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(1920).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.LightGray).output(RANDOM_ACCESS_MEMORY_WAFER, 8).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(7680).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.LightGray).output(RANDOM_ACCESS_MEMORY_WAFER, 16).buildAndRegister();

LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(480).input(GLOWSTONE_WAFER).notConsumable(craftingLens, Color.LightBlue).output(NAND_MEMORY_CHIP_WAFER).buildAndRegister();
LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(1920).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.LightBlue).output(NAND_MEMORY_CHIP_WAFER, 4).buildAndRegister();
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import gregtech.loaders.recipe.chemistry.ChemistryRecipes;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -44,7 +43,6 @@
import static gregtech.api.recipes.RecipeMaps.*;
import static gregtech.api.unification.material.Materials.*;
import static gregtech.api.unification.ore.OrePrefix.*;
import static gregtech.api.util.DyeUtil.getOredictColorName;
import static gregtech.common.items.MetaItems.*;
import static gregtech.common.metatileentities.MetaTileEntities.WORKBENCH;

Expand Down Expand Up @@ -428,11 +426,11 @@ private static void registerAlloyRecipes() {
}

private static void registerAssemblerRecipes() {
for (EnumDyeColor dyeColor : EnumDyeColor.values()) {
for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) {
CANNER_RECIPES.recipeBuilder()
.inputs(MetaItems.SPRAY_EMPTY.getStackForm())
.input(getOredictColorName(dyeColor), 1)
.outputs(MetaItems.SPRAY_CAN_DYES[dyeColor.getMetadata()].getStackForm())
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L * 4))
.outputs(MetaItems.SPRAY_CAN_DYES[i].getStackForm())
.EUt(8).duration(200)
.buildAndRegister();
}
Expand Down Expand Up @@ -857,13 +855,24 @@ private static void registerRecyclingRecipes() {

private static void registerFluidRecipes() {


FLUID_HEATER_RECIPES.recipeBuilder().duration(32).EUt(4)
.fluidInputs(Ice.getFluid(L))
.circuitMeta(1)
.fluidOutputs(Water.getFluid(L)).buildAndRegister();

FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(100).EUt(16).notConsumable(SHAPE_MOLD_BALL).fluidInputs(Toluene.getFluid(100)).output(GELLED_TOLUENE).buildAndRegister();
FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
.fluidInputs(Toluene.getFluid(100))
.notConsumable(SHAPE_MOLD_BALL)
.output(GELLED_TOLUENE)
.duration(100).EUt(16).buildAndRegister();

for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) {
FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L / 2))
.notConsumable(MetaItems.SHAPE_MOLD_BALL.getStackForm())
.outputs(MetaItems.DYE_ONLY_ITEMS[i].getStackForm())
.duration(100).EUt(16).buildAndRegister();
}

FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(32).fluidInputs(Water.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister();
FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(32).fluidInputs(DistilledWater.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import gregtech.api.recipes.ModHandler;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.MarkerMaterial;
import gregtech.api.unification.material.MarkerMaterials;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.ore.OrePrefix;
Expand Down Expand Up @@ -31,6 +33,8 @@ public static void init() {
metalRecipes();
if (ConfigHolder.vanillaRecipes.hardMiscRecipes)
miscRecipes();
if (ConfigHolder.vanillaRecipes.hardDyeRecipes)
dyeRecipes();
toolArmorRecipes();
}

Expand Down Expand Up @@ -162,7 +166,6 @@ private static void woodRecipes() {
/**
* + Adds Glass Handcrafting
* - Removes Sand -> Glass Furnace Smelting
* - Removes Regular Glass Pane Crafting
* - Removes Glass Bottle Crafting
*/
private static void glassRecipes() {
Expand Down Expand Up @@ -704,6 +707,18 @@ private static void miscRecipes() {
ModHandler.removeFurnaceSmelting(new ItemStack(Items.CLAY_BALL, 1, GTValues.W));
}

/**
* - Removes Concrete, Stained Clay, and Stained glass crafting recipes
*/
private static void dyeRecipes() {
for (MarkerMaterial colorMaterial : MarkerMaterials.Color.VALUES) {
ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial)));
ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_hardened_clay", colorMaterial)));
ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial)));
ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_wool", colorMaterial)));
}
}

/**
* + Replaces Vanilla Armor and Tool recipes
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ private static void dyingCleaningRecipes() {
MIXER_RECIPES.recipeBuilder().duration(200).EUt(7)
.inputs(new ItemStack(Blocks.SAND, 4))
.inputs(new ItemStack(Blocks.GRAVEL, 4))
.input(dye, MarkerMaterials.Color.VALUES[i])
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L))
.outputs(new ItemStack(Blocks.CONCRETE_POWDER, 8, i))
.buildAndRegister();

Expand All @@ -514,6 +514,36 @@ private static void dyingCleaningRecipes() {
.outputs(new ItemStack(Blocks.CONCRETE, 1, i))
.buildAndRegister();

CHEMICAL_BATH_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.CONCRETE))
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L / 8))
.outputs(new ItemStack(Blocks.CONCRETE, 1, i))
.buildAndRegister();

CHEMICAL_BATH_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.HARDENED_CLAY))
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L / 8))
.outputs(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, i))
.buildAndRegister();

CHEMICAL_BATH_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.GLASS))
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L / 8))
.outputs(new ItemStack(Blocks.STAINED_GLASS, 1, i))
.buildAndRegister();

CHEMICAL_BATH_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.GLASS_PANE))
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L / 8))
.outputs(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, i))
.buildAndRegister();

CHEMICAL_BATH_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.WOOL))
.fluidInputs(Materials.CHEMICAL_DYES[i].getFluid(GTValues.L))
.outputs(new ItemStack(Blocks.WOOL, 1, i))
.buildAndRegister();

CUTTER_RECIPES.recipeBuilder().duration(20).EUt(7)
.inputs(new ItemStack(Blocks.WOOL, 2, i))
.outputs(new ItemStack(Blocks.CARPET, 3, i))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gregtech.api.recipes.ingredients.IntCircuitIngredient;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.MarkerMaterials;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.common.items.MetaItems;
Expand Down Expand Up @@ -1076,5 +1077,15 @@ public static void init() {
.fluidInputs(Nitrogen.getFluid(1000))
.output(dust, NiobiumNitride, 2)
.duration(200).EUt(480).buildAndRegister();

// Dyes
for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) {
CHEMICAL_RECIPES.recipeBuilder()
.input(dye, MarkerMaterials.Color.VALUES[i])
.input(dust, Salt, 2)
.fluidInputs(SulfuricAcid.getFluid(250))
.fluidOutputs(Materials.CHEMICAL_DYES[i].getFluid(288))
.duration(600).EUt(24).buildAndRegister();
}
}
}
Loading