fixed recipes not being loaded properly when reloading

This commit is contained in:
Ellpeck 2020-04-29 00:11:43 +02:00
parent 79e1997d1d
commit 32c62cbc50
4 changed files with 16 additions and 4 deletions

View file

@ -1,11 +1,12 @@
package de.ellpeck.naturesaura.compat.crafttweaker; package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.actions.IAction; import com.blamejared.crafttweaker.api.actions.IAction;
import com.blamejared.crafttweaker.api.actions.IRuntimeAction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import java.util.Map; import java.util.Map;
public class AddAction<T> implements IAction { public class AddAction<T> implements IRuntimeAction {
private final Map<ResourceLocation, T> registry; private final Map<ResourceLocation, T> registry;
private final ResourceLocation res; private final ResourceLocation res;

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.compat.crafttweaker; package de.ellpeck.naturesaura.compat.crafttweaker;
import com.blamejared.crafttweaker.api.actions.IAction; import com.blamejared.crafttweaker.api.actions.IAction;
import com.blamejared.crafttweaker.api.actions.IRuntimeAction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -8,7 +9,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class RemoveAction implements IAction { public class RemoveAction implements IRuntimeAction {
private final Map<ResourceLocation, ?> registry; private final Map<ResourceLocation, ?> registry;
private final List<ResourceLocation> recipes; private final List<ResourceLocation> recipes;

View file

@ -47,8 +47,7 @@ public class ClientProxy implements IProxy {
ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new); ScreenManager.registerFactory(ModContainers.ENDER_ACCESS, GuiEnderCrate::new);
IResourceManager manager = Minecraft.getInstance().getResourceManager(); IResourceManager manager = Minecraft.getInstance().getResourceManager();
if (manager instanceof IReloadableResourceManager) ((IReloadableResourceManager) manager).addReloadListener(new ModRecipes());
((IReloadableResourceManager) manager).addReloadListener(new ModRecipes());
} }
@Override @Override

View file

@ -39,6 +39,17 @@ import java.util.Arrays;
public class ModRecipes extends ReloadListener<Object> { public class ModRecipes extends ReloadListener<Object> {
private void init() { 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"), new TreeRitualRecipe(res("eye"),
ing(new ItemStack(Blocks.OAK_SAPLING)), new ItemStack(ModItems.EYE), 250, ing(new ItemStack(Blocks.OAK_SAPLING)), new ItemStack(ModItems.EYE), 250,
ing(Items.SPIDER_EYE), ing(Items.SPIDER_EYE),