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

Unrevert Crafting Component Refactor (#2652) #2713

Open
wants to merge 2 commits into
base: 1.20.1
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
8 changes: 0 additions & 8 deletions src/main/java/com/gregtechceu/gtceu/api/GTValues.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.gregtechceu.gtceu.api;

import com.gregtechceu.gtceu.data.recipe.CraftingComponent;

import net.minecraft.util.RandomSource;

import java.time.LocalDate;
Expand All @@ -15,12 +13,6 @@
*/
public class GTValues {

/**
* Default fallback value used for Map keys.
* Currently only used in {@link CraftingComponent}.
*/
public static final int FALLBACK = -1;

/**
* <p/>
* This is worth exactly one normal Item.
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTRecipes.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.gregtechceu.gtceu.common.data;

import com.gregtechceu.gtceu.api.addon.AddonFinder;
import com.gregtechceu.gtceu.api.data.chemical.material.properties.BlastProperty;
import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient;
import com.gregtechceu.gtceu.data.recipe.MaterialInfoLoader;
import com.gregtechceu.gtceu.data.recipe.configurable.RecipeAddition;
import com.gregtechceu.gtceu.data.recipe.configurable.RecipeRemoval;
Expand All @@ -14,11 +16,24 @@

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;

import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

public class GTRecipes {

public static final Map<BlastProperty.GasTier, FluidIngredient> EBF_GASES = new EnumMap<>(
BlastProperty.GasTier.class);

static {
EBF_GASES.put(BlastProperty.GasTier.LOW, FluidIngredient.of(GTMaterials.Nitrogen.getFluidTag(), 1000));
EBF_GASES.put(BlastProperty.GasTier.MID, FluidIngredient.of(GTMaterials.Helium.getFluidTag(), 100));
EBF_GASES.put(BlastProperty.GasTier.HIGH, FluidIngredient.of(GTMaterials.Argon.getFluidTag(), 50));
EBF_GASES.put(BlastProperty.GasTier.HIGHER, FluidIngredient.of(GTMaterials.Neon.getFluidTag(), 25));
EBF_GASES.put(BlastProperty.GasTier.HIGHEST, FluidIngredient.of(GTMaterials.Krypton.getFluidTag(), 10));
}

public static final Set<ResourceLocation> RECIPE_FILTERS = new ObjectOpenHashSet<>();

/*
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient;
import com.gregtechceu.gtceu.common.data.*;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.data.recipe.CraftingComponent;
import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper;
import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder;
import com.gregtechceu.gtceu.utils.FormattingUtil;
Expand All @@ -34,6 +33,7 @@
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*;
import static com.gregtechceu.gtceu.common.data.GTMaterials.*;
import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*;
import static com.gregtechceu.gtceu.common.data.GTRecipes.EBF_GASES;

public class MaterialRecipeHandler {

Expand Down Expand Up @@ -194,7 +194,7 @@ private static void processEBFRecipe(Material material, BlastProperty property,
.EUt(EUt);

if (gasTier != null) {
FluidIngredient gas = CraftingComponent.EBF_GASES.get(gasTier).copy();
FluidIngredient gas = EBF_GASES.get(gasTier).copy();

blastBuilder.copy("blast_" + material.getName())
.circuitMeta(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.gregtechceu.gtceu.common.data.machines.GTMachineUtils;
import com.gregtechceu.gtceu.common.data.machines.GTMultiMachines;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.data.recipe.CraftingComponent;
import com.gregtechceu.gtceu.data.recipe.CustomTags;
import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper;

Expand All @@ -29,9 +30,9 @@
import java.util.function.Consumer;

import static com.gregtechceu.gtceu.api.GTValues.*;
import static com.gregtechceu.gtceu.data.recipe.CraftingComponent.*;
import static com.gregtechceu.gtceu.data.recipe.CraftingComponent.HULL;
import static com.gregtechceu.gtceu.data.recipe.CraftingComponent.PUMP;
import static com.gregtechceu.gtceu.data.recipe.GTCraftingComponents.*;
import static com.gregtechceu.gtceu.data.recipe.GTCraftingComponents.HULL;
import static com.gregtechceu.gtceu.data.recipe.GTCraftingComponents.PUMP;

public class MetaTileEntityLoader {

Expand Down Expand Up @@ -392,16 +393,16 @@ public static void init(Consumer<FinishedRecipe> provider) {
"dwx", "hHc", "fsr", 'H', GTMachines.HULL[GTValues.LV].asStack());
VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_configurable",
GTMachines.CONFIGURABLE_MAINTENANCE_HATCH.asStack(), " ", "CMC", "VHV", 'C',
CIRCUIT.getIngredient(HV), 'M', GTMachines.MAINTENANCE_HATCH.asStack(), 'V', CONVEYOR.getIngredient(HV),
CIRCUIT.get(HV), 'M', GTMachines.MAINTENANCE_HATCH.asStack(), 'V', CONVEYOR.get(HV),
'H', GTMachines.HULL[HV].asStack());
VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_automatic",
GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "CMC", 'C', CIRCUIT.getIngredient(HV), 'M',
GTMachines.MAINTENANCE_HATCH.asStack(), 'R', ROBOT_ARM.getIngredient(HV), 'H',
GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "CMC", 'C', CIRCUIT.get(HV), 'M',
GTMachines.MAINTENANCE_HATCH.asStack(), 'R', ROBOT_ARM.get(HV), 'H',
GTMachines.HULL[HV].asStack());
VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_cleaning",
GTMachines.CLEANING_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "WCW", 'C',
CIRCUIT.getIngredient(GTValues.UV), 'M', GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), 'R',
ROBOT_ARM.getIngredient(GTValues.UV), 'H', GTMachines.HULL[GTValues.UV].asStack(), 'W',
CIRCUIT.get(GTValues.UV), 'M', GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), 'R',
ROBOT_ARM.get(GTValues.UV), 'H', GTMachines.HULL[GTValues.UV].asStack(), 'W',
new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate));

// TODO Access Interface
Expand Down Expand Up @@ -909,8 +910,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
int fluidAmount = GTValues.L * 2 * (tier + 1);
GTRecipeTypes.ASSEMBLER_RECIPES
.recipeBuilder("fluid_hatch_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(HULL.getIngredient(tier))
.inputItems(DRUM.getIngredient(tier))
.inputItems(HULL.get(tier))
.inputItems(DRUM.get(tier))
.circuitMeta(1)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand All @@ -928,8 +929,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
int fluidAmount = GTValues.L * 2 * (tier + 1);
GTRecipeTypes.ASSEMBLER_RECIPES
.recipeBuilder("fluid_export_hatch_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(HULL.getIngredient(tier))
.inputItems(DRUM.getIngredient(tier))
.inputItems(HULL.get(tier))
.inputItems(DRUM.get(tier))
.circuitMeta(2)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand All @@ -947,8 +948,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
int fluidAmount = GTValues.L * 2 * (tier + 1);
GTRecipeTypes.ASSEMBLER_RECIPES
.recipeBuilder("item_import_bus_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(HULL.getIngredient(tier))
.inputItems(CRATE.getIngredient(tier))
.inputItems(HULL.get(tier))
.inputItems(CRATE.get(tier))
.circuitMeta(1)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand All @@ -966,8 +967,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
int fluidAmount = GTValues.L * 2 * (tier + 1);
GTRecipeTypes.ASSEMBLER_RECIPES
.recipeBuilder("item_export_bus_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(HULL.getIngredient(tier))
.inputItems(CRATE.getIngredient(tier))
.inputItems(HULL.get(tier))
.inputItems(CRATE.get(tier))
.circuitMeta(2)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand All @@ -987,8 +988,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
.recipeBuilder("dual_import_bus_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(GTMachines.ITEM_IMPORT_BUS[tier])
.inputItems(GTMachines.FLUID_IMPORT_HATCH[tier])
.inputItems(PIPE_NONUPLE.getIngredient(tier))
.inputItems(FRAME.getIngredient(tier), 3)
.inputItems(PIPE_NONUPLE.get(tier))
.inputItems(FRAME.get(tier), 3)
.circuitMeta(1)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand All @@ -1008,8 +1009,8 @@ public static void init(Consumer<FinishedRecipe> provider) {
.recipeBuilder("dual_export_bus_" + VN[tier].toLowerCase() + "_" + fluidMap[j].getName())
.inputItems(GTMachines.ITEM_IMPORT_BUS[tier])
.inputItems(GTMachines.FLUID_IMPORT_HATCH[tier])
.inputItems(PIPE_NONUPLE.getIngredient(tier))
.inputItems(FRAME.getIngredient(tier), 3)
.inputItems(PIPE_NONUPLE.get(tier))
.inputItems(FRAME.get(tier), 3)
.circuitMeta(2)
.inputFluids(fluidMap[j].getFluid(fluidAmount >> j))
.outputItems(machine)
Expand Down Expand Up @@ -1182,7 +1183,7 @@ public static void init(Consumer<FinishedRecipe> provider) {
VanillaRecipeHelper.addShapedRecipe(provider, true, "cleanroom", GTMultiMachines.CLEANROOM.asStack(), "FFF",
"RHR",
"MCM", 'F', GTItems.ITEM_FILTER.asStack(), 'R',
new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel), 'H', HULL.getIngredient(HV), 'M',
new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel), 'H', HULL.get(HV), 'M',
GTItems.ELECTRIC_MOTOR_HV.asStack(), 'C', CustomTags.HV_CIRCUITS);

if (ConfigHolder.INSTANCE.compat.energy.enableFEConverters) {
Expand Down Expand Up @@ -1230,11 +1231,8 @@ public static void registerMachineRecipe(Consumer<FinishedRecipe> provider, Mach

private static Object[] prepareRecipe(int tier, Object... recipe) {
for (int i = 3; i < recipe.length; i++) {
if (recipe[i] instanceof Component) {
Object component = ((Component) recipe[i]).getIngredient(tier);
if (component == null) {
return null;
}
if (recipe[i] instanceof CraftingComponent) {
Object component = ((CraftingComponent) recipe[i]).get(tier);
recipe[i] = component;
} else if (recipe[i] instanceof Item item) {
recipe[i] = new ItemStack(item);
Expand Down
Loading
Loading