{"id":13468915,"url":"https://github.com/walterhiggins/ScriptCraft","last_synced_at":"2025-03-26T05:31:33.038Z","repository":{"id":6112291,"uuid":"7340075","full_name":"walterhiggins/ScriptCraft","owner":"walterhiggins","description":"Write Minecraft Plugins in JavaScript.","archived":false,"fork":false,"pushed_at":"2021-08-27T15:07:55.000Z","size":150649,"stargazers_count":1842,"open_issues_count":89,"forks_count":379,"subscribers_count":101,"default_branch":"development","last_synced_at":"2024-10-29T22:56:50.835Z","etag":null,"topics":["coderdojo","javascript","minecraft-mod","scriptcraft-mod"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/walterhiggins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-27T12:27:26.000Z","updated_at":"2024-10-18T09:38:27.000Z","dependencies_parsed_at":"2022-07-12T15:03:04.945Z","dependency_job_id":null,"html_url":"https://github.com/walterhiggins/ScriptCraft","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterhiggins%2FScriptCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterhiggins%2FScriptCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterhiggins%2FScriptCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterhiggins%2FScriptCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walterhiggins","download_url":"https://codeload.github.com/walterhiggins/ScriptCraft/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245597404,"owners_count":20641869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coderdojo","javascript","minecraft-mod","scriptcraft-mod"],"created_at":"2024-07-31T15:01:21.803Z","updated_at":"2025-03-26T05:31:27.996Z","avatar_url":"https://github.com/walterhiggins.png","language":"JavaScript","readme":"# ScriptCraft - Modding Minecraft with Javascript\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/walterhiggins/ScriptCraft?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\nScriptCraft lets you write Minecraft Mods using Javascript - a\nprogramming language that's relatively easy to learn and use.\nScriptCraft is a Minecraft Server plugin which means it must be used\nwith a Minecraft server. Once you've downloaded and installed the\nMinecraft Server, then installed the ScriptCraft Plugin you can write\nyour own Minecraft mods using Javascript.\n\nI created ScriptCraft to make it easier for younger programmers to\ncreate their own Minecraft Mods. Mods are written using the\nJavaScript programming language. Once the ScriptCraft mod is\ninstalled, you can add your own new Mods by adding JavaScript (.js)\nfiles in a directory.\n\n * If you're new to programming and want to start modding Minecraft, then [Start Here][yp].\n * If you've already used [Scratch][scr], have attended a few\n   [CoderDojo][cd] sessions, or have already dabbled with JavaScript,\n   then [Start Here][cda].\n * Watch some [demos][ytpl] of what you can do with ScriptCraft.\n\nThis is a simple mod in a file called greet.js in the scriptcraft/plugins directory:\n\n```javascript\nfunction greet( player ) {\n  echo( player, 'Hello ' + player.name );\n}\nexports.greet = greet;\n```\n\nAt the in-game prompt, type:\n\n```javascript\n/js greet(self)\n```\n\nAnything you can do using the Spigot or CanaryMod APIs in Java,\nyou can do using ScriptCraft in JavaScript.\n\n# Description\n\nScriptCraft is a plugin for Minecraft Servers which lets operators,\nadministrators and plug-in authors customize the game using\nJavaScript.  ScriptCraft makes it easier to create your own mods. Mods\ncan be written in Javscript and can use the full [SpigotMC\nAPI][spigot] or [CanaryMod API][cm]. ScriptCraft works with all of the\nfollowing Minecraft Server software:\n\n* [SpigotMC][spigot] (Recommended)\n* [GlowStone][gs] \n* [CanaryMod][cm] \n\n[spigot]: http://www.spigotmc.org/\n[gs]: http://www.glowstone.net/\n[cm]: http://canarymod.net/\n\nI recommend using SpigotMC because both CanaryMod and CraftBukkit are\nno longer being actively developed. The ScriptCraft mod also lets you\nenter javascript commands at the in-game prompt.  To bring up the\nin-game prompt press the `/` key then type `js ` followed by any\njavascript statement.  For example: `/js 1 + 1` will print 2.\n\nScriptCraft also includes many objects and functions to make building\nand modding easier using JavaScript. The JavaScript `Drone` object\nbundled with ScriptCraft provides an easy way to build at-scale in\nMinecraft. See the attached [temple.js][temple] file for an example\nof how you can use the sample Drone plugin to create new buildings in\nMinecraft.\n\n[drone]: https://github.com/walterhiggins/ScriptCraft/tree/master/src/main/javascript/drone/drone.js\n[cottage]: https://github.com/walterhiggins/ScriptCraft/tree/master/src/main/js/plugins/drone/contrib/cottage.js\n[temple]: https://github.com/walterhiggins/ScriptCraft/blob/master/src/main/js/plugins/drone/contrib/temple.js\n[bukkit]: http://dl.bukkit.org/\n\n# Prerequisites\n\nScriptCraft is a Minecraft Server Mod which only works with Minecraft\nfor Personal computers (Windows, Mac and Linux). It does not work with\nX-BOX, Playstation or WiiU versions of the game. You will need to have\nJava version 7 or later installed. Check the version by typing `java \n-version` at a command prompt.\n\n# Installation\n\nBefore installing ScriptCraft you must first install SpigotMC which is\na special version of Minecraft Server that makes it easy to customize\nthe game.\n\n## Installing and Running SpigotMC\n\nFollow these steps to download and install SpigotMC.\n\n1. Download Spigot's [BuildTools.jar][spigotdl] \n2. Save the BuildTools.jar file to a new directory called spigotmc.\n3. Open a terminal (Mac and Linux) or command prompt (windows) window and type `java -jar BuildTools.jar`. This will kick off a long series of commands to \"build\" SpigotMC.\n4. When the build is done, there will be a new file beginning with `spigot` and ending in `.jar` in the spigotmc directory. Run this file by typing `java -jar spigot-1.10.2.jar` (it might not be that exact name - you can list files in the directory by typing `dir` (Windows) or `ls` (Mac and Linux).\n5. The server will start up then shut down very shortly afterwards. You'll need to edit a file called `eula.txt` - change `eula=false` to `eula=true` and save the file.\n6. Run the `java -jar spigot-1.10.2.jar` command again - this time the server will start up. Shut it down by typing `stop` at the server prompt.\n\n## Installing ScriptCraft\n\nFollow these steps to download and install ScriptCraft.\n\n1. Download the [scriptcraft.jar][dl] plugin and save it to the `plugins` directory and restart the server by typing `java -jar spigot-1.10.2.jar`.\n2. At the server prompt type `js 1 + 1` and hit enter. The result `2` should be displayed. \n\nCongratulations - you've just installed your Custom Minecraft Server and are ready to begin writing your first mod!\n\n# Post Install\n\nOnce installed, a new scriptcraft/plugins directory is automatically\ncreated.  All files in the scriptcraft/plugins directory will be\nautomatically loaded when the server starts.  *Only players who are\nops can use this plugin.* You can grant a player `op` privileges by\ntyping 'op \u003cusername\u003e' (replacing \u003cusername\u003e with your own Minecraft\nuser name) at the server console prompt or by adding the player's\nusername to the ops.txt file in your server directory.\n\nLaunch the server, then launch the Minecraft client and create a new\nserver connection. The IP address will be `localhost` . Once you've\nconnected to your server and have entered the game, look at a\nground-level block and type:\n\n    /js up().box( blocks.wool.black, 4, 9, 1 )\n\n\u0026hellip; This will create a black monolith structure 4 blocks wide by 9\nblocks high by 1 block long.  Take a look at the\nsrc/main/javascript/drone/drone.js file to see what ScriptCraft's\ndrone can do.  \n\nIf you're interested in customizing minecraft beyond just creating new buildings, take a look at [the homes mod][homes] for an example of how to create a more fully-featured JavaScript plugin for Minecraft.\n\n## Your first mod - Howling blocks\nListed below is a simple mod that will make blocks 'Howl' when they're broken. \n\n``` javascript\n// copy and paste this code to a new file named 'scriptcraft/plugins/howling-blocks.js'\nvar sounds = require('sounds');\nfunction howl(event){\n  sounds.entityWolfHowl( event.block );\n}\nevents.blockBreak( howl );\n``` \n\nIf you're using CanaryMod instead of SpigotMC you can [download the equivalent code](https://gist.github.com/walterhiggins/69cddd15160d803fb096).\n\nA JavaScript mod for minecraft is just a JavaScript source file (.js)\nlocated in the scriptcraft/plugins directory. All .js files in this\ndirectory will be automatically loaded when the server starts. \n\nTo get started writing your own mod, take a look at some of the\n[examples][examples].\n\n[homes]: src/main/js/plugins/homes/homes.js\n[examples]: src/main/js/plugins/examples/\n\n# Additional information\n\nBecause the SpigotMC API is open, all of the SpigotMC API is accessible\nvia javascript once the ScriptCraft plugin is loaded. There are a\ncouple of useful Java objects exposed via javascript in the\nScriptCraft plugin:\n\n * `__plugin` \u0026ndash; the ScriptCraft Plugin itself. This is a useful\n   starting point for accessing other SpigotMC objects. The `__plugin`\n   object is of type [org.bukkit.plugin.Plugin][api] and all\n   of its properties and methods are accessible. For example: `js\n   __plugin.name` returns the plugin's name\n   (JavaScript is more concise than the equivalent Java code:\n   `__plugin.getName()` ).\n\n * `server` \u0026ndash; The top-level org.bukkit.Server object. See the [SpigotMC API docs][spigotapi] for reference.\n\n * `self` \u0026ndash; The player/command-block or server console operator who\n   invoked the `/js` command. Again, this is a good jumping off point for\n   diving into the SpigotMC API.\n\n[dl]: https://github.com/walterhiggins/ScriptCraft/releases/latest\n[api]: https://hub.spigotmc.org/javadocs/spigot/\n[ic]: http://canarymod.net/releases\n[spigotdl]: https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar\n[cmapi]: https://ci.visualillusionsent.net/job/CanaryLib/javadoc/\n[spigotapi]: https://hub.spigotmc.org/javadocs/spigot/\n\n# Contributing\n\nIf you would like to contribute source code and/or documentation changes please [read contributing.md][contrib]\n\n## Status\n\n[![Travis Build Status](https://api.travis-ci.org/walterhiggins/ScriptCraft.png)](http://travis-ci.org/walterhiggins/ScriptCraft)\n\n# Bukkit Configuration \n## (You can ignore this if using CanaryMod)\n\nScriptCraft works with Bukkit Plugin and uses the Bukkit Configuration\nAPI. On first loading, ScriptCraft will create a config.yml file in\nthe plugins/scriptcraft/ directory. This file looks like this:\n\n    extract-js:\n      plugins: true\n      modules: true\n      lib: true\n\nThis file allows scriptcraft admins to turn on or off re-unzipping of the `modules`,\n`plugins` and `lib` folders when deploying a new version of\nScriptCraft. It's strongly recommended that the `lib` directory always\nbe set to true to get the latest core ScriptCraft code . The modules\nand plugins directories are optional and not part of ScriptCraft core.\n\n# Further Reading\n\n * To get started using ScriptCraft to Learn JavaScript, read [The Young Person's Guide to Programming in Minecraft][yp].\n * The ScriptCraft [API documentation][api].\n * To delve deeper into creating your own minecraft mod for use by others, read [Creating a complete Minecraft Mod in JavaScript][mm].\n * Take a look at some [examples][ex].\n * Buy the Official ScriptCraft Book [A Beginner's Guide to Writing Minecraft Plugins in Javascript][book].\n\n\u003ca href=\"http://www.amazon.co.uk/gp/product/0133930149/ref=as_li_tl?ie=UTF8\u0026camp=1634\u0026creative=6738\u0026creativeASIN=0133930149\u0026linkCode=as2\u0026tag=walthigg-21\u0026linkId=P3LLGB3WTATW57AZ\"\u003e\u003cimg border=\"0\" src=\"http://ws-eu.amazon-adsystem.com/widgets/q?_encoding=UTF8\u0026ASIN=0133930149\u0026Format=_SL250_\u0026ID=AsinImage\u0026MarketPlace=GB\u0026ServiceVersion=20070822\u0026WS=1\u0026tag=walthigg-21\" \u003e\u003c/a\u003e\u003cimg src=\"http://ir-uk.amazon-adsystem.com/e/ir?t=walthigg-21\u0026l=as2\u0026o=2\u0026a=0133930149\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\" /\u003e\n\nYou can find more information about [ScriptCraft on my blog][blog].\n\n# Additional Resources\n\nCoderDojo Athenry have some [excellent tutorials][cda] for younger\nprogrammers who have used [Scratch][scr] and are interested in Modding\nMinecraft using JavaScript.  In particular, they have an excellent\n[Scratch - to - JavaScript][sj] tutorial which explains Scratch\nprograms and how to do the same thing in JavaScript.\n\nI highly recommend the series of [tutorials provided by CoderDojo Athenry][cda].\n\nDeveloper Chris Cacciatore has created some interesting tools using ScriptCraft:\n\n * [A wolf-bot][wb]\n * [L-Systems (Large-scale fractal structures in Minecraft)][ls]\n\n# Docker \n\nTo launch a container with SpigotMC and ScriptCraft you can just do \n\n      docker run -p 25565:25565 -it tclavier/scriptcraft\n\nYou can find all files used to build this container in github project: [docker-scriptcraft](https://github.com/tclavier/docker-scriptcraft)\n\n \n[wb]: https://github.com/cacciatc/wolfbot\n[ls]: https://github.com/cacciatc/scriptcraft-lsystems\n\n[blog]: http://walterhiggins.net/blog/cat-index-scriptcraft.html\n[yp]: docs/YoungPersonsGuideToProgrammingMinecraft.md\n[mm]: docs/Anatomy-of-a-Plugin.md\n[api]: docs/API-Reference.md\n[cd]: http://coderdojo.com/\n[scr]: http://scratch.mit.edu/\n[cda]: http://cdathenry.wordpress.com/category/modderdojo/\n[ytpl]: http://www.youtube.com/watch?v=DDp20SKm43Y\u0026list=PL4Tw0AgXQZH5BiFHqD2hXyXQi0-qFbGp_\n[ex]: src/main/js/plugins/examples\n[contrib]: contributing.md\n[sj]: http://cdathenry.wordpress.com/2013/10/12/modderdojo-week-2-moving-from-scratch-to-javascript/\n[book]: http://www.peachpit.com/store/beginners-guide-to-writing-minecraft-plugins-in-javascript-9780133930146\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalterhiggins%2FScriptCraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalterhiggins%2FScriptCraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalterhiggins%2FScriptCraft/lists"}