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 ...
Get A Beginner’s Guide to Writing Minecraft Plugins in JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.