A stable modding interface between Techblox and mods https://mod.exmods.org/
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.

AsyncUtils.cs 969B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Threading.Tasks;
  2. using Svelto.ECS;
  3. namespace GamecraftModdingAPI.Utility
  4. {
  5. public static class AsyncUtils
  6. {
  7. private static AsyncUtilsEngine gameEngine = new AsyncUtilsEngine();
  8. /// <summary>
  9. /// Waits for entity submission asynchronously.
  10. /// Use after placing a block or otherwise creating things in the game to access their properties.
  11. /// </summary>
  12. public static async Task WaitForSubmission()
  13. {
  14. await gameEngine.WaitForSubmission();
  15. }
  16. public static async Task WaitForNextFrame()
  17. {
  18. await gameEngine.WaitForNextFrame();
  19. }
  20. public static void Setup(EnginesRoot enginesRoot)
  21. {
  22. gameEngine.Setup(enginesRoot.GenerateEntityFunctions(), enginesRoot.GenerateEntityFactory());
  23. }
  24. public static void Init()
  25. {
  26. GameEngineManager.AddGameEngine(gameEngine);
  27. }
  28. }
  29. }