37 lines
No EOL
974 B
C#
37 lines
No EOL
974 B
C#
using System.Linq;
|
|
using GamecraftModdingAPI;
|
|
using GamecraftModdingAPI.Blocks;
|
|
using GamecraftModdingAPI.Utility;
|
|
|
|
namespace BlockMod
|
|
{
|
|
public class BlockSelections
|
|
{
|
|
internal Block[] blocks = new Block[0];
|
|
internal Block refBlock;
|
|
|
|
public bool CheckNoBlocks(Block[] blocks)
|
|
{
|
|
if (blocks.Length == 0)
|
|
{
|
|
Logging.CommandLogWarning("No blocks selected. Use selectBlocks first.");
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public Block[] SelectBlocks(byte id)
|
|
{
|
|
var blocks = ObjectIdentifier.GetBySimID(id).SelectMany(block => block.GetConnectedCubes()).ToArray();
|
|
return blocks;
|
|
}
|
|
|
|
public Block[] SelectBlocks(char id)
|
|
{
|
|
var blocks = ObjectIdentifier.GetByID(id).SelectMany(oid => oid.GetConnectedCubes())
|
|
.ToArray();
|
|
return blocks;
|
|
}
|
|
}
|
|
} |