O'Reilly logo

A Beginner’s Guide to Writing Minecraft Plugins in JavaScript by Walter Higgins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Create a Fireworks Show

In this chapter, you’ll write code to create a spectacular fireworks show in Minecraft. You’ll learn about ScriptCraft’s built-in fireworks module and the setTimeout() function, and you’ll use a powerful programming technique called recursion. You’ll begin by writing code to launch a single firework after a delay of two seconds and then build on that code to launch many fireworks.

The fireworks Module

ScriptCraft includes a fireworks module that can be used to launch a single firework at a given location. You can use the fireworks module directly at the in-game command prompt like this:

/js var fireworks = require('fireworks')/js fireworks.firework( self.location )

The fireworks ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required