Forum: gaming.stackexchange.com
Tags: <minecraft-java-edition>
Title: Is it possible to script Minecraft?
Question: Being a programmer doing tedious tasks always make me want to script it.  Is there a way to intelligently script Minecraft, reacting to the surroundings.Something like do this sequence of digging until something interesting happens?

Answers:
sents: text: In terms of automation, I've found quite a few interesting articles concerning using Autohotkey with Minecraft.
text: Here's a nice forum thread for example .
text: Obviously this isn't enough to react to what's happening in the game, the only way to do that is via a mod (I can't find any scripting mods), but it'll still allow for longer Minecraft sessions before the RSI kicks in.
answer_details: author: gaming.stackexchange.com/users/3610/fredley
score: 9
sents: text: The only possibility I know of would by Scripting via the mod WorldEdit
text: (available both SSP and SMP via bukkit ).
text: It's using JavaScript for Scripts .
text: You can of course also figure out modding itself, using Java, which allows you to do anything .
text: But be aware that Notch apparently re-obfuscates the code from version to version...
answer_details: author: gaming.stackexchange.com/users/88/Zommuter
score: 6
sents: text: There is no scripting interface for Minecraft, however Notch mentioned he plans to add support for official mods which then you can make Minecraft do whatever you want, even to the point of writing your own scripting engine.
answer_details: author: gaming.stackexchange.com/users/4393/Resorath
score: 5
sents: text: Not really.
text: You could try making a mod that adds a scripting interface, but I'm pretty sure it would require enough code that it would make more sense to just do the stuff yourself.
text: You might want to check out the MineColony mod if you just want resources gathered.
answer_details: author: gaming.stackexchange.com/users/10000/Tmas
score: 4
sents: text: Without an official and stable modding api, much effort for similar goals is wasted on reverse engineering and clearing up the messy architecture.
text: Golem was an attempt at creating such automation but it is broken because Notch changes stuff.
text: Things will be much better if Notch releases his modding api.
answer_details: author: gaming.stackexchange.com/users/9437/xfs
score: 3
sents: text: You can run a local server, install Bukkit, and code in Java against that.
text: Bukkit's a fairly flexible platform, but anything written against it will be a server-side plugin not client-side.
text: The distinction's a bit blurry when you're playing alone, so this might not give you everything you want to be able to do.
answer_details: author: gaming.stackexchange.com/users/9778/Michael Burge
score: 2
sents: text: Absolutely!
text: Look into ComputerCraft or OpenComputers.
text: They are mods available for Minecraft.
text: Both require the Forge Modloader.
text: All three are free.
text: ComputerCraft allows you to automate almost anything imaginable using Lua-scripted robots that you make and program in-game.
text: OpenComputers is pretty much the same but is thought to be more balanced and uses Scala instead of Lua.
text: ComputerCraft offers ways to connect stationary computers, to copy files on disks that act as in-game items, even ways to create wired and wireless in-game networks.
text: They are absolutely great tools for teaching kids programming.
text: The Lua API for ComputerCraft is simple and robust.
text: Buckets, shears, you name it, ComputerCraft can handle it.
text: Enjoy!
answer_details: author: gaming.stackexchange.com/users/100971/MinecraftPlayer
score: 2
sents: text: The (somewhat unimaginatively named) " Macro / Keybind Mod " is a client side mod that makes it possible to write relatively complex scripts which you can execute on any server (eg. vanilla).
text: It's currently awaiting an update to Minecraft 1.7 though
text: (however it is normally only a few weeks behind when new versions come out).
text: I have used it to write tree-farming and wheat-farming scripts.
text: Some people have written automatic miners too.
text: My most complex script got bones from a skeleton drop farm, crafted them into bonemeal, used the bonemeal to make wheat, and then traded the wheat with a villager for emerald.
answer_details: author: gaming.stackexchange.com/users/67201/pix
score: 1
sents: text: This is not a direct answer to your question, but it's an example of scripting in Minecraft.
text: If you haven't heard about the Baritone Project
text: I'll leave a link here: https://github.com/cabaletta/baritone
text: This is more or less like a program that can control your character inside the game to do various tasks.
text: I haven't really used it
text: but I've seen various videos of people using it on Youtube, for example, here I leave a link about a youtube that plays in the 2B2T server and talks about the Baritone Project as a way to use it in the server:
text: There are more related videos over the platform, and the first link I put has the code of the program, maybe there you could see what the people did in order to use scripts in Minecraft.
answer_details: author: gaming.stackexchange.com/users/235034/ja123mano
score: 1

Summary of the answers:
You can run a local server, install Bukkit and code in Java. You could also try WorldEdit, ComputerCraft or OpenComputers which require Forge Modloader.
While there are available programmes for scripting Minecraft, there seems to be a lack of this feature from the provider of the game.