CommandBlocksJS
CommandBlocksJS copied to clipboard
CommandBlocksJS allows you to translate Javascript code to Minecraft Commandblocks
##This repository isnt maintained anymore please take a look at Mooncraft instead
#CommandBlocksJS CommandBlocksJS allows you to program commandblocks logic in typescript/javascript. The major benefit in using CommandBlocksJS instead of building the blocks yourself is that you can create complex logic a lot faster that than you could in minecraft. Furthermore you can 'build' stuff like countdown timers in 4 lines of code where you would need ~10 minutes to write all the commands ingame.
##Documentation cooming soon
###Legacy Documentation (<2.0) Here There also is a Quick Start page for those who cant wait to write their first script (with version 1.3)
##Examples
//
//https://github.com/M4GNV5/CommandBlocksJS/blob/master/Example/CircleCalculations.ts
//
/// <reference path="../Core/API.ts"/>
//start at radius
var startRadius = 1;
//stop at radius
var stopRadius = 20;
var radius = new Runtime.Integer(startRadius);
call(calculateNext);
function calculateNext()
{
var circumference = new Runtime.Decimal();
var area = new Runtime.Decimal();
var pi = Runtime.Decimal.Pi;
// C = 2 * pi * r
circumference.set(radius);
circumference.multiplicate(pi);
circumference.multiplicate(2);
// A = r * r * pi
area.set(radius);
area.multiplicate(area);
area.multiplicate(pi);
// output current values
Chat.Tellraw.create(
"r = ",
radius.toTellrawExtra(),
", C = ",
circumference.toExactTellrawExtra(),
", A = ",
area.toExactTellrawExtra()
).tell(new Entities.Player("@a"));
//add one to radius
radius.add(1);
radius.isBetween(startRadius, stopRadius, calculateNext);
}
###Output
##Used Libraries
- CommandlineParser for parsing the commandline arguments
- Substrate for editing the minecraft worlds
- Javascript.NET for executing the Javascript code
##License CommandBlocksJS is published under the 4 clause BSD license what means you can use source and binary for everything but your project needs to include the following clause: "This product includes software developed by Jakob Löw (M4GNV5)."