MineSharp.Bot 0.1.5

dotnet add package MineSharp.Bot --version 0.1.5
NuGet\Install-Package MineSharp.Bot -Version 0.1.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MineSharp.Bot" Version="0.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MineSharp.Bot --version 0.1.5
#r "nuget: MineSharp.Bot, 0.1.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MineSharp.Bot as a Cake Addin
#addin nuget:?package=MineSharp.Bot&version=0.1.5

// Install MineSharp.Bot as a Cake Tool
#tool nuget:?package=MineSharp.Bot&version=0.1.5

MineSharp.Bot

Connect and interact with Minecraft servers.
A MineSharpBot uses a MinecraftClient (see MineSharp.Protocol) to connect to a Minecraft Server.
The bot can have multiple plugins. Each plugin can handle some packets sent by the server and/or provide methods to interact with the world.

Creating Bots

A bot can be created using a MinecraftClient. To help out, you can use the BotBuilder class to fluently create a bot.

Bot Builder

  • .Host() configure the hostname
  • .Port() configure the port (default = 25565)
  • .Data() configure the MinecraftData instance
  • .AutoDetectData() (default) auto detect minecraft data version if none was configured
  • .Session() configure the session object
  • .OfflineSession() configure session to be an offline session
  • .OnlineSession() configure session to be an online session (login happens when calling Create() or CreateAsync())
  • .WithPlugin<T>() add Plugin of type T
  • .ExcludeDefaultPlugins() do not add default plugins (listed below)
  • .AutoConnect() automatically connect to the server when creating the bot
  • .WithProxy() configure a proxy
  • .CreateAsync() create a new bot with the configuration
  • .Create() equivalent of CreateAsync().Result

Plugins

A plugin can handle packets sent by the server and/or provide methods to interact with the server.

Currently, these are the plugins enabled by default:

  • Chat Plugin (Read and Write chat messages)
  • Crafting Plugin (Craft items)
  • Entity Plugin (Keeps track of entities)
  • Physics Plugin (Simulate player physics)
  • Player Plugin (Keeps track of the bot himself as well as other players and the weather)
  • Window Plugin (Bot's inventory and open chests or other blocks)
  • World Plugin (Keep track of the world)

Other plugins not enabled by default:

  • Auto Respawn (Automatically respawn when dead)

To add a plugin to the bot, bot.LoadPlugin(plugin) can be used.
To access a plugin, use bot.GetPlugin<>()

Chat Plugin
  • Handles all chat packets and provides abstraction for different minecraft versions
  • Handle and parse the CommandTree
  • โšก OnChatMessageReceived event. Fired when any chat message or game information message is received
  • ๐Ÿ“จ SendChat() method. Send a chat message to the server.
  • ๐Ÿ“ง SendCommand() method. Send a '/' command to the server. Only for mc >= 1.19
Crafting Plugin
  • ๐Ÿ”Ž FindRecipes(). Find recipes for a given item that can be crafted with the items in the bots inventory
  • ๐Ÿ”Ž FindRecipe(). Equivalent of FindRecipes().FirstOrDefault()
  • ๐Ÿ”ข CraftableAmount(). Calculate how often a recipe can be crafting with the items in the bots inventory.
  • ๐Ÿชš Craft(). Craft the given recipe n times.
Entity Plugin
  • Handles all packets regarding entities (position, effects, etc..)
  • โšก OnEntitySpawn. Fired when an entity spawned
  • โšก OnEntityDespawned. Fired when an entity despawned
  • โšก OnEntityMoved. Fired when an entity moved
  • ๐Ÿท Entities. Dictionary mapping all entities from their numerical server id to the Entity object
Physics Plugin
  • Update the bots position on the server
  • โšก BotMoved. Fired when the bot moved
  • โšก PhysicsTick. Fired after each tick of the physics simulation
  • ๐ŸŽฎ InputControls. Input controls used to control movement
  • ๐Ÿช‚ Engine. The underlying physics simulation / engine
  • โณ WaitForTicks(). Wait until a number of physics ticks are completed
  • โ›ฐ๏ธ WaitForOnGround(). Wait until the bot is on the ground
  • ๐Ÿ”ƒ ForceSetRotation(). Set the bots rotation in a single tick
  • ๐Ÿ‘“ ForceLookAt(). Look at the given position in a single tick
  • ๐Ÿ‘€ Look(). Slowly transition to the given rotation
  • ๐Ÿ‘€ LookAt(). Slowly look at the given position
  • ๐Ÿ”ซ Raycast(). Returns the block the bot is currently looking at
Player Plugin
  • Handles packets regarding the Bot entity and other players on the server
  • โšก OnHealthChanged. Fired when the bots health, food or saturation was updated.
  • โšก OnRespawed. Fired when the bot respawned or changed the dimension.
  • โšก OnDied. Fired when the bot died.
  • โšก OnPlayerJoined. Fired when another player joined the server
  • โšก OnPlayerLeft. Fired when another player left the server
  • โšก OnPlayerLoaded. Fired when another player came into the visible range of the bot and their entity was loaded.
  • โšก OnWeatherChanged. Fired when the weather has changed. (TODO: Move to WorldPlugin)
  • ๐Ÿค– Self. The MinecraftPlayer representing the bot itself
  • ๐Ÿค– Entity. The Entity representing the bot itself (equivalent of Self.Entity)
  • ๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Players. A dictionary mapping all player's uuids to their MinecraftPlayer object
  • ๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ PlayerMap. A dictionary mapping all player's numerical server id to their MinecraftPlayer object.
  • ๐Ÿ’“ Health. Health of the Bot (value between 0.0 - 20.0)
  • ๐Ÿ— Saturation. The Saturation level of the bot
  • ๐Ÿ• Food. The food level of the bot
  • ๐ŸŒ˜ Dimension. The name of the dimension the bot is currently in
  • ๐Ÿƒ IsAlive. Boolean indicating whether the bot is alive
  • ๐ŸŒง๏ธ IsRaining. Boolean indicating whether it is raining
  • โ˜” RainLevel. Float indicating how much it is raining
  • โ›ˆ๏ธ ThunderLevel. The thunder level
  • โ˜€๏ธ Respawn(). Respawn the bot if it is dead.
  • ๐Ÿ’ช SwingArm(). Plays the swing arm animation.
  • ๐Ÿคบ Attack(). Attack the given entity
Window Plugin
  • Handles packets regarding windows
  • โšก OnWindowOpened. Fired when a window opened
  • โšก OnHeldItemChanged. Fired when the held item changed
  • ๐Ÿ“ฆ Inventory. The Window representing the bots inventory
  • ๐ŸชŸ CurrentlyOpenedWindow. The window which is currently open.
  • ๐ŸŽˆ HeldItem. The Item the bot is currently holding in the main hand
  • ๐Ÿ‘‰ SelectedHotbarIndex. The index of the selected hotbar slot
  • โŒ› WaitForInventory(). Wait until the inventory's item are loaded
  • ๐Ÿงฐ OpenContainer(). Try to open the given block (eg. chest, crafting table, ...)
  • โŒ CloseWindow(). Close the window
  • ๐Ÿ‘‰ SelectHotbarIndex(). Set the selected hotbar index
  • ๐Ÿ™‹ UseItem(). Use the item the bot is currently holding
  • ๐Ÿ‘จโ€๐Ÿ”ง EquipItem(). Find and equip an item
World Plugin
  • Handles all block and chunk packets
  • ๐ŸŒ World. The world of the minecraft server
  • โณ WaitForChunks(). Wait until all chunks in a radius around the bot are loaded
  • โŒจ๏ธ UpdateCommandBlock(). Update a command block
  • โ›๏ธ MineBlock(). Mine the given block
  • ๐Ÿ‘ท PlaceBlock(). Place a block at the given position
Auto Respawn
  • Automatically respawns the bot when it died
  • โฐ๏ธ RespawnDelay. Delay before respawning
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.5 104 4/1/2024
0.1.4 136 1/26/2024
0.1.3 130 1/7/2024
0.1.2 118 12/30/2023
0.1.1 80 12/28/2023
0.1.0 101 12/28/2023