Coder Social home page Coder Social logo

inxomnyaa / fireworks Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 5.0 171 KB

Adds Fireworks to Pocketmine

Home Page: https://poggit.pmmp.io/ci/thebigsmileXD/fireworks/~

License: MIT License

PHP 100.00%
firework fireworks rocket rockets explosions pocketmine pocketmine-plugins

fireworks's Introduction

Deprecated

Check out https://github.com/BlockHorizons/Fireworks/ for an up to date firework plugin, including a simple API!

plugin icon

fireworks

Adds Fireworks to Pocketmine

Its simply adding firework items and entities into PocketMine-MP servers.

You can launch any firework from the creative inventory AND custom ones - just like in vanilla MCPE.

How to get a firework

Either, give a firework via gamemode 1, or /give command. For generating the /give command i suggest using: https://mcstacker.bimbimma.com/mcstacker1.10.php and modifying the command to work with PocketMine-MP. This is not easy. No need to explain further.

The easier way is to use the code to create custom fireworks. See Create a custom firework for that.

Create a custom firework

This is sample code to explain the "API"-alike part of the plugin, giving 2 custom fireworks:

Without special explosions:

		$data = new FireworksData();
		$data->flight = 2;//flight time. default is 1
		$firework = new Fireworks();
		$nbt = Fireworks::ToNbt($data);//create the compound tag
		$firework->setNamedTag($nbt);//modify the item's compound tag
		$event->getPlayer()->getInventory()->addItem($firework);//give the item to a player (this case: PlayerJoinEvent $event)

With special explosions

		$explosion = new FireworksExplosion();//init an explosion
		$explosion->fireworkColor = [4, 4, 4];//set the color to custom colors
		$explosion->fireworkFade = [5, 5, 5];//set the fade color to custom colors
		$explosion->fireworkFlicker = true;//enable the flickering
		$explosion->fireworkTrail = false;//enable the trail
		$explosion->fireworkType = 4;//set the shape/type of the firework
		$data = new FireworksData();//create the generic data
		$data->flight = 2;
		$data->explosions[] = $explosion;//add the explosion
		$firework = new Fireworks();
		$nbt = Fireworks::ToNbt($data);
		$firework->setNamedTag($nbt);
		$event->getPlayer()->getInventory()->addItem($firework);

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.