possibly finally fixed that recipe tag issue

This commit is contained in:
Ellpeck 2020-04-26 19:37:15 +02:00
parent d7b795d58a
commit a21f32a4b3
3 changed files with 29 additions and 4 deletions

View file

@ -82,7 +82,6 @@ public final class NaturesAura {
ModRegistry.init(); ModRegistry.init();
DrainSpotEffects.init(); DrainSpotEffects.init();
DeferredWorkQueue.runLater(ModRecipes::init);
proxy.init(event); proxy.init(event);
} }

View file

@ -12,9 +12,13 @@ import de.ellpeck.naturesaura.chunk.AuraChunkProvider;
import de.ellpeck.naturesaura.commands.CommandAura; import de.ellpeck.naturesaura.commands.CommandAura;
import de.ellpeck.naturesaura.misc.WorldData; import de.ellpeck.naturesaura.misc.WorldData;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IFutureReloadListener;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -28,12 +32,15 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.ChunkWatchEvent; import net.minecraftforge.event.world.ChunkWatchEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
public class CommonEvents { public class CommonEvents {
@ -126,7 +133,12 @@ public class CommonEvents {
} }
@SubscribeEvent @SubscribeEvent
public void onServerAboutToStartEvent(FMLServerStartingEvent event) { public void onServerStarting(FMLServerStartingEvent event) {
CommandAura.register(event.getCommandDispatcher()); CommandAura.register(event.getCommandDispatcher());
} }
@SubscribeEvent
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
event.getServer().getResourceManager().addReloadListener(new ModRecipes());
}
} }

View file

@ -14,6 +14,7 @@ import de.ellpeck.naturesaura.misc.ColoredBlockHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.FlowerBlock; import net.minecraft.block.FlowerBlock;
import net.minecraft.client.resources.ReloadListener;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.SheepEntity; import net.minecraft.entity.passive.SheepEntity;
@ -24,6 +25,8 @@ import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.potion.PotionUtils; import net.minecraft.potion.PotionUtils;
import net.minecraft.potion.Potions; import net.minecraft.potion.Potions;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IResourceManager;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -33,9 +36,9 @@ import net.minecraftforge.registries.ForgeRegistries;
import java.util.Arrays; import java.util.Arrays;
public final class ModRecipes { public class ModRecipes extends ReloadListener<Object> {
public static void init() { private void init() {
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),
@ -391,4 +394,15 @@ public final class ModRecipes {
private static ResourceLocation res(String name) { private static ResourceLocation res(String name) {
return new ResourceLocation(NaturesAura.MOD_ID, name); return new ResourceLocation(NaturesAura.MOD_ID, name);
} }
@Override
protected Object prepare(IResourceManager resourceManagerIn, IProfiler profilerIn) {
return null;
}
@Override
protected void apply(Object splashList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
NaturesAura.LOGGER.info("Loading recipes");
this.init();
}
} }