-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split AdornRecipes into recipe type/serializer classes
- Loading branch information
Showing
12 changed files
with
54 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 4 additions & 19 deletions
23
...ava/juuxel/adorn/recipe/AdornRecipes.java → .../adorn/recipe/AdornRecipeSerializers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,22 @@ | ||
package juuxel.adorn.recipe; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import juuxel.adorn.lib.registry.Registered; | ||
import juuxel.adorn.lib.registry.Registrar; | ||
import juuxel.adorn.lib.registry.RegistrarFactory; | ||
import net.minecraft.recipe.Recipe; | ||
import net.minecraft.recipe.RecipeSerializer; | ||
import net.minecraft.recipe.RecipeType; | ||
import net.minecraft.recipe.SpecialRecipeSerializer; | ||
import net.minecraft.registry.RegistryKeys; | ||
|
||
public final class AdornRecipes { | ||
public final class AdornRecipeSerializers { | ||
public static final Registrar<RecipeSerializer<?>> RECIPE_SERIALIZERS = RegistrarFactory.get().create(RegistryKeys.RECIPE_SERIALIZER); | ||
public static final Registrar<RecipeType<?>> RECIPE_TYPES = RegistrarFactory.get().create(RegistryKeys.RECIPE_TYPE); | ||
|
||
public static final Registered<RecipeType<BrewingRecipe>> BREWING_TYPE = registerRecipeType("brewing"); | ||
public static final Registered<RecipeSerializer<ItemBrewingRecipe>> BREWING_SERIALIZER = | ||
public static final Registered<RecipeSerializer<ItemBrewingRecipe>> BREWING = | ||
RECIPE_SERIALIZERS.register("brewing", ItemBrewingRecipe.Serializer::new); | ||
public static final Registered<RecipeSerializer<FluidBrewingRecipe>> BREWING_FROM_FLUID_SERIALIZER = | ||
public static final Registered<RecipeSerializer<FluidBrewingRecipe>> BREWING_FROM_FLUID = | ||
RECIPE_SERIALIZERS.register("brewing_from_fluid", FluidBrewingRecipe.Serializer::new); | ||
|
||
public static final Registered<RecipeSerializer<FertilizerRefillingRecipe>> FERTILIZER_REFILLING_SERIALIZER = | ||
public static final Registered<RecipeSerializer<FertilizerRefillingRecipe>> FERTILIZER_REFILLING = | ||
RECIPE_SERIALIZERS.register("fertilizer_refilling", () -> new SpecialRecipeSerializer<>(FertilizerRefillingRecipe::new)); | ||
|
||
private static <R extends Recipe<?>> Registered<RecipeType<R>> registerRecipeType(String id) { | ||
return RECIPE_TYPES.register(id, () -> new RecipeType<>() { | ||
@Override | ||
public String toString() { | ||
return AdornCommon.NAMESPACE + ':' + id; | ||
} | ||
}); | ||
} | ||
|
||
public static void init() { | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
common/src/main/java/juuxel/adorn/recipe/AdornRecipeTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package juuxel.adorn.recipe; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import juuxel.adorn.lib.registry.Registered; | ||
import juuxel.adorn.lib.registry.Registrar; | ||
import juuxel.adorn.lib.registry.RegistrarFactory; | ||
import net.minecraft.recipe.Recipe; | ||
import net.minecraft.recipe.RecipeType; | ||
import net.minecraft.registry.RegistryKeys; | ||
|
||
public final class AdornRecipeTypes { | ||
public static final Registrar<RecipeType<?>> RECIPE_TYPES = RegistrarFactory.get().create(RegistryKeys.RECIPE_TYPE); | ||
|
||
public static final Registered<RecipeType<BrewingRecipe>> BREWING = registerRecipeType("brewing"); | ||
|
||
private static <R extends Recipe<?>> Registered<RecipeType<R>> registerRecipeType(String id) { | ||
return RECIPE_TYPES.register(id, () -> new RecipeType<>() { | ||
@Override | ||
public String toString() { | ||
return AdornCommon.NAMESPACE + ':' + id; | ||
} | ||
}); | ||
} | ||
|
||
public static void init() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters