Begin implementing login (play)
All checks were successful
Build & Test / nix-build (push) Successful in 1m13s

This commit is contained in:
Kodi Craft 2024-07-21 03:26:10 +02:00
parent 8572ac5443
commit b10be14079
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 6 additions and 0 deletions

View File

@ -255,6 +255,11 @@ defmodule Amethyst.Server.Configuration do
end
# Acknowledge Finish Configuration https://wiki.vg/Protocol#Acknowledge_Finish_Configuration
def handle({:acknowledge_finish_configuration}, client, state) do
# TODO: All of this stuff should obviously not be hardcoded here
Amethyst.Server.Play.transmit({:login,
0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0,
"minecraft:overworld", <<0::64>>, :spectator, nil, false, true, nil, 0, false
}, client)
Amethyst.Server.Play.serve(client, state)
end
# Serverbound Plugin Message https://wiki.vg/Protocol#Serverbound_Plugin_Message_(configuration)

View File

@ -45,6 +45,7 @@ defmodule Amethyst.Server.Play do
dim_type, dim_name, hashed_seed, gamemode, prev_gm,
is_debug, is_flat, death_loc, portal_cooldown, enforce_chat}) do
# TODO: this singlehandedly made me regret not making the write API better, please rework :(
Write.varint(0x2B) <>
<<eid::big-signed-32>> <> if(hardcore, do: <<1::big-8>>, else: <<0::big-8>>) <>
Write.varint(length(dimensions)) <> Enum.reduce(dimensions, "", fn dim, acc -> acc <> Write.string(dim) end) <>
Write.varint(max_players) <> Write.varint(view_distance) <> Write.varint(simulation_distance) <> if(reduce_debug, do: <<1::big-8>>, else: <<0::big-8>>) <>