This commit is contained in:
parent
29014aa45f
commit
47bb453178
@ -135,6 +135,10 @@ defmodule Amethyst.ConnectionState.Play do
|
|||||||
Macros.defpacket_clientbound :set_center_chunk, 0x54, 767, [
|
Macros.defpacket_clientbound :set_center_chunk, 0x54, 767, [
|
||||||
chunk_x: :varint, chunk_z: :varint
|
chunk_x: :varint, chunk_z: :varint
|
||||||
]
|
]
|
||||||
|
Macros.defpacket_clientbound :system_chat_message, 0x6C, 767, [
|
||||||
|
content: :nbt,
|
||||||
|
overlay: :bool
|
||||||
|
]
|
||||||
|
|
||||||
Macros.defpacket_clientbound :game_event, 0x22, 767, [
|
Macros.defpacket_clientbound :game_event, 0x22, 767, [
|
||||||
event: :ubyte, value: :float
|
event: :ubyte, value: :float
|
||||||
|
@ -5,6 +5,8 @@ defmodule Example.Game do
|
|||||||
@moduledoc """
|
@moduledoc """
|
||||||
Example game used for testing Amethyst.
|
Example game used for testing Amethyst.
|
||||||
"""
|
"""
|
||||||
|
require Amethyst.NBT.Write
|
||||||
|
alias Amethyst.NBT
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def instantiate(supervisor) do
|
def instantiate(supervisor) do
|
||||||
@ -42,6 +44,11 @@ defmodule Example.Game do
|
|||||||
@impl true
|
@impl true
|
||||||
def chat(from, message, _state_refs) do
|
def chat(from, message, _state_refs) do
|
||||||
Logger.info("Player at #{inspect(from)} said: #{inspect(message)}")
|
Logger.info("Player at #{inspect(from)} said: #{inspect(message)}")
|
||||||
|
send(from, {:send_packet, %{
|
||||||
|
packet_type: :system_chat_message,
|
||||||
|
content: NBT.Write.compound(%{"text" => NBT.Write.string("You said: #{message}")}),
|
||||||
|
overlay: false
|
||||||
|
}})
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user