-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
game_data.go
82 lines (80 loc) · 4.71 KB
/
game_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package minecraft
import (
"github.com/go-gl/mathgl/mgl32"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
// GameData is a loose wrapper around a part of the data found in the StartGame packet. It holds data sent
// specifically at the start of the game, such as the position of the player, the game mode, etc.
type GameData struct {
// WorldName is the name of the world that the player spawns in. This name will be displayed at the top of
// the player list when opening the in-game menu. It may contain colour codes and does not have to be an
// actual world name, but instead, can be the server name.
// If WorldName is left empty, the name of the Listener will be used to show above the player list
// in-game.
WorldName string
// Difficulty is the difficulty of the world that the player spawns in. A difficulty of 0, peaceful, means
// the player will automatically regenerate health and hunger.
Difficulty int32
// EntityUniqueID is the unique ID of the player. The unique ID is unique for the entire world and is
// often used in packets. Most servers send an EntityUniqueID equal to the EntityRuntimeID.
EntityUniqueID int64
// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
// entities are generally identified in packets using this runtime ID.
EntityRuntimeID uint64
// PlayerGameMode is the game mode the player currently has. It is a value from 0-4, with 0 being
// survival mode, 1 being creative mode, 2 being adventure mode, 3 being survival spectator and 4 being
// creative spectator.
// This field may be set to 5 to make the client fall back to the game mode set in the WorldGameMode
// field.
PlayerGameMode int32
// BaseGameVersion is the version of the game from which Vanilla features will be used. The exact function
// of this field isn't clear.
BaseGameVersion string
// PlayerPosition is the spawn position of the player in the world. In servers this is often the same as
// the world's spawn position found below.
PlayerPosition mgl32.Vec3
// Pitch is the vertical rotation of the player. Facing straight forward yields a pitch of 0. Pitch is
// measured in degrees.
Pitch float32
// Yaw is the horizontal rotation of the player. Yaw is also measured in degrees.
Yaw float32
// Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2, with 0 being
// the overworld, 1 being the nether and 2 being the end.
Dimension int32
// WorldSpawn is the block on which the world spawn of the world. This coordinate has no effect on the
// place that the client spawns, but it does have an effect on the direction that a compass points.
WorldSpawn protocol.BlockPos
// EditorWorld is a value to dictate if the world is in editor mode, a special mode recently introduced adding
// "powerful tools for editing worlds, intended for experienced creators."
EditorWorld bool
// WorldGameMode is the game mode that a player gets when it first spawns in the world. It is shown in the
// settings and is used if the PlayerGameMode is set to 5.
WorldGameMode int32
// GameRules defines game rules currently active with their respective values. The value of these game
// rules may be either 'bool', 'int32' or 'float32'. Some game rules are server side only, and don't
// necessarily need to be sent to the client.
GameRules []protocol.GameRule
// Time is the total time that has elapsed since the start of the world.
Time int64
// ServerBlockStateChecksum is a checksum to ensure block states between the server and client match.
// This can simply be left empty, and the client will avoid trying to verify it.
ServerBlockStateChecksum uint64
// CustomBlocks is a list of custom blocks added to the game by the server. These blocks all have a name
// and block properties.
CustomBlocks []protocol.BlockEntry
// Items is a list of all items existing in the game, including custom items registered by the server.
Items []protocol.ItemEntry
// PlayerMovementSettings specify the different server authoritative movement settings that it has
// enabled.
PlayerMovementSettings protocol.PlayerMovementSettings
// ServerAuthoritativeInventory specifies if the server authoritative inventory system is enabled. This
// is a new system introduced in 1.16. Backwards compatibility with the inventory transactions has to
// some extent been preserved, but will eventually be removed.
ServerAuthoritativeInventory bool
// Experiments is a list of experiments enabled on the server side. These experiments are used to enable
// disable experimental features.
Experiments []protocol.ExperimentData
// ChunkRadius is the initial chunk radius that the connection gets. This can be changed later on using a
// packet.ChunkRadiusUpdated.
ChunkRadius int32
}