frameworkServer works perfect now

This commit is contained in:
Tnze
2022-03-09 17:21:28 +08:00
parent aa8e611644
commit 0bbd279dd1
8 changed files with 73 additions and 34320 deletions

View File

@ -5,8 +5,10 @@ import (
"compress/gzip"
"compress/zlib"
"errors"
"github.com/Tnze/go-mc/nbt"
"io"
"github.com/Tnze/go-mc/level/block"
"github.com/Tnze/go-mc/nbt"
)
// Chunk is 16* chunk
@ -45,6 +47,19 @@ type BlockState struct {
Properties nbt.RawMessage
}
func (s *BlockState) Block() block.Block {
b, ok := block.DefaultBlock(s.Name)
if !ok {
return nil
}
if s.Properties.Type != nbt.TagEnd {
if err := s.Properties.Unmarshal(&b); err != nil {
return nil
}
}
return b
}
// Load read column data from []byte
func (c *Chunk) Load(data []byte) (err error) {
var r io.Reader = bytes.NewReader(data[1:])