Tools for building games mainly focused on changing block properties. And noclip.
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.

37 lines
974B

  1. using System.Linq;
  2. using GamecraftModdingAPI;
  3. using GamecraftModdingAPI.Blocks;
  4. using GamecraftModdingAPI.Utility;
  5. namespace BlockMod
  6. {
  7. public class BlockSelections
  8. {
  9. internal Block[] blocks = new Block[0];
  10. internal Block refBlock;
  11. public bool CheckNoBlocks(Block[] blocks)
  12. {
  13. if (blocks.Length == 0)
  14. {
  15. Logging.CommandLogWarning("No blocks selected. Use selectBlocks first.");
  16. return true;
  17. }
  18. return false;
  19. }
  20. public Block[] SelectBlocks(byte id)
  21. {
  22. var blocks = ObjectIdentifier.GetBySimID(id).SelectMany(block => block.GetConnectedCubes()).ToArray();
  23. return blocks;
  24. }
  25. public Block[] SelectBlocks(char id)
  26. {
  27. var blocks = ObjectIdentifier.GetByID(id).SelectMany(oid => oid.GetConnectedCubes())
  28. .ToArray();
  29. return blocks;
  30. }
  31. }
  32. }