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.

42 lines
1.0KB

  1. using System;
  2. using Unity.Mathematics;
  3. using GamecraftModdingAPI.Blocks;
  4. namespace Pixi.Common
  5. {
  6. public struct BlockJsonInfo
  7. {
  8. public string name;
  9. public float[] position;
  10. public float[] rotation;
  11. public float[] color;
  12. public float[] scale;
  13. internal ProcessedVoxelObjectNotation Process()
  14. {
  15. BlockIDs block = ConversionUtility.BlockIDsToEnum(name.Split('\t')[0]);
  16. return new ProcessedVoxelObjectNotation
  17. {
  18. block = block,
  19. blueprint = block == BlockIDs.Invalid,
  20. color = ColorSpaceUtility.QuantizeToBlockColor(color),
  21. metadata = name,
  22. position = ConversionUtility.FloatArrayToFloat3(position),
  23. rotation = ConversionUtility.FloatArrayToFloat3(rotation),
  24. scale = ConversionUtility.FloatArrayToFloat3(scale),
  25. };
  26. }
  27. public override string ToString()
  28. {
  29. return $"BlockJsonInfo {{ name:{name}, color:(r{color[0]},g{color[1]},b{color[2]}), position:({position[0]},{position[1]},{position[2]}), rotation:({rotation[0]},{rotation[1]},{rotation[2]}), scale:({scale[0]},{scale[1]},{scale[2]})}}";
  30. }
  31. }
  32. }