use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer in project Create by Creators-of-Create.
the class ProcessingRecipeGen method create.
/**
* Create a processing recipe with a single itemstack ingredient, using its id
* as the name of the recipe
*/
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(String namespace, Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
ProcessingRecipeSerializer<T> serializer = getSerializer();
GeneratedRecipe generatedRecipe = c -> {
ItemLike iItemProvider = singleIngredient.get();
transform.apply(new ProcessingRecipeBuilder<>(serializer.getFactory(), new ResourceLocation(namespace, iItemProvider.asItem().getRegistryName().getPath())).withItemIngredients(Ingredient.of(iItemProvider))).build(c);
};
all.add(generatedRecipe);
return generatedRecipe;
}
use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer in project KubeJS-Create by KubeJS-Mods.
the class KubeJSCreatePlugin method addRecipes.
@Override
public void addRecipes(RegisterRecipeHandlersEvent event) {
event.register(new ResourceLocation("create:sequenced_assembly"), SequencedAssemblyRecipeJS::new);
event.registerShaped(new ResourceLocation("create:mechanical_crafting"));
for (var createRecipeType : AllRecipeTypes.values()) {
if (createRecipeType.getSerializer() instanceof ProcessingRecipeSerializer) {
event.register(createRecipeType.getId(), ProcessingRecipeJS::new);
}
}
}
use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer in project Create by Creators-of-Create.
the class SequencedRecipe method readFromBuffer.
public static SequencedRecipe<?> readFromBuffer(FriendlyByteBuf buffer) {
ResourceLocation resourcelocation = buffer.readResourceLocation();
ResourceLocation resourcelocation1 = buffer.readResourceLocation();
RecipeSerializer<?> serializer = ForgeRegistries.RECIPE_SERIALIZERS.getValue(resourcelocation);
if (!(serializer instanceof ProcessingRecipeSerializer))
throw new JsonParseException("Not a supported recipe type");
@SuppressWarnings("rawtypes") ProcessingRecipe recipe = (ProcessingRecipe) serializer.fromNetwork(resourcelocation1, buffer);
return new SequencedRecipe<>(recipe);
}
use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer in project Create by Creators-of-Create.
the class SequencedRecipe method toJson.
public JsonObject toJson() {
@SuppressWarnings("unchecked") ProcessingRecipeSerializer<T> serializer = (ProcessingRecipeSerializer<T>) wrapped.getSerializer();
JsonObject json = new JsonObject();
json.addProperty("type", ForgeRegistries.RECIPE_SERIALIZERS.getKey(serializer).toString());
serializer.write(json, wrapped);
return json;
}
Aggregations