Custom Particles

Custom Particles 1.3.0

Denizen Version
1.2.0-b1741-REL
Custom Particles is a framework that allows a scripter or server admin to create full custom particles within Minecraft, using the magic of armor stands and custom fonts. Creating a particle is an easy three step process, and it comes with 3 tasks and a procedure to create and destroy your custom particles, respectively.

TASKS​

spawn_particle​

input: [location]|[script]|(colors)|(amount)|(offset)|(player1)|(player2)...​

- run spawn_particle def:<player.eye_location.forward[1]>|example_particle This code will spawn in a particle called "example_particle" one block in front of the player's eyes. Location and script are required parameters to the task, but players, colors, amount and offset are all optional. Players are passed at the end of the definitions, and you can pass in players in a regular list, as though they were separate definitions. If no player is passed, it will default to whatever player is implicit; that is to say, it will be the <player> player. Colors must be a valid value for this type of color tag: <&color[]> (https://meta.denizenscript.com/Docs/Tags/&color), and must be a comma separated list. If you pass no colors in, by default the particle will be colored white, which in this instance will be the default color of the particle. That is to say, if your particle image is white, and you pass no color, your particle will be white, however if the particle image was yellow, and you passed no color to the script, the particle would render as yellow. Amount is a numeric value; by default you spawn a single particle. You can not spawn less than 1 particle. Offset is a comma separated list of numbers, much like you would use in the actual offset tag. The task returns a list of all particles spawned with that specific run of the task. To access them, simply add the "save" argument to your run line, and on another line, you can do <entry[save_name].created_queue.determination.first>, which gives you the list of particles. Make sure to keep track of these particles, so that you can despawn them when no longer in use.

remove_particle​

input: [list_of_particles]​

This removes particles from the world safely. You can pass a any amount of particles to this task, and it will remove the particle from the world, remove it from the server flag, and end the task it's running. When you are done with your particle, use this to remove a particle; any other method of removing a particle may physically remove it but will leave behind references that will no longer be valid, causing error's to be thrown in the console.

teleport_particle​

input: [particle]|[location]​

Teleports a particle to a location. This task is a helper task, due to the fact that the particles are fakespawned in, and the locations of them must be tracked in a flag. Running this task will make sure that the particle's position is tracked when moved. It also helps adjust any passed location slightly so the particle more accurately sits at the location you specified.

PROCEDURES​

particle_position​

input: [particle]​

Gets you the position of the particle. Due to the particle being a fakespawned entity, you are unable to use the .location tag. Instead, use this, and it will access the relevant server flag and get the position from there. Make sure to move the particle using teleport_particle or the position in the flag will be incorrect.

~ HOW TO MAKE A PARTICLE ~​

Making a particle is easy! Assuming you have both the framework and utilities loaded in your scripts, and the resource pack loaded either locally or via a server resource pack, the following steps will get you to generate your first particle.
  1. Go into the resource pack, navigate to ../assets/minecraft/textures/font, and in that folder, you should see a folder called "base". On the same level as that folder, create a new folder called whatever you like. This is your particle's folder, and where you will store the frames for the particle. Each unique particle will have it's own folder.
  2. Navigate into that folder, and create as many images as you'd like. Images can be a maximum of 256x256, and can be rendered in Minecraft at various sizes, so you don't need a big image if you want the particle to be big, or vice versa. Number the images numerically.
  3. Navigate to ../assets/minecraft/font/default.json, and open the file up. You will see a json object, with a field called "providers". That field contains a list of smaller objects, each one looking something like this:
    JSON:
    {    "type": "bitmap",
        "file": "minecraft:font/base/example/1.png",
        "ascent": 16,
        "height": 16,
        "chars": [ "\uF806" ]
    }
    This is the format you will copy to make your own frames of animation for your particle. font/base/example would instead be replace with font/your_folder_name, and ascent and height changed to size preference. Particles will always render at the same size, so if you want to have multiple sizes of the same particle, have multiple copies of the same object, but with the ascent and height set to different values. The ascent and height MUST be the same value. The chars field is the unicode character we are replacing with our particle. Check within Minecraft by typing out /ex narrate <&chr[xxxx]> to verify that the unicode you are replacing is not currently being used. If the output is a rectangular box, then you can use that character without overwriting existing characters. Each frame needs to be it's own character, and if you have a secondary set of objects that are the same particle but in a different size, make sure they also have a unique character.
  4. Hop into your script folder, and open the file marked particles.dsc. In it is an example of how a data script needs to be formatted to create a particle. Wait is how many ticks should be between each update of the particle. Each frame is the Unicode of the specific image that you would like to use. You can have the frames in any order, and you can have frames repeat as well.
  5. Once the data script is done, simply hop into game, and use the "spawn_particle" task, passing in the name of the data script as the name of the particle!


Requires:
Author
jumpsplat120
Downloads
1,401
Views
2,355
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from jumpsplat120

Share this resource

Latest updates

  1. Updated for 1.17

    Textures now work with Minecraft 1.17; also reintroduced the particle_entity entity script...
  2. Procedure/teleport hotfix

    If you took the value from the procedure, and passed it into the teleport task over and over...
  3. Hotfix for 1.1.1

    Missing a letter.