Sueta
MA

Matrix ParticleAPI

1.0.0-RELEASE

3DMatrix based Particle/Effect API

·Plugin

THIS PLUGIN IS ONLY FOR DEVELOPERS

This library is a possibillity for spigot developers to create complex, matrix based particle effects. It comes with a few simple demo effects, but you can easily add custom shapes and effects.

The Idea
ParticleAPI is using 3D matrices in which you can draw using relative locations. It is possible to move, rotate and scale the whole matrix without changing anything in the drawing function.


(Drawing the border of a 10x10x10 Matrix)

Usage
1. Add the ParticleAPI to your project.

Maven:
At the moment there is no official maven repo for the library, so you will have to use scope system until I created one if you want to use maven. :(
Sorry for that.

<dependency>
    <groupId>de.devtastisch</groupId>
    <artifactId>particleapi</artifactId>
    <version>1.0.0-RELEASE</version>
    <scope>system</scope>
    <systemPath>C:/Path/to/the/library.jar</systemPath>
</dependency>

2. Create an instance of RotateableMatrix3D

RotateableMatrix3D matrix3D = new RotateableMatrix3D(width, height, depth, x, y, z);

3. Schedule some different Tasks.
There are a few simple shapes, but you can easily implement your own.

matrix3D.schedule(new Runnable() {
    public void run() {
                    
        matrix3D.executeActions(player.getWorld(),
            new DrawBorder(ParticleEffect.CRIT_MAGIC),
            new DrawCycle(ParticleEffect.CRIT_MAGIC, new MatrixLocation(0, 0, 0), 5, 1),
            new DrawLine(ParticleEffect.CRIT_MAGIC, new MatrixLocation(-5, -5, -5), new MatrixLocation(5, 5, 5)),
            new DrawTriangle(ParticleEffect.FLAME, new MatrixLocation(-5, -5, -5), new MatrixLocation(5, -5, -5), new MatrixLocation(0, 5, 5));

        matrix3D.paint(player.getWorld(), new MatrixLocation(0, 0, 0), ParticleEffect.BARRIER);
    }
},200);//This is the repeating delay in ms

This will create some effects like this:

4. Transform your matrix if you want to

matrix3D.schedule(new Runnable() {
    int scale = 0;
    public void run() {
        matrix3D.setXRot(matrix3D.getXRot() + 1);
        matrix3D.setYRot(matrix3D.getYRot() + 1);
        matrix3D.setZRot(matrix3D.getZRot() + 1);
    
        matrix3D.setScale(Math.sin(scale));
        scale++;
    }
},200);

5. Let it chase your friend

matrix3D.setFollowing(friend);

6. Create some gorgeos transforming effects.
The sky is basically the limit

matrix3D.schedule(new Runnable() {
    double scale = 0;
    double width = 1;
    double height = 1;
    double depth = 1;

    public void run() {

        for (double i = 0; i <= 360; i++) {
            matrix3D.paint(player.getWorld(), new MatrixLocation(
                5 * Math.sin(Math.toRadians(i)) * Math.sin(Math.toRadians(width)),
                Math.cos(Math.toRadians(i * 16)) * Math.sin(Math.toRadians(height)),
                5 * Math.cos(Math.toRadians(i) * Math.sin(Math.toRadians(depth)))
            ), ParticleEffect.CRIT_MAGIC);
        }

        scale+=0.12;
        width+=0.12;
        height+=0.23;
        depth+=0.18;

        matrix3D.setScale(Math.sin(scale));
    }
}, 50);

Similar projects

Plugin →