Esempio n. 1
0
func (player *Player) Start() {
	buf := &bytes.Buffer{}
	// TODO pass proper dimension. This is low priority, because we don't yet
	// support multiple dimensions.
	proto.ServerWriteLogin(buf, player.EntityId, 0, DimensionNormal)
	proto.WriteSpawnPosition(buf, &player.spawnBlock)
	player.TransmitPacket(buf.Bytes())

	go player.receiveLoop()
	go player.transmitLoop()
	go player.mainLoop()
}
Esempio n. 2
0
func (player *Player) Run() {
	buf := &bytes.Buffer{}
	// TODO pass proper dimension. This is low priority, because we don't yet
	// support multiple dimensions.
	// TODO pass proper map seed.
	// TODO pass proper values for the difficulty.
	// TODO proper max number of players.
	proto.ServerWriteLogin(buf, player.EntityId, 0, 0, DimensionNormal, GameDifficultyNormal, MaxYCoord+1, 8)
	proto.WriteSpawnPosition(buf, &player.spawnBlock)
	player.TransmitPacket(buf.Bytes())

	go player.receiveLoop()
	go player.transmitLoop()
	go player.mainLoop()
}