Implement packet decoding for entities
This commit is contained in:
@ -2,10 +2,11 @@ package packet
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/google/uuid"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/Tnze/go-mc/nbt"
|
||||
)
|
||||
|
||||
@ -364,6 +365,16 @@ func (p *Position) Decode(r DecodeReader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//Decodes an Angle
|
||||
func (b *Angle) Decode(r DecodeReader) error {
|
||||
v, err := r.ReadByte()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*b = Angle(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
//Encode a Float
|
||||
func (f Float) Encode() []byte {
|
||||
return Int(math.Float32bits(float32(f))).Encode()
|
||||
|
Reference in New Issue
Block a user