class Rosegold::Client
- Rosegold::Client
- Rosegold::EventEmitter
- Reference
- Object
Overview
Holds world state (player, chunks, etc.) and control state (physics, open window, etc.). Can be reconnected.
Defined in:
rosegold/client.crConstructors
Class Method Summary
Instance Method Summary
- #access_token : String
- #access_token=(access_token : String)
- #connect
- #connected?
- #connection : Connection::Client
- #connection=(connection : Connection::Client | Nil)
- #connection? : Connection::Client | Nil
- #dimension : Dimension
- #dimension=(dimension : Dimension)
- #host : String
- #host=(host : String)
- #interactions : Interactions
- #interactions=(interactions : Interactions)
- #inventory : PlayerWindow
- #inventory=(inventory : PlayerWindow)
-
#join_game(timeout_ticks = 1200)
Waits for the client to be fully spawned, ie.
- #join_game(*args, &)
- #offline : NamedTuple(uuid: String, username: String) | Nil
- #offline=(offline : NamedTuple(uuid: String, username: String) | Nil)
- #online_players : Hash(UUID, PlayerList::Entry)
- #online_players=(online_players : Hash(UUID, PlayerList::Entry))
- #physics : Physics
- #physics=(physics : Physics)
- #player : Player
- #player=(player : Player)
- #port : Int32
- #port=(port : Int32)
-
#queue_packet(packet : Serverbound::Packet)
Send a packet to the server concurrently.
-
#send_packet!(packet : Serverbound::Packet)
Send a packet in the current fiber.
- #spawned?
- #start_ticker
- #state=(state)
- #status
- #window : Window
- #window=(window : Window)
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)
#
Class Method Detail
Instance Method Detail
def join_game(timeout_ticks = 1200)
#
Waits for the client to be fully spawned, ie. physics and inventory being ready.
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.