libFirework

libFirework

1 Downloads

libFirework

libFirework

A Minecraft library to create custom fireworks. What used to be a simple shitpost about amogus in minecraft evolved into this.

How to use

To use the library, just add it as a gradle dependency

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    ...
    modImplementation 'com.github.2000Slash:libFirework:v1.0.0'
}

Then you can register CustomRocketTypes using com.github.libfirework.LibFirework.registerCustomRocketType(). If you don't want to implement a CustomRocketTypes all by yourself you should really use com.github.libfirework.types.simple.CustomRocketTypeBuilder. You can use it like this

    @Override
    public void onInitialize() {
        LibFirework.registerCustomRocketType(new CustomRocketTypeBuilder(new Identifier("libfirework", "triangle"), Items.NETHERITE_INGOT).drawLines(new double[][]{{0.0, 1.0}, {1.0, 0.0}, {-1.0, 0.0}, {0.0, 1.0}}, 50).build());
        LibFirework.registerCustomRocketType(new CustomRocketTypeBuilder(new Identifier("libfirework", "ball"), Items.SNOWBALL).fillBall(5, 1).build());
        LibFirework.registerCustomRocketType(new CustomRocketTypeBuilder(new Identifier("libfirework", "burst"), Items.FIRE_CHARGE).burst(100).build());
        LibFirework.registerCustomRocketType(new CustomRocketTypeBuilder(new Identifier("libfirework", "amogus"), Items.REDSTONE).explodeSvg(TestLibfirework.class.getClassLoader().getResourceAsStream("amogus.svg"), "amogus.svg", 5.f, 1/500.f, new float[]{-0.8f, 1.f}).build());
    }

These examples are used straight from here

Custom svgs

drawing

If you want to use custom svgs, you can use the `CustomRocketTypeBuilder.explodeSvg()`. To do this, you have to supply it with an input stream of the svg. The svg should only contain one path and it should be the first child of the root. If you want an example, look [here](src/test/resources/amogus.svg). You also have to supply pointDistance, scale, and origin. The pointDistance regulate the number of particles that are generated. The scale and origin define how big the svg is drawn and what direction it moves to.