diff --git a/apps/amethyst/lib/apps/connection_handler.ex b/apps/amethyst/lib/apps/connection_handler.ex index 8b94be1..1013252 100644 --- a/apps/amethyst/lib/apps/connection_handler.ex +++ b/apps/amethyst/lib/apps/connection_handler.ex @@ -220,6 +220,7 @@ defmodule Amethyst.ConnectionHandler do block_light_array = non_empty_block_light_sections |> Enum.map(&(Enum.reduce(&1, <<>>, fn light, acc -> <> end))) + Logger.debug("#{length(block_light_array)} block light sections to send") send(to, {:send_packet, %{ packet_type: :chunk_data_and_update_light, diff --git a/apps/amethyst/lib/data.ex b/apps/amethyst/lib/data.ex index 49fdb31..204d2a6 100644 --- a/apps/amethyst/lib/data.ex +++ b/apps/amethyst/lib/data.ex @@ -142,14 +142,12 @@ defmodule Amethyst.Minecraft.Write do end def bitset(list) do - Logger.debug("Writing bitset #{inspect(list)}") unaligned = Enum.reduce(list, <<>>, &(if &1 do <<&2::bitstring, 1::1>> else <<&2::bitstring, 0::1>> end)) aligned = if rem(bit_size(unaligned), 64) == 0 do unaligned else - <> + <<0::size(64 - rem(bit_size(unaligned), 64)), unaligned::bitstring>> end - Logger.debug("Writing as #{inspect(aligned)}") varint(div(byte_size(aligned), 8)) <> aligned end end diff --git a/apps/example_game/lib/example/game.ex b/apps/example_game/lib/example/game.ex index ec8b67a..bcf1605 100644 --- a/apps/example_game/lib/example/game.ex +++ b/apps/example_game/lib/example/game.ex @@ -50,9 +50,9 @@ defmodule Example.Game do gz = cz * 16 + z gy = y if rem(gx, 4) == 0 && rem(gy, 4) == 0 && rem(gz, 4) == 0 do - {abs(rem(div(gx + gy + gz, 4), 1000)), 15, 0} + {abs(rem(div(gx + gy + gz, 4), 1000)), 15, 15} else - {0, 15, 0} + {0, 15, 15} end end) end)