Rosegold::Bot
Inherits Rosegold::EventEmitter / Reference / Object
Constructors
Class methods
Connects to the server and waits for being ingame.
Instance methods
Looks in the direction of target, then
activates and immediately deactivates the attack button.
Craft by manually placing items into the grid. Use this for custom/modded recipes or when the recipe book doesn't have what you need.
bot.craft_pattern([
["iron_ingot", "iron_ingot", "iron_ingot"],
[nil, "stick", nil],
[nil, "stick", nil],
])
Looks in the direction of target, then
activates the attack button, waits ticks, and deactivates it again.
Estimates how many ticks it will take this bot to break the named block.
Uses the bot's current main-hand item and live player state (Haste,
gamemode, on_ground, etc.), so the estimate reflects what the bot would
actually experience right now — not a fresh Player.new baseline.
buffer_ticks is added on top of the computed mining time to absorb network latency and server tick variance; tune it down to 0 for a pure client-side estimate, or up if you're seeing the bot release dig too early.
Raises ArgumentError if block_name isn't in the active version's MCData.
bot.estimated_break_ticks("stone") # => e.g. 160
bot.estimated_break_ticks("stone", buffer_ticks: 0) # => e.g. 150
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.
Moves straight towards the exact location (decimal coordinates are
honored verbatim).
Waits for arrival.
stuck_timeout_ticks specifies how many consecutive stuck ticks before throwing MovementStuck.
Moves to the center of the given block coordinate (x + 0.5,
z + 0.5), preserving the bot's current feet y. Use a Vec3d overload
if you need to land on an exact non-centered position.
Moves straight towards the exact (x, z) (decimal coordinates are
honored verbatim). y is taken from the bot's current feet location.
Waits for arrival.
stuck_timeout_ticks specifies how many consecutive stuck ticks before throwing MovementStuck.
Moves to the center of the given block column (x + 0.5, z + 0.5).
Use the Float overload to target an exact non-centered position.
Computes the destination location from the current feet location.
Moves straight towards the destination.
Waits for arrival.
stuck_timeout_ticks specifies how many consecutive stuck ticks before throwing MovementStuck.
Opens a container (chest, barrel, etc.) and yields control for interaction. Automatically uses the main hand, waits for container content to load, executes the provided block, then closes the container.
bot.open_container do
bot.inventory.deposit_at_least(10, "diamond")
bot.inventory.withdraw_at_least(5, "emerald")
end
Caller must already be looking at the container block.
Opens a container and yields a ContainerHandle for typed interaction. The handle provides intent-level operations (withdraw, deposit) and typed menu access (as_chest, as_furnace, etc.).
bot.open_container_handle do |handle|
handle.deposit("diamond", 10)
handle.withdraw("emerald", 5)
if chest = handle.as_chest
chest.contents.each { |slot| puts slot.name }
end
end
Caller must already be looking at the container block.
Pick the item at the given block position (middle-click on a block). The server finds the matching item in the player's inventory, moves it to the hotbar, and sends the appropriate slot update packets.
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.
Runs a slash command and waits for a confirmation message from the server.
Use this for non-idempotent commands (like toggles) or when you want to force retries on idempotent commands until confirmation. Retries automatically if the command fails or returns an inverse message.
The expected_message is matched after stripping formatting codes. If inverse_message is provided and received, the command will retry, which is useful for toggle commands where the bot may be in the wrong state.
Returns true if the expected message is received within max_tries
attempts, false otherwise.
bot.run_command_with_confirmation(
"/ignoregroup !",
"You stopped ignoring !.",
3,
"You are now ignoring !"
)
Looks at that target, then activates the attack button.
Stop moving towards the target specified in #move_to Also releases all movement keys and dequeues any pending jump.
Looks in the direction of target, then
activates and immediately deactivates the use button.