class Rosegold::Bot

Defined in:

rosegold/bot.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(client : Rosegold::Client) #

[View source]

Class Method Detail

def self.join_game(address : String, timeout_ticks = 1200) #

Connects to the server and waits for being ingame.


[View source]

Instance Method Detail

def attack(target : Vec3d | Nil | Look | Nil = nil) #

Looks in the direction of target, then activates and immediately deactivates the #attack button.


[View source]
def chat(message : String) #

Send a message or slash command.


[View source]
def connect(*args, **options) #

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

[View source]
def connected?(*args, **options) #

[View source]
def connected?(*args, **options, &) #

[View source]
def dead? #

[View source]
def dig(ticks : Int32, target : Vec3d | Nil | Look | Nil = nil) #

Looks in the direction of target, then activates the #attack button, waits ticks, and deactivates it again.


[View source]
def disconnect(*args, **options) #

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

[View source]
def disconnect_reason #

[View source]
def drop_hand_full #

[View source]
def drop_hand_single #

[View source]
def eat! #

[View source]
def eyes(*args, **options) #

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

[View source]
def feet(*args, **options) #

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

[View source]
def food(*args, **options) #

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

[View source]
def full_health? #

[View source]
def gamemode(*args, **options) #

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

[View source]
def health(*args, **options) #

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

[View source]
def host(*args, **options) #

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

[View source]
def hotbar_selection #

The active (main hand) hotbar slot number (1-9).


[View source]
def hotbar_selection=(index : UInt8) #

Selects the active (main hand) hotbar slot number (1-9).


[View source]
def inventory : Inventory #

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

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

[View source]
def jump_by_height(height = 1, timeout_ticks = 20) #

Jumps and waits until the bot is height above the ground. Fails if the bot lands before reaching this height.


[View source]
def land_on_ground(timeout_ticks = 120) #

Waits until the bot's y level stops changing.


[View source]
def leave_bed #

Use #interact_block to enter a bed.


[View source]
def look #

Direction the player is looking.


[View source]
def look(&block : Look -> Look) #

Computes the new look from the current look. Waits for the new look to be sent to the server.


[View source]
def look=(look : Look) #

Waits for the new look to be sent to the server.


[View source]
def look=(vec : Vec3d) #

Waits for the new look to be sent to the server.


[View source]
def look_at(location : Vec3d) #

Waits for the new look to be sent to the server.


[View source]
def look_at_horizontal(location : Vec3d) #

Ignores y coordinate; useful for looking straight while moving. Waits for the new look to be sent to the server.


[View source]
def main_hand(*args, **options) #

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

[View source]
def move_to(x : Float, z : Float) #

Moves straight towards location. Waits for arrival.


[View source]
def move_to(x : Int, y : Int) #

[View source]
def move_to(location : Vec3d) #

Moves straight towards location. Waits for arrival.


[View source]
def move_to(&block : Vec3d -> Vec3d) #

Computes the destination location from the current feet location. Moves straight towards the destination. Waits for arrival.


[View source]
def new(address : String) #

Does not connect immediately.


[View source]
def online_players(*args, **options) #

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

[View source]
def pick_slot(slot_number : UInt16) #

Moves the slot to the hotbar and selects it. This is faster and less error-prone than moving slots around individually.


[View source]
def pitch #

[View source]
def pitch=(pitch : Float64) #

Sets the pitch of the look Waits for the new look to be sent to the server


[View source]
def place_block_against(block : Vec3i, face : BlockFace) #

Looks at that face of that block, then activates and immediately deactivates the use button.


[View source]
def port(*args, **options) #

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

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

Revive the player if dead. Does nothing if alive.


[View source]
def saturation(*args, **options) #

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

[View source]
def sneak(*args, **options) #

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

[View source]
def sneaking?(*args, **options) #

[View source]
def sneaking?(*args, **options, &) #

[View source]
def spawned?(*args, **options) #

[View source]
def spawned?(*args, **options, &) #

[View source]
def sprint(*args, **options) #

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

[View source]
def sprinting?(*args, **options) #

[View source]
def sprinting?(*args, **options, &) #

[View source]
def start_digging(target : Vec3d | Nil | Look | Nil = nil) #

Looks at that target, then activates the #attack button.


[View source]
def start_jump #

Jumps the next time the player is on the ground.


[View source]
def start_using_hand(hand : Hand = :main_hand) #

Activates the "use" button.


[View source]
def stop_digging(*args, **options) #

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

[View source]
def stop_moving #

Stop moving towards the target specified in #move_to Dequeue any jump queued with #start_jump


[View source]
def stop_using_hand(*args, **options) #

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

[View source]
def subscribe(event_class : Class) #

[View source]
def swap_hands #

[View source]
def unsneak #

[View source]
def unsprint #

[View source]
def use_hand(target : Vec3d | Nil | Look | Nil = nil, hand : Hand = :main_hand) #

Looks in the direction of target, then activates and immediately deactivates the use button.


[View source]
def username(*args, **options) #

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

[View source]
def uuid(*args, **options) #

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

[View source]
def wait_tick #

[View source]
def wait_ticks(ticks : Int32) #

[View source]
def x(*args, **options) #

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

[View source]
def y(*args, **options) #

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

[View source]
def yaw #

[View source]
def yaw=(yaw : Float64) #

Sets the yaw of the look Waits for the new look to be sent to the server


[View source]
def z(*args, **options) #

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

[View source]