From 1e7a042b536b8aeb8a3cf4aac93fdcf9eb33672e Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 12 Jul 2017 22:47:26 -0700 Subject: [PATCH] Fix missing item/block event handling --- src/main/java/forestry/Forestry.java | 16 +--------------- .../forestry/core/utils/MigrationHelper.java | 6 ++++++ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/main/java/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index c9ac13fdb..4ce2dafa5 100755 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -15,12 +15,9 @@ import com.google.common.base.Preconditions; import javax.annotation.Nullable; import java.io.File; -import net.minecraft.block.Block; -import net.minecraft.item.Item; - import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fluids.FluidRegistry; + import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -44,7 +41,6 @@ import forestry.core.gui.GuiHandler; import forestry.core.multiblock.MultiblockEventHandler; import forestry.core.network.PacketHandler; import forestry.core.proxy.Proxies; -import forestry.core.utils.MigrationHelper; import forestry.core.worldgen.WorldGenerator; import forestry.plugins.PluginManager; import forestry.plugins.compat.PluginIC2; @@ -151,14 +147,4 @@ public class Forestry { public void processIMCMessages(IMCEvent event) { PluginManager.processIMCMessages(event.getMessages()); } - - @EventHandler - public void onMissingBlockMappings(RegistryEvent.MissingMappings event) { - MigrationHelper.onMissingBlockMappings(event); - } - - @EventHandler - public void onMissingItemMappings(RegistryEvent.MissingMappings event) { - MigrationHelper.onMissingItemMappings(event); - } } diff --git a/src/main/java/forestry/core/utils/MigrationHelper.java b/src/main/java/forestry/core/utils/MigrationHelper.java index 8fcb97680..1e4707444 100755 --- a/src/main/java/forestry/core/utils/MigrationHelper.java +++ b/src/main/java/forestry/core/utils/MigrationHelper.java @@ -13,8 +13,12 @@ import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.ForgeRegistries; +@Mod.EventBusSubscriber public class MigrationHelper { private static Map blockRemappings = new HashMap<>(); private static Map itemRemappings = new HashMap<>(); @@ -51,6 +55,7 @@ public class MigrationHelper { } } + @SubscribeEvent public static void onMissingBlockMappings(RegistryEvent.MissingMappings event) { for (RegistryEvent.MissingMappings.Mapping missingMapping : event.getMappings()) { ResourceLocation resourceLocation = missingMapping.key; @@ -70,6 +75,7 @@ public class MigrationHelper { } } + @SubscribeEvent public static void onMissingItemMappings(RegistryEvent.MissingMappings event) { for (RegistryEvent.MissingMappings.Mapping missingMapping : event.getMappings()) { ResourceLocation resourceLocation = missingMapping.key;