diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/myname/mymodid/ClientProxy.java | 43 | ||||
-rw-r--r-- | src/main/java/com/myname/mymodid/CommonProxy.java | 46 | ||||
-rw-r--r-- | src/main/java/com/myname/mymodid/Config.java | 31 | ||||
-rw-r--r-- | src/main/java/com/myname/mymodid/MyMod.java | 77 | ||||
-rw-r--r-- | src/main/java/com/myname/mymodid/Tags.java | 12 | ||||
-rw-r--r-- | src/main/resources/LICENSE | 21 | ||||
-rw-r--r-- | src/main/resources/mcmod.info | 16 |
7 files changed, 246 insertions, 0 deletions
diff --git a/src/main/java/com/myname/mymodid/ClientProxy.java b/src/main/java/com/myname/mymodid/ClientProxy.java new file mode 100644 index 0000000000..5c5252b1ff --- /dev/null +++ b/src/main/java/com/myname/mymodid/ClientProxy.java @@ -0,0 +1,43 @@ +package com.myname.mymodid; + +import cpw.mods.fml.common.event.*; + +public class ClientProxy extends CommonProxy { + + // preInit "Run before anything else. Read your config, create blocks, items, + // etc, and register them with the GameRegistry." + public void preInit(FMLPreInitializationEvent event) { + super.preInit(event); + } + + // load "Do your mod setup. Build whatever data structures you care about. Register recipes." + public void init(FMLInitializationEvent event) { + super.init(event); + } + + // postInit "Handle interaction with other mods, complete your setup based on this." + public void postInit(FMLPostInitializationEvent event) { + super.postInit(event); + } + + public void serverAboutToStart(FMLServerAboutToStartEvent event) { + super.serverAboutToStart(event); + } + + // register server commands in this event handler + public void serverStarting(FMLServerStartingEvent event) { + super.serverStarting(event); + } + + public void serverStarted(FMLServerStartedEvent event) { + super.serverStarted(event); + } + + public void serverStopping(FMLServerStoppingEvent event) { + super.serverStopping(event); + } + + public void serverStopped(FMLServerStoppedEvent event) { + super.serverStopped(event); + } +}
\ No newline at end of file diff --git a/src/main/java/com/myname/mymodid/CommonProxy.java b/src/main/java/com/myname/mymodid/CommonProxy.java new file mode 100644 index 0000000000..bcc59217a5 --- /dev/null +++ b/src/main/java/com/myname/mymodid/CommonProxy.java @@ -0,0 +1,46 @@ +package com.myname.mymodid; + +import cpw.mods.fml.common.event.*; + +public class CommonProxy { + + // preInit "Run before anything else. Read your config, create blocks, items, + // etc, and register them with the GameRegistry." + public void preInit(FMLPreInitializationEvent event) { + Config.syncronizeConfiguration(event.getSuggestedConfigurationFile()); + + MyMod.info(Config.greeting); + MyMod.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION + " and group name " + Tags.GROUPNAME); + } + + // load "Do your mod setup. Build whatever data structures you care about. Register recipes." + public void init(FMLInitializationEvent event) { + + } + + // postInit "Handle interaction with other mods, complete your setup based on this." + public void postInit(FMLPostInitializationEvent event) { + + } + + public void serverAboutToStart(FMLServerAboutToStartEvent event) { + + } + + // register server commands in this event handler + public void serverStarting(FMLServerStartingEvent event) { + + } + + public void serverStarted(FMLServerStartedEvent event) { + + } + + public void serverStopping(FMLServerStoppingEvent event) { + + } + + public void serverStopped(FMLServerStoppedEvent event) { + + } +} diff --git a/src/main/java/com/myname/mymodid/Config.java b/src/main/java/com/myname/mymodid/Config.java new file mode 100644 index 0000000000..09a54f30ef --- /dev/null +++ b/src/main/java/com/myname/mymodid/Config.java @@ -0,0 +1,31 @@ +package com.myname.mymodid; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import java.io.File; + +public class Config { + + private static class Defaults { + public static final String greeting = "Hello World"; + } + + private static class Categories { + public static final String general = "general"; + } + + public static String greeting = Defaults.greeting; + + public static void syncronizeConfiguration(File configFile) { + Configuration configuration = new Configuration(configFile); + configuration.load(); + + Property greetingProperty = configuration.get(Categories.general, "greeting", Defaults.greeting, "How shall I greet?"); + greeting = greetingProperty.getString(); + + if(configuration.hasChanged()) { + configuration.save(); + } + } +}
\ No newline at end of file diff --git a/src/main/java/com/myname/mymodid/MyMod.java b/src/main/java/com/myname/mymodid/MyMod.java new file mode 100644 index 0000000000..9f9618ce8a --- /dev/null +++ b/src/main/java/com/myname/mymodid/MyMod.java @@ -0,0 +1,77 @@ +package com.myname.mymodid; + +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]") +public class MyMod { + + private static Logger LOG = LogManager.getLogger(Tags.MODID); + + @SidedProxy(clientSide= Tags.GROUPNAME + ".ClientProxy", serverSide=Tags.GROUPNAME + ".CommonProxy") + public static CommonProxy proxy; + + @Mod.EventHandler + // preInit "Run before anything else. Read your config, create blocks, items, + // etc, and register them with the GameRegistry." + public void preInit(FMLPreInitializationEvent event) { + proxy.preInit(event); + } + + @Mod.EventHandler + // load "Do your mod setup. Build whatever data structures you care about. Register recipes." + public void init(FMLInitializationEvent event) { + proxy.init(event); + } + + @Mod.EventHandler + // postInit "Handle interaction with other mods, complete your setup based on this." + public void postInit(FMLPostInitializationEvent event) { + proxy.postInit(event); + } + + @Mod.EventHandler + public void serverAboutToStart(FMLServerAboutToStartEvent event) { + proxy.serverAboutToStart(event); + } + + @Mod.EventHandler + // register server commands in this event handler + public void serverStarting(FMLServerStartingEvent event) { + proxy.serverStarting(event); + } + + @Mod.EventHandler + public void serverStarted(FMLServerStartedEvent event) { + proxy.serverStarted(event); + } + + @Mod.EventHandler + public void serverStopping(FMLServerStoppingEvent event) { + proxy.serverStopping(event); + } + + @Mod.EventHandler + public void serverStopped(FMLServerStoppedEvent event) { + proxy.serverStopped(event); + } + + public static void debug(String message) { + LOG.debug(message); + } + + public static void info(String message) { + LOG.info(message); + } + + public static void warn(String message) { + LOG.warn(message); + } + + public static void error(String message) { + LOG.error(message); + } +}
\ No newline at end of file diff --git a/src/main/java/com/myname/mymodid/Tags.java b/src/main/java/com/myname/mymodid/Tags.java new file mode 100644 index 0000000000..568778f647 --- /dev/null +++ b/src/main/java/com/myname/mymodid/Tags.java @@ -0,0 +1,12 @@ +package com.myname.mymodid; + +// Use this class for Strings only. Do not import any classes here. It will lead to issues with Mixins if in use! + +public class Tags { + + // GRADLETOKEN_* will be replaced by your configuration values at build time + public static final String MODID = "GRADLETOKEN_MODID"; + public static final String MODNAME = "GRADLETOKEN_MODNAME"; + public static final String VERSION = "GRADLETOKEN_VERSION"; + public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME"; +}
\ No newline at end of file diff --git a/src/main/resources/LICENSE b/src/main/resources/LICENSE new file mode 100644 index 0000000000..63b4b681cb --- /dev/null +++ b/src/main/resources/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
\ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000000..c2262016e2 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ + { + "modid": "${modId}", + "name": "${modName}", + "description": "An example mod for Minecraft 1.7.10 with Forge focussed on a stable setup.", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", + "url": "https://github.com/SinTh0r4s/MyMod", + "updateUrl": "", + "authorList": ["SinTho0r4s"], + "credits": "", + "logoFile": "", + "screenshots": [], + "dependencies": [] + } +] |