예제 #1
0
파일: Section.cs 프로젝트: Booser/Craft.Net
 public Section(byte y)
 {
     const int size = Width * Height * Depth;
     this.Y = y;
     Blocks = new byte[size];
     Metadata = new NibbleArray(size);
     BlockLight = new NibbleArray(size);
     SkyLight = new NibbleArray(size);
     for (int i = 0; i < size; i++)
         SkyLight[i] = 0xFF;
     Add = null; // Only used when needed
     nonAirCount = 0;
 }
예제 #2
0
        public Section(byte y)
        {
            const int size = Width * Height * Depth;

            this.Y     = y;
            Blocks     = new byte[size];
            Metadata   = new NibbleArray(size);
            BlockLight = new NibbleArray(size);
            SkyLight   = new NibbleArray(size);
            for (int i = 0; i < size; i++)
            {
                SkyLight[i] = 0xFF;
            }
            Add         = null; // Only used when needed
            nonAirCount = 0;
        }
예제 #3
0
 public ReadOnlyNibbleArray(NibbleArray array)
 {
     NibbleArray = array;
 }
예제 #4
0
파일: Section.cs 프로젝트: Booser/Craft.Net
 public void SetBlockId(Coordinates3D coordinates, short value)
 {
     int index = coordinates.X + (coordinates.Z * Width) + (coordinates.Y * Height * Width);
     if (value == 0)
     {
         if (Blocks[index] != 0)
             nonAirCount--;
     }
     else
     {
         if (Blocks[index] == 0)
             nonAirCount++;
     }
     Blocks[index] = (byte)value;
     if ((value & ~0xFF) != 0)
     {
         if (Add == null) Add = new NibbleArray(Width * Height * Depth);
         Add[index] = (byte)((ushort)value >> 8);
     }
 }
예제 #5
0
 public ReadOnlyNibbleArray(NibbleArray array)
 {
     NibbleArray = array;
 }