<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Craft.Net.Data;
using Ionic.Zlib;

namespace Craft.Net.Server
{
    public static class ChunkHelper
    {
        public static byte[] ChunkRemovalSequence = new byte[] { 0x78, 0x9C, 0x63, 0x64, 0x1C, 0xD9, 0x00, 0x00, 0x81, 0x80, 0x01, 0x01 };

        private const int BlockDataLength = Section.Width * Section.Depth * Section.Height;
        private const int NibbleDataLength = BlockDataLength / 2;

        public static ChunkDataPacket CreatePacket(Chunk chunk)
        {
            var packet = new ChunkDataPacket();

            var X = (int)chunk.AbsolutePosition.X;
            var Z = (int)chunk.AbsolutePosition.Z;

            byte[] blockData;
            byte[] metadata;
            byte[] blockLight;
            byte[] skyLight;

            ushort mask = 1, chunkY = 0;
            bool nonAir = true;

            // First pass calculates number of sections to send
            int totalSections = 0;
            for (int i = 15; i >= 0; i--)
            {
                Section s = chunk.Sections[chunkY++];

                if (s.IsAir)
                    nonAir = false;
                if (nonAir)
                    totalSections++;
                mask <<= 1;
            }

            mask = 1;
            chunkY = 0;
            nonAir = true;
            blockData = new byte[totalSections * BlockDataLength];
            metadata = new byte[totalSections * NibbleDataLength];
            blockLight = new byte[totalSections * NibbleDataLength];
            skyLight = new byte[totalSections * NibbleDataLength];

            ushort PrimaryBitMap = 0, AddBitMap = 0;

            // Second pass produces the arrays
            for (int i = 15; i >= 0; i--)
            {
                Section s = chunk.Sections[chunkY++];

                if (s.IsAir)<commit_msg>Remove unneccissary code from ChunkHelper<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Craft.Net.Data;
using Ionic.Zlib;

namespace Craft.Net.Server
{
    public static class ChunkHelper
    {
        public static byte[] ChunkRemovalSequence = new byte[] { 0x78, 0x9C, 0x63, 0x64, 0x1C, 0xD9, 0x00, 0x00, 0x81, 0x80, 0x01, 0x01 };

        private const int BlockDataLength = Section.Width * Section.Depth * Section.Height;
        private const int NibbleDataLength = BlockDataLength / 2;

        public static ChunkDataPacket CreatePacket(Chunk chunk)
        {
            var packet = new ChunkDataPacket();

            var X = (int)chunk.AbsolutePosition.X;
            var Z = (int)chunk.AbsolutePosition.Z;

            byte[] blockData;
            byte[] metadata;
            byte[] blockLight;
            byte[] skyLight;

            ushort mask = 1, chunkY = 0;
            bool nonAir = true;

            // First pass calculates number of sections to send
            int totalSections = 0;
            for (int i = 15; i >= 0; i--)
            {
                Section s = chunk.Sections[chunkY++];

                if (s.IsAir)
                    nonAir = false;
                if (nonAir)
                    totalSections++;
            }

            mask = 1;
            chunkY = 0;
            nonAir = true;
            blockData = new byte[totalSections * BlockDataLength];
            metadata = new byte[totalSections * NibbleDataLength];
            blockLight = new byte[totalSections * NibbleDataLength];
            skyLight = new byte[totalSections * NibbleDataLength];

            ushort PrimaryBitMap = 0, AddBitMap = 0;

            // Second pass produces the arrays
            for (int i = 15; i >= 0; i--)
            {
                Section s = chunk.Sections[chunkY++];

                if (s.IsAir)
{'fraction_non_alphanumeric': 0.09048117154811715, 'fraction_numerical': 0.024843096234309622, 'mean_word_length': 1.6748251748251748, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2951692', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1056, 'n_words': 309}