From 32c62cbc50128f016d0cabc779e95c3760d6410d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 29 Apr 2020 00:11:43 +0200 Subject: [PATCH] fixed recipes not being loaded properly when reloading --- .../naturesaura/compat/crafttweaker/AddAction.java | 3 ++- .../naturesaura/compat/crafttweaker/RemoveAction.java | 3 ++- .../de/ellpeck/naturesaura/proxy/ClientProxy.java | 3 +-- .../de/ellpeck/naturesaura/recipes/ModRecipes.java | 11 +++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AddAction.java b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AddAction.java index c692318f..e916c51d 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AddAction.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/AddAction.java @@ -1,11 +1,12 @@ package de.ellpeck.naturesaura.compat.crafttweaker; import com.blamejared.crafttweaker.api.actions.IAction; +import com.blamejared.crafttweaker.api.actions.IRuntimeAction; import net.minecraft.util.ResourceLocation; import java.util.Map; -public class AddAction implements IAction { +public class AddAction implements IRuntimeAction { private final Map registry; private final ResourceLocation res; diff --git a/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/RemoveAction.java b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/RemoveAction.java index 9ffec172..cf3fb66b 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/RemoveAction.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/crafttweaker/RemoveAction.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.compat.crafttweaker; import com.blamejared.crafttweaker.api.actions.IAction; +import com.blamejared.crafttweaker.api.actions.IRuntimeAction; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.tuple.Pair; @@ -8,7 +9,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -public class RemoveAction implements IAction { +public class RemoveAction implements IRuntimeAction { private final Map registry; private final List recipes; diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index ac653620..53a337a6 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -47,8 +47,7 @@ public class ClientProxy implements IProxy { ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new); IResourceManager manager = Minecraft.getInstance().getResourceManager(); - if (manager instanceof IReloadableResourceManager) - ((IReloadableResourceManager) manager).addReloadListener(new ModRecipes()); + ((IReloadableResourceManager) manager).addReloadListener(new ModRecipes()); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 4ccb8695..562fa954 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -39,6 +39,17 @@ import java.util.Arrays; public class ModRecipes extends ReloadListener { private void init() { + // Clear all registries first + NaturesAuraAPI.TREE_RITUAL_RECIPES.clear(); + NaturesAuraAPI.ALTAR_RECIPES.clear(); + NaturesAuraAPI.OFFERING_RECIPES.clear(); + NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.clear(); + NaturesAuraAPI.FLOWERS.clear(); + NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.clear(); + NaturesAuraAPI.OVERWORLD_ORES.clear(); + NaturesAuraAPI.NETHER_ORES.clear(); + NaturesAuraAPI.PROJECTILE_GENERATIONS.clear(); + new TreeRitualRecipe(res("eye"), ing(new ItemStack(Blocks.OAK_SAPLING)), new ItemStack(ModItems.EYE), 250, ing(Items.SPIDER_EYE),