mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Deferred register the RecipeTypes
This commit is contained in:
parent
d376217781
commit
4384c932f9
12 changed files with 31 additions and 29 deletions
|
@ -9,9 +9,11 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public class ActuallyRecipes {
|
public class ActuallyRecipes {
|
||||||
|
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, ActuallyAdditions.MODID);
|
||||||
public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, ActuallyAdditions.MODID);
|
public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static void init(IEventBus bus) {
|
public static void init(IEventBus bus) {
|
||||||
|
RECIPE_TYPES.register(bus);
|
||||||
SERIALIZERS.register(bus);
|
SERIALIZERS.register(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,14 +31,14 @@ public class ActuallyRecipes {
|
||||||
|
|
||||||
|
|
||||||
public static class Types {
|
public static class Types {
|
||||||
public static final RecipeType<LaserRecipe> LASER = RecipeType.register(ActuallyAdditions.MODID + ":laser");
|
public static final RegistryObject<RecipeType<LaserRecipe>> LASER = RECIPE_TYPES.register("laser", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<EmpowererRecipe> EMPOWERING = RecipeType.register(ActuallyAdditions.MODID + ":empower");
|
public static final RegistryObject<RecipeType<EmpowererRecipe>> EMPOWERING = RECIPE_TYPES.register("empower", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<CrushingRecipe> CRUSHING = RecipeType.register(ActuallyAdditions.MODID + ":crushing");
|
public static final RegistryObject<RecipeType<CrushingRecipe>> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<SolidFuelRecipe> SOLID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":solid_fuel");
|
public static final RegistryObject<RecipeType<SolidFuelRecipe>> SOLID_FUEL = RECIPE_TYPES.register("solid_fuel", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<LiquidFuelRecipe> LIQUID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel");
|
public static final RegistryObject<RecipeType<LiquidFuelRecipe>> LIQUID_FUEL = RECIPE_TYPES.register("liquid_fuel", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<PressingRecipe> PRESSING = RecipeType.register(ActuallyAdditions.MODID + ":pressing");
|
public static final RegistryObject<RecipeType<PressingRecipe>> PRESSING = RECIPE_TYPES.register("pressing", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<FermentingRecipe> FERMENTING = RecipeType.register(ActuallyAdditions.MODID + ":fermenting");
|
public static final RegistryObject<RecipeType<FermentingRecipe>> FERMENTING = RECIPE_TYPES.register("fermenting", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<ColorChangeRecipe> COLOR_CHANGE = RecipeType.register(ActuallyAdditions.MODID + ":color_change");
|
public static final RegistryObject<RecipeType<ColorChangeRecipe>> COLOR_CHANGE = RECIPE_TYPES.register("color_change", () -> new RecipeType<>() {});
|
||||||
public static final RecipeType<MiningLensRecipe> MINING_LENS = RecipeType.register(ActuallyAdditions.MODID + ":mining_lens");
|
public static final RegistryObject<RecipeType<MiningLensRecipe>> MINING_LENS = RECIPE_TYPES.register("mining_lens", () -> new RecipeType<>() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.COLOR_CHANGE;
|
return ActuallyRecipes.Types.COLOR_CHANGE.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {
|
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class CrushingRecipe implements Recipe<Container> {
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.CRUSHING;
|
return ActuallyRecipes.Types.CRUSHING.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getOutputOne() {
|
public ItemStack getOutputOne() {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class EmpowererRecipe implements Recipe<Container> {
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.EMPOWERING;
|
return ActuallyRecipes.Types.EMPOWERING.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getInput() {
|
public Ingredient getInput() {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class FermentingRecipe implements Recipe<Container> {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.FERMENTING;
|
return ActuallyRecipes.Types.FERMENTING.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<FermentingRecipe> {
|
public static class Serializer implements RecipeSerializer<FermentingRecipe> {
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.LASER;
|
return ActuallyRecipes.Types.LASER.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<LaserRecipe> getRecipeForStack(ItemStack stack) {
|
public static Optional<LaserRecipe> getRecipeForStack(ItemStack stack) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class LiquidFuelRecipe implements Recipe<Container> {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.LIQUID_FUEL;
|
return ActuallyRecipes.Types.LIQUID_FUEL.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<LiquidFuelRecipe> {
|
public static class Serializer implements RecipeSerializer<LiquidFuelRecipe> {
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.MINING_LENS;
|
return ActuallyRecipes.Types.MINING_LENS.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {
|
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class PressingRecipe implements Recipe<Container> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.PRESSING;
|
return ActuallyRecipes.Types.PRESSING.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<PressingRecipe> {
|
public static class Serializer implements RecipeSerializer<PressingRecipe> {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeType<?> getType() {
|
public RecipeType<?> getType() {
|
||||||
return ActuallyRecipes.Types.SOLID_FUEL;
|
return ActuallyRecipes.Types.SOLID_FUEL.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<SolidFuelRecipe> {
|
public static class Serializer implements RecipeSerializer<SolidFuelRecipe> {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPossibleInput(ItemStack stack) {
|
public static boolean isPossibleInput(ItemStack stack) {
|
||||||
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
|
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get())) {
|
||||||
if (r.getInput().test(stack)) {
|
if (r.getInput().test(stack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||||
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
|
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get())) {
|
||||||
if (r.matches(base, stand1, stand2, stand3, stand4)) {
|
if (r.matches(base, stand1, stand2, stand3, stand4)) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,30 +19,30 @@ public class ResourceReloader implements ResourceManagerReloadListener {
|
||||||
public void onResourceManagerReload(ResourceManager pResourceManager) {
|
public void onResourceManagerReload(ResourceManager pResourceManager) {
|
||||||
RecipeManager recipeManager = data.getRecipeManager();
|
RecipeManager recipeManager = data.getRecipeManager();
|
||||||
ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear();
|
ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING));
|
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
|
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL));
|
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.clear();
|
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LIQUID_FUEL));
|
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LIQUID_FUEL.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
|
ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));
|
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.FERMENTING_RECIPES.clear();
|
ActuallyAdditionsAPI.FERMENTING_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.FERMENTING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.FERMENTING));
|
ActuallyAdditionsAPI.FERMENTING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.FERMENTING.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.clear();
|
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER));
|
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.clear();
|
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.COLOR_CHANGE));
|
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.COLOR_CHANGE.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.MINING_LENS_RECIPES.clear();
|
ActuallyAdditionsAPI.MINING_LENS_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS));
|
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS.get()));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.CRUSHER_RECIPES.clear();
|
ActuallyAdditionsAPI.CRUSHER_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.CRUSHING));
|
ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.CRUSHING.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue