Fix some warnings and typos
This commit is contained in:
@ -10,7 +10,7 @@ import (
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
// ChunkData is a clientbound packet which describes a chunk.
|
||||
// ChunkData is a client-bound packet which describes a chunk.
|
||||
type ChunkData struct {
|
||||
X, Z pk.Int
|
||||
FullChunk pk.Boolean
|
||||
@ -24,10 +24,10 @@ type ChunkData struct {
|
||||
func (p *ChunkData) Decode(pkt pk.Packet) error {
|
||||
r := bytes.NewReader(pkt.Data)
|
||||
if err := p.X.Decode(r); err != nil {
|
||||
return fmt.Errorf("X: %v", err)
|
||||
return fmt.Errorf("decode X: %v", err)
|
||||
}
|
||||
if err := p.Z.Decode(r); err != nil {
|
||||
return fmt.Errorf("Z: %v", err)
|
||||
return fmt.Errorf("decode Z: %v", err)
|
||||
}
|
||||
if err := p.FullChunk.Decode(r); err != nil {
|
||||
return fmt.Errorf("full chunk: %v", err)
|
||||
@ -39,7 +39,7 @@ func (p *ChunkData) Decode(pkt pk.Packet) error {
|
||||
return fmt.Errorf("heightmaps: %v", err)
|
||||
}
|
||||
|
||||
// Biome data is only present for full chunks.
|
||||
// Biomes data is only present for full chunks.
|
||||
if p.FullChunk {
|
||||
if err := p.Biomes.Decode(r); err != nil {
|
||||
return fmt.Errorf("heightmaps: %v", err)
|
||||
@ -60,13 +60,13 @@ type biomesData struct {
|
||||
}
|
||||
|
||||
func (b *biomesData) Decode(r pk.DecodeReader) error {
|
||||
var nobd pk.VarInt // Number of Biome Datums
|
||||
if err := nobd.Decode(r); err != nil {
|
||||
var BiomesDataNums pk.VarInt // Number of Biomes Data
|
||||
if err := BiomesDataNums.Decode(r); err != nil {
|
||||
return err
|
||||
}
|
||||
b.data = make([]pk.VarInt, nobd)
|
||||
b.data = make([]pk.VarInt, BiomesDataNums)
|
||||
|
||||
for i := 0; i < int(nobd); i++ {
|
||||
for i := 0; i < int(BiomesDataNums); i++ {
|
||||
var d pk.VarInt
|
||||
if err := d.Decode(r); err != nil {
|
||||
return err
|
||||
|
@ -2,7 +2,7 @@ package ptypes
|
||||
|
||||
import pk "github.com/Tnze/go-mc/net/packet"
|
||||
|
||||
// SpawnEntity is a clientbound packet used to spawn a non-mob entity.
|
||||
// SpawnEntity is a client-bound packet used to spawn a non-mob entity.
|
||||
type SpawnEntity struct {
|
||||
ID pk.VarInt
|
||||
UUID pk.UUID
|
||||
@ -19,7 +19,7 @@ func (p *SpawnEntity) Decode(pkt pk.Packet) error {
|
||||
&p.Data, &p.VelX, &p.VelY, &p.VelZ)
|
||||
}
|
||||
|
||||
// SpawnPlayer is a clientbound packet used to describe a player entering
|
||||
// SpawnPlayer is a client-bound packet used to describe a player entering
|
||||
// visible range.
|
||||
type SpawnPlayer struct {
|
||||
ID pk.VarInt
|
||||
@ -32,7 +32,7 @@ func (p *SpawnPlayer) Decode(pkt pk.Packet) error {
|
||||
return pkt.Scan(&p.ID, &p.UUID, &p.X, &p.Y, &p.Z, &p.Yaw, &p.Pitch)
|
||||
}
|
||||
|
||||
// SpawnLivingEntity is a clientbound packet used to spawn a mob.
|
||||
// SpawnLivingEntity is a client-bound packet used to spawn a mob.
|
||||
type SpawnLivingEntity struct {
|
||||
ID pk.VarInt
|
||||
UUID pk.UUID
|
||||
@ -49,7 +49,7 @@ func (p *SpawnLivingEntity) Decode(pkt pk.Packet) error {
|
||||
&p.HeadPitch, &p.VelX, &p.VelY, &p.VelZ)
|
||||
}
|
||||
|
||||
// EntityAnimationClientbound updates the animationf state of an entity.
|
||||
// EntityAnimationClientbound updates the animation state of an entity.
|
||||
type EntityAnimationClientbound struct {
|
||||
ID pk.VarInt
|
||||
Animation pk.UnsignedByte
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
// SoundEffect is a clientbound packet used to play a specific sound ID
|
||||
// SoundEffect is a client-bound packet used to play a specific sound ID
|
||||
// on the client.
|
||||
type SoundEffect struct {
|
||||
Sound pk.VarInt
|
||||
@ -21,7 +21,7 @@ func (p *SoundEffect) Decode(pkt pk.Packet) error {
|
||||
return pkt.Scan(&p.Sound, &p.Category, &p.X, &p.Y, &p.Z, &p.Volume, &p.Pitch)
|
||||
}
|
||||
|
||||
// NamedSoundEffect is a clientbound packet used to play a sound with the
|
||||
// NamedSoundEffect is a client-bound packet used to play a sound with the
|
||||
// specified name on the client.
|
||||
type NamedSoundEffect struct {
|
||||
Sound pk.String
|
||||
@ -64,11 +64,11 @@ func (p PluginData) Encode() []byte {
|
||||
}
|
||||
|
||||
func (p *PluginData) Decode(r pk.DecodeReader) error {
|
||||
data, err := ioutil.ReadAll(r)
|
||||
d, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*p = data
|
||||
*p = d
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user