forked from Sandertv/gophertunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_actor_data.go
28 lines (24 loc) · 976 Bytes
/
block_actor_data.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package packet
import (
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/nbt"
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/protocol"
)
// BlockActorData is sent by the server to update data of a block entity client-side, for example the data of
// a chest.
type BlockActorData struct {
// Position is the position of the block that holds the block entity. If no block entity is at this
// position, the packet is ignored by the client.
Position protocol.BlockPos
// NBTData is the new data of the block that will be encoded to NBT and applied client-side, so that the
// client can see the block update. The NBTData should contain all properties of the block, not just
// properties that were changed.
NBTData map[string]any
}
// ID ...
func (*BlockActorData) ID() uint32 {
return IDBlockActorData
}
func (pk *BlockActorData) Marshal(io protocol.IO) {
io.UBlockPos(&pk.Position)
io.NBT(&pk.NBTData, nbt.NetworkLittleEndian)
}