Giter Club home page Giter Club logo

commandblocksjs's Introduction

#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);
var timer = new Util.Timer(calculateNext, 1);
timer.start();

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(stopRadius, undefined, function ()
	{
		timer.stop();
	});
}

###Output Cmd

##Used Libraries

##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)."

commandblocksjs's People

Contributors

m4gnv5 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.