/// <summary> /// Adds an area to the schematic. /// </summary> /// <param name="world">The world the blocks are in</param> /// <param name="start">The start position of all the blocks.</param> /// <param name="end">The end position of all the blocks.</param> public virtual void AddArea(IWorldAccessor world, BlockPos start, BlockPos end) { BlockPos startPos = new BlockPos(Math.Min(start.X, end.X), Math.Min(start.Y, end.Y), Math.Min(start.Z, end.Z)); BlockPos finalPos = new BlockPos(Math.Max(start.X, end.X), Math.Max(start.Y, end.Y), Math.Max(start.Z, end.Z)); for (int x = startPos.X; x < finalPos.X; x++) { for (int y = startPos.Y; y < finalPos.Y; y++) { for (int z = startPos.Z; z < finalPos.Z; z++) { BlockPos pos = new BlockPos(x, y, z); int blockid = world.BlockAccessor.GetBlockId(pos); if (blockid == 0) { continue; } BlocksUnpacked[pos] = blockid; BlockEntity be = world.BlockAccessor.GetBlockEntity(pos); if (be != null) { BlockEntitiesUnpacked[pos] = EncodeBlockEntityData(be); be.OnStoreCollectibleMappings(BlockCodes, ItemCodes); } } } } EntitiesUnpacked.AddRange(world.GetEntitiesInsideCuboid(start, end, (e) => !(e is EntityPlayer))); }