class Rosegold::Bot
- Rosegold::Bot
- Rosegold::EventEmitter
- Reference
- Object
Defined in:
rosegold/bot.crConstructors
Class Method Summary
-
.join_game(address : String, timeout_ticks = 1200)
Connects to the server and waits for being ingame.
Instance Method Summary
-
#attack(target : Vec3d | Nil | Look | Nil = nil)
Looks in the direction of target, then activates and immediately deactivates the
#attack
button. -
#chat(message : String)
Send a message or slash command.
- #connect(*args, **options)
- #connect(*args, **options, &)
- #connected?(*args, **options)
- #connected?(*args, **options, &)
- #dead?
-
#dig(ticks : Int32, target : Vec3d | Nil | Look | Nil = nil)
Looks in the direction of target, then activates the
#attack
button, waitsticks
, and deactivates it again. - #disconnect(*args, **options)
- #disconnect(*args, **options, &)
- #disconnect_reason
- #drop_hand_full
- #drop_hand_single
- #eat!
- #eyes(*args, **options)
- #eyes(*args, **options, &)
- #feet(*args, **options)
- #feet(*args, **options, &)
- #food(*args, **options)
- #food(*args, **options, &)
- #full_health?
- #gamemode(*args, **options)
- #gamemode(*args, **options, &)
- #health(*args, **options)
- #health(*args, **options, &)
- #host(*args, **options)
- #host(*args, **options, &)
-
#hotbar_selection
The active (main hand) hotbar slot number (1-9).
-
#hotbar_selection=(index : UInt8)
Selects the active (main hand) hotbar slot number (1-9).
- #inventory : Inventory
- #join_game(*args, **options)
- #join_game(*args, **options, &)
-
#jump_by_height(height = 1, timeout_ticks = 20)
Jumps and waits until the bot is
height
above the ground. -
#land_on_ground(timeout_ticks = 120)
Waits until the bot's y level stops changing.
-
#leave_bed
Use #interact_block to enter a bed.
-
#look
Direction the player is looking.
-
#look(&block : Look -> Look)
Computes the new look from the current look.
-
#look=(look : Look)
Waits for the new look to be sent to the server.
-
#look=(vec : Vec3d)
Waits for the new look to be sent to the server.
-
#look_at(location : Vec3d)
Waits for the new look to be sent to the server.
-
#look_at_horizontal(location : Vec3d)
Ignores y coordinate; useful for looking straight while moving.
- #main_hand(*args, **options)
- #main_hand(*args, **options, &)
-
#move_to(x : Float, z : Float)
Moves straight towards
location
. - #move_to(x : Int, y : Int)
-
#move_to(location : Vec3d)
Moves straight towards
location
. -
#move_to(&block : Vec3d -> Vec3d)
Computes the destination location from the current feet location.
-
#new(address : String)
Does not connect immediately.
- #online_players(*args, **options)
- #online_players(*args, **options, &)
-
#pick_slot(slot_number : UInt16)
Moves the slot to the hotbar and selects it.
- #pitch
-
#pitch=(pitch : Float64)
Sets the pitch of the look Waits for the new look to be sent to the server
-
#place_block_against(block : Vec3i, face : BlockFace)
Looks at that face of that block, then activates and immediately deactivates the
use
button. - #port(*args, **options)
- #port(*args, **options, &)
-
#respawn(timeout_ticks = 1200)
Revive the player if dead.
- #saturation(*args, **options)
- #saturation(*args, **options, &)
- #sneak(*args, **options)
- #sneak(*args, **options, &)
- #sneaking?(*args, **options)
- #sneaking?(*args, **options, &)
- #spawned?(*args, **options)
- #spawned?(*args, **options, &)
- #sprint(*args, **options)
- #sprint(*args, **options, &)
- #sprinting?(*args, **options)
- #sprinting?(*args, **options, &)
-
#start_digging(target : Vec3d | Nil | Look | Nil = nil)
Looks at that target, then activates the
#attack
button. -
#start_jump
Jumps the next time the player is on the ground.
-
#start_using_hand(hand : Hand = :main_hand)
Activates the "use" button.
- #stop_digging(*args, **options)
- #stop_digging(*args, **options, &)
-
#stop_moving
Stop moving towards the target specified in #move_to Dequeue any jump queued with #start_jump
- #stop_using_hand(*args, **options)
- #stop_using_hand(*args, **options, &)
- #subscribe(event_class : Class)
- #swap_hands
- #unsneak
- #unsprint
-
#use_hand(target : Vec3d | Nil | Look | Nil = nil, hand : Hand = :main_hand)
Looks in the direction of
target
, then activates and immediately deactivates theuse
button. - #username(*args, **options)
- #username(*args, **options, &)
- #uuid(*args, **options)
- #uuid(*args, **options, &)
- #wait_tick
- #wait_ticks(ticks : Int32)
- #x(*args, **options)
- #x(*args, **options, &)
- #y(*args, **options)
- #y(*args, **options, &)
- #yaw
-
#yaw=(yaw : Float64)
Sets the yaw of the look Waits for the new look to be sent to the server
- #z(*args, **options)
- #z(*args, **options, &)
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
Class Method Detail
Connects to the server and waits for being ingame.
Instance Method Detail
Looks in the direction of target, then
activates and immediately deactivates the #attack
button.
Looks in the direction of target, then
activates the #attack
button, waits ticks
, and deactivates it again.
Jumps and waits until the bot is height
above the ground.
Fails if the bot lands before reaching this height.
Computes the new look from the current look. Waits for the new look to be sent to the server.
Ignores y coordinate; useful for looking straight while moving. Waits for the new look to be sent to the server.
Computes the destination location from the current feet location. Moves straight towards the destination. Waits for arrival.
Moves the slot to the hotbar and selects it. This is faster and less error-prone than moving slots around individually.
Sets the pitch of the look Waits for the new look to be sent to the server
Looks at that face of that block, then activates and immediately deactivates the use
button.
Looks at that target, then activates the #attack
button.
Stop moving towards the target specified in #move_to Dequeue any jump queued with #start_jump
Looks in the direction of target
, then
activates and immediately deactivates the use
button.