-
Notifications
You must be signed in to change notification settings - Fork 6
/
add_painting.go
50 lines (44 loc) · 1.6 KB
/
add_painting.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
package packet
import (
"dotcs/minecraft/protocol"
"github.com/go-gl/mathgl/mgl32"
)
// AddPainting is sent by the server to the client to make a painting entity show up. It is one of the few
// entities that cannot be sent using the AddActor packet.
type AddPainting struct {
// EntityUniqueID is the unique ID of the entity. The unique ID is a value that remains consistent across
// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
// this field.
EntityUniqueID int64
// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
// entities are generally identified in packets using this runtime ID.
EntityRuntimeID uint64
// Position is the position to spawn the entity on. If the entity is on a distance that the player cannot
// see it, the entity will still show up if the player moves closer.
Position mgl32.Vec3
// Direction is the facing direction of the painting.
Direction int32
// Title is the title of the painting. It specifies the motive of the painting. The title of the painting
// must be valid.
Title string
}
// ID ...
func (*AddPainting) ID() uint32 {
return IDAddPainting
}
// Marshal ...
func (pk *AddPainting) Marshal(w *protocol.Writer) {
w.Varint64(&pk.EntityUniqueID)
w.Varuint64(&pk.EntityRuntimeID)
w.Vec3(&pk.Position)
w.Varint32(&pk.Direction)
w.String(&pk.Title)
}
// Unmarshal ...
func (pk *AddPainting) Unmarshal(r *protocol.Reader) {
r.Varint64(&pk.EntityUniqueID)
r.Varuint64(&pk.EntityRuntimeID)
r.Vec3(&pk.Position)
r.Varint32(&pk.Direction)
r.String(&pk.Title)
}