summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcpw <cpw+github@weeksfamily.ca>2019-02-13 22:13:59 -0500
committercpw <cpw+github@weeksfamily.ca>2019-02-13 22:13:59 -0500
commitf71f34708248aa36cb2947547be6884757fb577e (patch)
tree2d3df8e410a1e2e57d1a2b98ea3a09088cb5b746 /src
parente4bfca53af3d23ffe0c07f090199e5952f9c3ed5 (diff)
Clean up the mod loading context objects. There is only one ThreadLocal now.
**BREAKING CHANGE** FMLModLoadingContext is renamed to FMLJavaModLoadingContext. LanguageProviders can setup additional contextual data. Signed-off-by: cpw <cpw+github@weeksfamily.ca>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/example/examplemod/ExampleMod.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java
index 30056fe..88204a0 100644
--- a/src/main/java/com/example/examplemod/ExampleMod.java
+++ b/src/main/java/com/example/examplemod/ExampleMod.java
@@ -12,7 +12,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
-import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
+import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -27,13 +27,13 @@ public class ExampleMod
public ExampleMod() {
// Register the setup method for modloading
- FMLModLoadingContext.get().getModEventBus().addListener(this::setup);
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the enqueueIMC method for modloading
- FMLModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
// Register the processIMC method for modloading
- FMLModLoadingContext.get().getModEventBus().addListener(this::processIMC);
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
// Register the doClientStuff method for modloading
- FMLModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
// Register ourselves for server, registry and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
@@ -66,18 +66,18 @@ public class ExampleMod
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
- public void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
- // register a new block here
- LOGGER.info("HELLO from Register Block");
+ public static void onServerStarting(FMLServerStartingEvent event) {
+ // do something when the server starts
+ LOGGER.info("HELLO from server starting");
}
- // You can use EventBusSubscriber to automatically subscribe events on the contained class
- @Mod.EventBusSubscriber
- public static class ServerEvents {
+ // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD event bus
+ @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
+ public static class RegistryEvents {
@SubscribeEvent
- public static void onServerStarting(FMLServerStartingEvent event) {
- // do something when the server starts
- LOGGER.info("HELLO from server starting");
+ public void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
+ // register a new block here
+ LOGGER.info("HELLO from Register Block");
}
}
}