class

Rosegold::Client

Inherits Rosegold::EventEmitter / Reference / Object

Forward declaration to avoid circular dependency

Constants

LATEST_PROTOCOL = 775_u32
SUPPORTED_PROTOCOLS = {772_u32, 774_u32, 775_u32}

Constructors

new(host : String, port : Int32 = 25565, offline : NamedTuple(uuid: String, username: String) | Nil = nil)
Source

Class methods

protocol_version

TODO: @@protocol_version is global state shared across all Client instances. This prevents connecting to servers with different protocol versions concurrently. To fix, protocol_version should become an instance variable set during handshake.

Source
protocol_version=(version : UInt32)
Source
protocol_version_explicit?
Source
reset_protocol_version!
Source
status(host : String, port : UInt16 = 25565)
Source

Instance methods

access_token
Source
access_token=(access_token : String)
Source
add_chunk_batch_sample(millis_per_chunk : Float64, batch_size : Int32)
Source
add_tick_steps(steps : UInt32)

Add tick steps when ticking is frozen

Source
average_millis_per_chunk
Source
chat_manager
Source
chat_manager=(chat_manager : ChatManager)
Source
chunk_batch_samples
Source
chunk_batch_samples=(chunk_batch_samples : Array(ChunkBatchSample))
Source
chunk_batch_start_time
Source
chunk_batch_start_time=(chunk_batch_start_time : Time | Nil)
Source
clear_cookies
Source
connect
Source
connected?
Source
connection

Internal engine state — not exposed through Bot API. Protected: accessible within Rosegold:: namespace only.

Source
connection?
Source
container_menu
Source
container_menu=(container_menu : Menu)
Source
cookies
Source
cookies=(cookies : Hash(String, Bytes))
Source
current_protocol_state
Source
current_protocol_state=(current_protocol_state : ProtocolState)
Source
disconnect(*args, **options)
Source
disconnect(*args, **options, &)
Source
host
Source
host=(host : String)
Source
inventory_menu
Source
inventory_menu=(inventory_menu : PlayerMenu)
Source
join_game(timeout_ticks = 1200)

Waits for the client to be fully spawned, ie. physics and inventory being ready.

Source
join_game(*args, &)
Source
known_packs
Source
known_packs=(known_packs : Array(NamedTuple(namespace: String, id: String, version: String)))
Source
next_sequence
Source
offline
Source
offline=(offline : NamedTuple(uuid: String, username: String) | Nil)
Source
pending_block_operations
Source
pending_block_operations=(pending_block_operations : Hash(Int32, BlockOperation))
Source
pending_tick_steps
Source
pending_tick_steps=(pending_tick_steps : UInt32)
Source
player
Source
player=(player : Player)
Source
player_inventory
Source
player_inventory=(player_inventory : PlayerInventory)
Source
player_list
Source
player_list=(player_list : Hash(UUID, PlayerList::Entry))
Source
port
Source
port=(port : Int32)
Source
protocol_version
Source
queue_packet(packet : Serverbound::Packet)

Send a packet to the server concurrently.

Source
recipe_registry
Source
recipe_registry=(recipe_registry : RecipeRegistry)
Source
registries
Source
registries=(registries : Hash(String, Clientbound::RegistryData))
Source
send_packet!(packet : Serverbound::Packet)

Send a packet in the current fiber. Useful for things like EncryptionRequest, because it must change the IO socket only AFTER a EncryptionResponse has been sent.

Source
sequence_counter
Source
sequence_counter=(sequence_counter : Int32)
Source
set_protocol_state(protocol_state : ProtocolState)
Source
spawned?
Source
start_ticker
Source
state=(state)

Legacy method - deprecated, use set_protocol_state instead

Source
status
Source
tags
Source
tags=(tags : Clientbound::UpdateTags | Nil)
Source
tick_interval

Calculate tick interval based on current tick rate Vanilla client never ticks faster than 20 TPS (Minecraft.java:getTickTargetMillis)

Source
tick_rate
Source
tick_rate=(tick_rate : Float32)
Source
ticker_done
Source
ticker_done=(ticker_done : Channel(Nil))
Source
ticking_frozen
Source
ticking_frozen=(ticking_frozen : Bool)
Source
transfer_to(new_host : String, new_port : UInt32)
Source
update_ticking_state(new_tick_rate : Float32, frozen : Bool)

Update client ticking state from server

Source
wait_tick
Source
wait_ticks(ticks : Int32)
Source

Nested types