From b1fa25fb1d977bcaa7d467d3ea4bc86697de6797 Mon Sep 17 00:00:00 2001 From: Kodi Craft Date: Thu, 1 Aug 2024 06:42:43 +0200 Subject: [PATCH] Fix bug in serializing login (play) but revealed other, more confusing bug --- lib/servers/play.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/servers/play.ex b/lib/servers/play.ex index 03c4d20..ce6157b 100644 --- a/lib/servers/play.ex +++ b/lib/servers/play.ex @@ -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) <>