OpenMinecraft.InfdevHandler.SetBlockAt C# (CSharp) Method

SetBlockAt() public method

public SetBlockAt ( Vector3i p, byte id ) : void
p Vector3i
id byte
return void
		public void SetBlockAt(Vector3i p, byte id)
		{
			//if(_DEBUG) Console.WriteLine("{0}", p);
			int CX = (int)p.X >> 4;// / (long)ChunkX);
			int CZ = (int)p.Y >> 4;// / (long)ChunkZ);

			int x = ((int)p.Y % ChunkX) & 0xf;
			int y = ((int)p.X % ChunkZ) & 0xf;
			int z = (int)p.Z;// % ChunkY;

			if (
				!Check(x, -1, ChunkX) ||
				!Check(y, -1, ChunkZ) ||
				!Check(z, -1, ChunkY))
			{
				return;
            }
            Vector2i ci = GetChunkHandle(CX, CZ);
            Chunk c;
            if (mCurrentChunk != null && mCurrentChunkX == CX && mCurrentChunkZ == CZ)
            {
                c = mCurrentChunk;
            }
            else
            {
                if (!mChunks.ContainsKey(ci))
                    return;
                c = mChunks[ci];
            }
			c.Blocks[x,y,z]=id;
			mChunks[ci] = c;
			if (!mChangedChunks.Contains(ci))
			{
				mChangedChunks.Add(ci);
				if(_DEBUG) Console.WriteLine(ci+" has changed");
			}
		}

Same methods

InfdevHandler::SetBlockAt ( int px, int y, int pz, byte val ) : void