Beispiel #1
0
    public static Block Load(System.IO.FileStream fs, Chunk c)
    {
        var b = new Block(c, new ChunkPos(fs.ReadByte(), fs.ReadByte(), fs.ReadByte()));

        if (fs.ReadByte() == 1)
        {
            b.extension = BlockExtension.Load(fs, b);
        }
        return(b);
    }
Beispiel #2
0
    public static bool TryToLoadBlock(System.IO.Stream fs, Chunk c, ref Block b)
    {
        b = new Block(c, new ChunkPos(fs.ReadByte(), fs.ReadByte(), fs.ReadByte()));
        var csize = Chunk.chunkSize;

        if (b.pos.x >= csize | b.pos.y >= csize | b.pos.z >= csize)
        {
            Debug.Log("block load error - wrong position");
            GameMaster.LoadingFail();
            return(false);
        }
        if (fs.ReadByte() == 1)
        {
            b.extension = BlockExtension.Load(fs, b);
        }
        return(true);
    }