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.
|
- using Gamecraft.Blocks.BlockGroups;
- using GamecraftModdingAPI.Blocks;
- using GamecraftModdingAPI.Utility;
-
- namespace GamecraftModdingAPI
- {
- /// <summary>
- /// A group of blocks that can be selected together. The placed version of blueprints.
- /// </summary>
- public class BlockGroup
- {
- internal static BlueprintEngine _engine = new BlueprintEngine();
- public int Id { get; }
- private Block _sourceBlock;
-
- internal BlockGroup(int id, Block block)
- {
- if (id == BlockGroupUtility.GROUP_UNASSIGNED)
- throw new BlockException("Cannot create a block group for blocks without a group!");
- Id = id;
- _sourceBlock = block;
- }
-
- /// <summary>
- /// Collects each block that is a part of this group.
- /// </summary>
- /// <returns>An array of blocks</returns>
- public Block[] GetBlocks()
- {
- return _engine.GetBlocksFromGroup(_sourceBlock.Id);
- }
-
- /// <summary>
- /// Removes all of the blocks in this group from the world.
- /// </summary>
- public void Remove()
- {
- _engine.RemoveBlockGroup(Id);
- }
-
- public static void Init()
- {
- GameEngineManager.AddGameEngine(_engine);
- }
- }
- }
|