Fix bug in serializing login (play) but revealed other, more confusing bug
All checks were successful
Build & Test / nix-build (push) Successful in 1m11s

This commit is contained in:
Kodi Craft 2024-08-01 06:42:43 +02:00
parent 9c6c275b3e
commit b1fa25fb1d
Signed by: kodi
GPG Key ID: 69D9EED60B242822

View File

@ -43,11 +43,11 @@ defmodule Amethyst.Server.Play do
max_players, view_distance, simulation_distance,
reduce_debug, enable_respawn_screen, limited_crafting,
dim_type, dim_name, hashed_seed, gamemode, prev_gm,
is_debug, is_flat, death_loc, portal_cooldown, enforce_chat}) do
# TODO: This is a big unreadable slab of serialization, it needs a proper rework at some point
is_debug, is_flat, death_loc, portal_cooldown, enforce_chat}) when byte_size(hashed_seed) == 8 do
# TODO: This is a big unreadable slab of serialization which makes bugs really hard to catch, it needs a proper rework at some point
Write.varint(0x2B) <>
Write.int(eid) <> Write.bool(hardcore) <>
Write.varint(length(dimensions)) <> Enum.reduce(dimensions, "", fn dim, acc -> acc <> Write.string(dim) end) <>
Write.varint(length(dimensions)) <> Write.list(dimensions, &Write.string/1) <>
Write.varint(max_players) <> Write.varint(view_distance) <> Write.varint(simulation_distance) <> Write.bool(reduce_debug) <>
Write.bool(enable_respawn_screen) <>
Write.bool(limited_crafting) <> Write.varint(dim_type) <> Write.string(dim_name) <>