Example #1
0
        internal void SetBlock(PositionBlock pos, int blockId)
        {
            PositionChunk positionChunk = PositionChunk.CreateFrom(pos);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref pos);
            chunk.SetLocalBlock(pos.X, pos.Y, pos.Z, blockId);
        }
Example #2
0
        internal Entity GetBlockEntity(PositionBlock position)
        {
            PositionChunk positionChunk = PositionChunk.CreateFrom(position);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref position);
            Entity entity = chunk.GetBlockEntity(position);

            return(entity);
        }
Example #3
0
        internal Entity GetBlockEntityFromPosition(PositionBlock pos)
        {
            if (pos.Y < 0)
            {
                return(null);
            }
            if (pos.Y >= Chunk.MaxSizeY)
            {
                return(null);
            }
            PositionChunk positionChunk = PositionChunk.CreateFrom(pos);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref pos);
            return(chunk.GetBlockEntityFromPosition(pos));
        }
Example #4
0
        internal void SetBlockMetaData(PositionBlock pos, string variable, object value)
        {
            if (pos.Y < 0)
            {
                return;
            }
            if (pos.Y >= Chunk.MaxSizeY)
            {
                return;
            }
            PositionChunk positionChunk = PositionChunk.CreateFrom(pos);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref pos);
            chunk.SetBlockMetaData(pos, variable, value);
        }
Example #5
0
        internal object GetBlockMetaData(PositionBlock pos, string variable)
        {
            if (pos.Y < 0)
            {
                return(null);
            }
            if (pos.Y >= Chunk.MaxSizeY)
            {
                return(null);
            }
            PositionChunk positionChunk = PositionChunk.CreateFrom(pos);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref pos);
            return(chunk.GetBlockMetaData(pos, variable));
        }
Example #6
0
        internal int GetBlock(PositionBlock pos)
        {
            if (pos.Y < 0)
            {
                return(0);
            }
            if (pos.Y >= Chunk.MaxSizeY)
            {
                return(0);
            }
            PositionChunk positionChunk = PositionChunk.CreateFrom(pos);
            Chunk         chunk         = GetChunk(positionChunk);

            positionChunk.ConvertToLocalPosition(ref pos);
            int blockId = chunk.GetLocalBlock(pos.X, pos.Y, pos.Z);

            return(blockId);
        }