class Rosegold::Client

Overview

Holds world state (player, chunks, etc.) and control state (physics, open window, etc.). Can be reconnected.

Defined in:

rosegold/client.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Rosegold::EventEmitter

emit_event(event : Event) emit_event, event_handlers : Handlers event_handlers, off(event_type : T.class, id : UUID) forall T off, on(event_type : T.class, id : UUID = UUID.random, &block : T -> ) forall T on, once(event_type : T.class, &block : T -> ) forall T once, wait_for(event_type : T.class, timeout : Time::Span | Nil = nil) forall T wait_for

Constructor Detail

def self.new(host : String, port : Int32 = 25565, offline : NamedTuple(uuid: String, username: String) | Nil = nil) #

[View source]

Class Method Detail

def self.protocol_version #

[View source]
def self.status(host : String, port : UInt16 = 25565) #

[View source]

Instance Method Detail

def access_token : String #

[View source]
def access_token=(access_token : String) #

[View source]
def connect #

[View source]
def connected? #

[View source]
def connection : Connection::Client #

[View source]
def connection=(connection : Connection::Client | Nil) #

[View source]
def connection? : Connection::Client | Nil #

[View source]
def dimension : Dimension #

[View source]
def dimension=(dimension : Dimension) #

[View source]
def host : String #

[View source]
def host=(host : String) #

[View source]
def interactions : Interactions #

[View source]
def interactions=(interactions : Interactions) #

[View source]
def inventory : PlayerWindow #

[View source]
def inventory=(inventory : PlayerWindow) #

[View source]
def join_game(timeout_ticks = 1200) #

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


[View source]
def join_game(*args, &) #

[View source]
def offline : NamedTuple(uuid: String, username: String) | Nil #

[View source]
def offline=(offline : NamedTuple(uuid: String, username: String) | Nil) #

[View source]
def online_players : Hash(UUID, PlayerList::Entry) #

[View source]
def online_players=(online_players : Hash(UUID, PlayerList::Entry)) #

[View source]
def physics : Physics #

[View source]
def physics=(physics : Physics) #

[View source]
def player : Player #

[View source]
def player=(player : Player) #

[View source]
def port : Int32 #

[View source]
def port=(port : Int32) #

[View source]
def queue_packet(packet : Serverbound::Packet) #

Send a packet to the server concurrently.


[View source]
def 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.


[View source]
def spawned? #

[View source]
def start_ticker #

[View source]
def state=(state) #

[View source]
def status #

[View source]
def window : Window #

[View source]
def window=(window : Window) #

[View source]