Shell project for Techblox mods
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

53 lignes
2.1KB

  1. using System.Reflection;
  2. using IllusionPlugin;
  3. //using TechbloxModdingAPI;
  4. namespace HelloModdingWorld
  5. {
  6. public class MyPlugin : IEnhancedPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
  7. {
  8. public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // HelloModdingWorld by default
  9. // To change the name, change the project's name
  10. public override 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 override void OnApplicationQuit()
  14. {
  15. // Shutdown this mod
  16. TechbloxModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");
  17. // Shutdown the Gamecraft modding API last
  18. TechbloxModdingAPI.Main.Shutdown();
  19. }
  20. // called when Gamecraft starts up
  21. public override void OnApplicationStart()
  22. {
  23. // Initialize the Gamecraft modding API first
  24. TechbloxModdingAPI.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. TechbloxModdingAPI.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(() => { TechbloxModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); })
  34. .Build(); // construct and automatically register the command so the modding API knows about it
  35. TechbloxModdingAPI.Utility.Logging.MetaLog($"{Name} has started up");
  36. }
  37. // unused methods
  38. public override void OnFixedUpdate() { } // called once per physics update
  39. public override void OnUpdate() { } // called once per rendered frame (frame update)
  40. }
  41. }