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

52 lignes
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. }