Low spec Gamecraft mod
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

56 lines
2.2KB

  1. using System.Reflection;
  2. using IllusionPlugin;
  3. //using GamecraftModdingAPI;
  4. namespace HelloModdingWorld
  5. {
  6. public class MyPlugin : IPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
  7. {
  8. public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // HelloModdingWorld by default
  9. // To change the name, change the project's name
  10. public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default
  11. // To change the version, change <Version>0.0.1</Version> in HelloModdingWorld.csproj
  12. // called when Gamecraft shuts down
  13. public void OnApplicationQuit()
  14. {
  15. // Shutdown this mod
  16. GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");
  17. // Shutdown the Gamecraft modding API last
  18. GamecraftModdingAPI.Main.Shutdown();
  19. }
  20. // called when Gamecraft starts up
  21. public void OnApplicationStart()
  22. {
  23. // Initialize the Gamecraft modding API first
  24. GamecraftModdingAPI.Main.Init();
  25. // check out the modding API docs here: https://mod.exmods.org/
  26. // Initialize this mod
  27. // create HelloWorld command
  28. // this writes "Hello modding world!" when you execute it in Gamecraft's console
  29. // (use the forward-slash key '/' to open the console in Gamecraft when in a game)
  30. GamecraftModdingAPI.Commands.CommandBuilder.Builder()
  31. .Name("HelloWorld") // command name (used to invoke it in the console)
  32. .Description("Says Hello modding world!") // command description (displayed in help and hint toolbar)
  33. .Action(() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); })
  34. .Build(); // construct and automatically register the command so the modding API knows about it
  35. GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up");
  36. }
  37. // unused methods
  38. public void OnFixedUpdate() { } // called once per physics update
  39. public void OnLevelWasInitialized(int level) { } // called after a level is initialized
  40. public void OnLevelWasLoaded(int level) { } // called after a level is loaded
  41. public void OnUpdate() { } // called once per rendered frame (frame update)
  42. }
  43. }