|
- using System.Reflection;
-
- using IllusionPlugin;
- //using GamecraftModdingAPI;
-
- namespace HelloModdingWorld
- {
- public class MyPlugin : IEnhancedPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
- {
- public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // HelloModdingWorld by default
- // To change the name, change the project's name
-
- public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default
- // To change the version, change <Version>0.0.1</Version> in HelloModdingWorld.csproj
-
- // called when Gamecraft shuts down
- public override void OnApplicationQuit()
- {
- // Shutdown this mod
- GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");
-
- // Shutdown the Gamecraft modding API last
- GamecraftModdingAPI.Main.Shutdown();
- }
-
- // called when Gamecraft starts up
- public override void OnApplicationStart()
- {
- // Initialize the Gamecraft modding API first
- GamecraftModdingAPI.Main.Init();
- // check out the modding API docs here: https://mod.exmods.org/
-
- // Initialize this mod
- // create HelloWorld command
- // this writes "Hello modding world!" when you execute it in Gamecraft's console
- // (use the forward-slash key '/' to open the console in Gamecraft when in a game)
- GamecraftModdingAPI.Commands.CommandBuilder.Builder()
- .Name("HelloWorld") // command name (used to invoke it in the console)
- .Description("Says Hello modding world!") // command description (displayed in help and hint toolbar)
- .Action(() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); })
- .Build(); // construct and automatically register the command so the modding API knows about it
-
- GamecraftModdingAPI.Utility.Logging.MetaLog($"{Name} has started up");
- }
-
- // unused methods
-
- public override void OnFixedUpdate() { } // called once per physics update
-
- public override void OnUpdate() { } // called once per rendered frame (frame update)
- }
- }
|