-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
…, a base dye item, a pigment corresponding to each EnumColor we have (18 in total), and add balloons, plastic blocks, and glow panels for the two EnumColors that don't have corresponding dyes (aqua, and Dark red). This adds up to a total of 36 new blocks/items. - Improve a bit of class hierarchy to reduce duplicate code between some existing recipe types and our new ones - Refactored how we keep track of blocks/items in Mekanism Additions to require less copy pasted code for definitions by storing them in maps - Move various simple models for Mekanism Additions blocks/items to data generation - Fix glow plastic slabs and transparent plastic slabs having incorrect loot tables for double slabs - Slightly reduce memory impact of colored blocks/items color handlers by properly ensuring that they only create the color handler once for all ones using the same type instead of creating a new one for each block/item - Don't allow recoloring recipes to be made with the same type as the output (no orange plastic + orange dye -> orange plastic) - Made a couple minor breaking changes to the recipe class hierarchy: - Renamed intermediate class ItemStackChemicalToItemStackCachedRecipe to ItemStackConstantChemicalToItemStackCachedRecipe - Made MetallurgicInfuserRecipe extend ItemStackChemicalToItemStackRecipe, the methods in the class are deprecated and bounce to the proper ItemStackChemicalToItemStackRecipe methods, MetallurgicInfuserRecipe is now implementing BiPredicate<ItemStack, InfusionStack> instead of BiPredicate<InfusionStack, ItemStack> - Deprecated ChemicalInfuserRecipeBuilder in favor of a more generified ChemicalChemicalToChemicalRecipeBuilder - Deprecated ItemStackGasToItemStackRecipeBuilder and MetallurgicInfuserRecipeBuilder in favor of a more generified ItemStackChemicalToItemStackRecipeBuilder.
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package mekanism.api.datagen.recipe.builder; | ||
|
||
import com.google.gson.JsonObject; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import mcp.MethodsReturnNonnullByDefault; | ||
import mekanism.api.JsonConstants; | ||
import mekanism.api.annotations.FieldsAreNonnullByDefault; | ||
import mekanism.api.chemical.Chemical; | ||
import mekanism.api.chemical.ChemicalStack; | ||
import mekanism.api.chemical.gas.Gas; | ||
import mekanism.api.chemical.gas.GasStack; | ||
import mekanism.api.chemical.pigment.Pigment; | ||
import mekanism.api.chemical.pigment.PigmentStack; | ||
import mekanism.api.datagen.recipe.MekanismRecipeBuilder; | ||
import mekanism.api.recipes.inputs.chemical.ChemicalIngredientDeserializer; | ||
import mekanism.api.recipes.inputs.chemical.GasStackIngredient; | ||
import mekanism.api.recipes.inputs.chemical.IChemicalStackIngredient; | ||
import mekanism.api.recipes.inputs.chemical.PigmentStackIngredient; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
@FieldsAreNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
public class ChemicalChemicalToChemicalRecipeBuilder<CHEMICAL extends Chemical<CHEMICAL>, STACK extends ChemicalStack<CHEMICAL>, | ||
INGREDIENT extends IChemicalStackIngredient<CHEMICAL, STACK>> extends MekanismRecipeBuilder<ChemicalChemicalToChemicalRecipeBuilder<CHEMICAL, STACK, INGREDIENT>> { | ||
|
||
private final ChemicalIngredientDeserializer<CHEMICAL, STACK, ?> outputSerializer; | ||
private final INGREDIENT leftInput; | ||
private final INGREDIENT rightInput; | ||
private final STACK output; | ||
|
||
protected ChemicalChemicalToChemicalRecipeBuilder(ResourceLocation serializerName, INGREDIENT leftInput, INGREDIENT rightInput, STACK output, | ||
ChemicalIngredientDeserializer<CHEMICAL, STACK, ?> outputSerializer) { | ||
super(serializerName); | ||
this.leftInput = leftInput; | ||
this.rightInput = rightInput; | ||
this.output = output; | ||
this.outputSerializer = outputSerializer; | ||
} | ||
|
||
public static ChemicalChemicalToChemicalRecipeBuilder<Gas, GasStack, GasStackIngredient> chemicalInfusing(GasStackIngredient leftInput, GasStackIngredient rightInput, | ||
GasStack output) { | ||
if (output.isEmpty()) { | ||
throw new IllegalArgumentException("This chemical infusing recipe requires a non empty gas output."); | ||
} | ||
return new ChemicalChemicalToChemicalRecipeBuilder<>(mekSerializer("chemical_infusing"), leftInput, rightInput, output, ChemicalIngredientDeserializer.GAS); | ||
} | ||
|
||
public static ChemicalChemicalToChemicalRecipeBuilder<Pigment, PigmentStack, PigmentStackIngredient> pigmentMixing(PigmentStackIngredient leftInput, | ||
PigmentStackIngredient rightInput, PigmentStack output) { | ||
if (output.isEmpty()) { | ||
throw new IllegalArgumentException("This pigment mixing recipe requires a non empty gas output."); | ||
} | ||
return new ChemicalChemicalToChemicalRecipeBuilder<>(mekSerializer("pigment_mixing"), leftInput, rightInput, output, ChemicalIngredientDeserializer.PIGMENT); | ||
} | ||
|
||
@Override | ||
protected ChemicalChemicalToChemicalRecipeResult getResult(ResourceLocation id) { | ||
return new ChemicalChemicalToChemicalRecipeResult(id); | ||
} | ||
|
||
public class ChemicalChemicalToChemicalRecipeResult extends RecipeResult { | ||
|
||
protected ChemicalChemicalToChemicalRecipeResult(ResourceLocation id) { | ||
super(id); | ||
} | ||
|
||
@Override | ||
public void serializeRecipeData(@Nonnull JsonObject json) { | ||
json.add(JsonConstants.LEFT_INPUT, leftInput.serialize()); | ||
json.add(JsonConstants.RIGHT_INPUT, rightInput.serialize()); | ||
json.add(JsonConstants.OUTPUT, outputSerializer.serializeStack(output)); | ||
} | ||
} | ||
} |