/
container_set_data.go
52 lines (45 loc) · 1.43 KB
/
container_set_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package packet
import (
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
const (
ContainerDataFurnaceTickCount = iota
ContainerDataFurnaceLitTime
ContainerDataFurnaceLitDuration
_
ContainerDataFurnaceFuelAux
)
const (
ContainerDataBrewingStandBrewTime = iota
ContainerDataBrewingStandFuelAmount
ContainerDataBrewingStandFuelTotal
)
// ContainerSetData is sent by the server to update specific data of a single container, meaning a block such
// as a furnace or a brewing stand. This data is usually used by the client to display certain features
// client-side.
type ContainerSetData struct {
// WindowID is the ID of the window that should have its data set. The player must have a window open with
// the window ID passed, or nothing will happen.
WindowID byte
// Key is the key of the property. It is one of the constants that can be found above. Multiple properties
// share the same key, but the functionality depends on the type of the container that the data is set to.
Key int32
// Value is the value of the property. Its use differs per property.
Value int32
}
// ID ...
func (*ContainerSetData) ID() uint32 {
return IDContainerSetData
}
// Marshal ...
func (pk *ContainerSetData) Marshal(w *protocol.Writer) {
w.Uint8(&pk.WindowID)
w.Varint32(&pk.Key)
w.Varint32(&pk.Value)
}
// Unmarshal ...
func (pk *ContainerSetData) Unmarshal(r *protocol.Reader) {
r.Uint8(&pk.WindowID)
r.Varint32(&pk.Key)
r.Varint32(&pk.Value)
}