From 4bfe21d978f6ff91448a68b095f50df3a588b410 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 8 Dec 2018 22:29:18 +0000 Subject: [PATCH] Make the example actually do something Not much, but it at least shows what to expect --- src/main/java/example/Example.java | 10 ------ src/main/java/example/ExampleListener.java | 37 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) delete mode 100644 src/main/java/example/Example.java create mode 100644 src/main/java/example/ExampleListener.java diff --git a/src/main/java/example/Example.java b/src/main/java/example/Example.java deleted file mode 100644 index 9f45405..0000000 --- a/src/main/java/example/Example.java +++ /dev/null @@ -1,10 +0,0 @@ -package example; - -public class Example { - // in this class - // implement Rift listener interfaces such as BlockAdder, ItemAdder - - // see open sourced mods for reference - - // full names of listener classes must be placed in riftmod.json file -} diff --git a/src/main/java/example/ExampleListener.java b/src/main/java/example/ExampleListener.java new file mode 100644 index 0000000..edf0de8 --- /dev/null +++ b/src/main/java/example/ExampleListener.java @@ -0,0 +1,37 @@ +package example; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import org.dimdev.rift.listener.BootstrapListener; +import org.dimdev.rift.listener.MinecraftStartListener; + +import net.minecraft.init.Items; + +/** + * The example mod listener, as defined in the riftmod.json file + * + * As many more as wanted can be made by adding their full names in the riftmod.json file + * + * @author Reisse, Chocohead + */ +public class ExampleListener implements MinecraftStartListener, BootstrapListener { + private static final Logger LOGGER = LogManager.getLogger(); + + @Override + public void onMinecraftStart() { + //Minecraft has started but hasn't registered any blocks or items + //Prime time for loading a config if you need one + LOGGER.info("Minecraft starting"); + } + + //Blocks can be added by implementing BlockAdder, Items from ItemAdder etc. + //See open sourced mods such as HalfLogs for reference + + @Override + public void afterVanillaBootstrap() { + //Minecraft has now finished Bootstrap so all blocks and items are registered + //You probably won't need to listen to this normally. + LOGGER.info("Minecraft loaded: " + Items.CARROT_ON_A_STICK); + } +}