@@ -4,29 +4,25 @@ import (
44 "encoding/binary"
55 "fmt"
66
7- "github.com/minetest-go/minetest_client/ types"
7+ "github.com/minetest-go/types"
88)
99
1010type ClientGotBlocks struct {
11- Blocks []types.BlockPos
11+ Blocks []types.Pos
1212}
1313
1414func NewClientGotBlocks () * ClientGotBlocks {
1515 return & ClientGotBlocks {
16- Blocks : make ([]types.BlockPos , 0 ),
16+ Blocks : make ([]types.Pos , 0 ),
1717 }
1818}
1919
20- func (p * ClientGotBlocks ) AddBlock (pos types.BlockPos ) {
20+ func (p * ClientGotBlocks ) AddBlock (pos types.Pos ) {
2121 p .Blocks = append (p .Blocks , pos )
2222}
2323
24- func (p * ClientGotBlocks ) AddBlockPos (x , y , z int16 ) {
25- p .AddBlock (types.BlockPos {
26- PosX : x ,
27- PosY : y ,
28- PosZ : z ,
29- })
24+ func (p * ClientGotBlocks ) AddBlockPos (x , y , z int ) {
25+ p .AddBlock (types.Pos {x , y , z })
3026}
3127
3228func (p * ClientGotBlocks ) GetCommandId () uint16 {
@@ -38,11 +34,11 @@ func (p *ClientGotBlocks) MarshalPacket() ([]byte, error) {
3834 buf [0 ] = uint8 (len (p .Blocks ))
3935 offset := 1
4036 for _ , bp := range p .Blocks {
41- binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .PosX ))
37+ binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .X () ))
4238 offset += 2
43- binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .PosY ))
39+ binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .Y () ))
4440 offset += 2
45- binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .PosZ ))
41+ binary .BigEndian .PutUint16 (buf [offset :], uint16 (bp .Z () ))
4642 offset += 2
4743 }
4844
@@ -54,5 +50,5 @@ func (p *ClientGotBlocks) UnmarshalPacket([]byte) error {
5450}
5551
5652func (p * ClientGotBlocks ) String () string {
57- return fmt .Sprintf ("{ClientGotBlocks blocks=%s }" , p .Blocks )
53+ return fmt .Sprintf ("{ClientGotBlocks blocks=%v }" , p .Blocks )
5854}
0 commit comments