blob: ebe71c9a98cdc14f1efb7fed0291eb2a18a65e4b (
plain)
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
|
package server
const playerHeight = 51
const blockSize = 32
type blockCoord int64
type entityCoord int64
type entityFacing struct {
Yaw, Pitch uint8
}
type blockPos struct {
X, Y, Z blockCoord
}
type entityPos struct {
X, Y, Z entityCoord
}
func entityToBlock(pos entityPos) blockPos {
return blockPos {
blockCoord(pos.X >> 5),
blockCoord(pos.Y >> 5),
blockCoord(pos.Z >> 5),
}
}
func blockToEntity(pos blockPos) entityPos {
return entityPos {
entityCoord(pos.X << 5),
entityCoord(pos.Y << 5),
entityCoord(pos.Z << 5),
}
}
|