Magically import images and more into Gamecraft as blocks
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.

52 lines
1.6KB

  1. using System;
  2. using GamecraftModdingAPI;
  3. using GamecraftModdingAPI.Blocks;
  4. using GamecraftModdingAPI.Players;
  5. using Pixi.Common;
  6. using Unity.Mathematics;
  7. namespace Pixi
  8. {
  9. public class TestImporter : Importer
  10. {
  11. public int Priority { get; } = 0;
  12. public bool Optimisable { get; } = false;
  13. public string Name { get; } = "Test~Spell";
  14. public BlueprintProvider BlueprintProvider { get; } = null;
  15. public bool Qualifies(string name)
  16. {
  17. return name.Equals("test", StringComparison.InvariantCultureIgnoreCase);
  18. }
  19. public BlockJsonInfo[] Import(string name)
  20. {
  21. return new[]
  22. {
  23. new BlockJsonInfo
  24. {
  25. name = BlockIDs.TextBlock.ToString() +
  26. "\ttext that is preserved through the whole import process and ends up in the text block\ttextblockIDs_sux",
  27. position = new[] {0f, 0f, 0f},
  28. rotation = new[] {0f, 0f, 0f},
  29. color = new[] {0f, 0f, 0f},
  30. scale = new[] {1f, 1f, 1f},
  31. }
  32. };
  33. }
  34. public void PreProcess(string name, ref ProcessedVoxelObjectNotation[] blocks)
  35. {
  36. Player p = new Player(PlayerType.Local);
  37. float3 pos = p.Position;
  38. for (int i = 0; i < blocks.Length; i++)
  39. {
  40. blocks[i].position += pos;
  41. }
  42. }
  43. public void PostProcess(string name, ref Block[] blocks)
  44. {
  45. // meh
  46. }
  47. }
  48. }