From 3bb8c5286af2175347c59ed6b9e06dff9eb24369 Mon Sep 17 00:00:00 2001 From: Kodi Craft Date: Sat, 5 Oct 2024 11:35:38 +0200 Subject: [PATCH] Actually implement reading byte_arrays --- apps/amethyst/lib/data.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/amethyst/lib/data.ex b/apps/amethyst/lib/data.ex index db3c94c..12fd126 100644 --- a/apps/amethyst/lib/data.ex +++ b/apps/amethyst/lib/data.ex @@ -216,6 +216,11 @@ defmodule Amethyst.Minecraft.Read do {[data | acc], rest, :reversed} end + def byte_array({acc, data, :reversed}) do + {[length], rest} = start(data) |> varint |> stop + raw({acc, rest, :reversed}, length) + end + @doc """ Reads a varint. `read` tracks the number of bytes read and `nacc` tracks the number being read. """