-
Notifications
You must be signed in to change notification settings - Fork 7
Explosive API
As of Explosive Enhancement version 1.2.1, there is an API available for developers to use.
You can find information about how to spawn Explosive Enhancement's effect with your own mod! The effect will respect the user's config, meaning if they have a particle turned off, the effect spawned from your mod using EE's API will not show that particle.
The API isn't too complex, having just one method to call the effect. There are also a couple of overflow methods to allow for easier code readability. This is what the main method looks like incase you are wondering. You can learn how to use it if you continue reading.
ExplosiveApi.spawnParticles(World world, double x, double y, double z, float power, boolean isUnderWater, boolean didDestroyBlocks, boolean isImportant)
The ExplosiveApi.spawnParticles
method is the main method to spawn Explosive Enhancement's effect. This method has multiple parameters, which are listed here.
ExplosiveApi.spawnParticles(
World world, //The world to spawn the effect in
double x, //The effect's x
double y, //The effect's y
double z, //The effect's z
float power, //The effect's power, determines the size
boolean isUnderWater, //If true, the underwater effect shows instead
boolean didDestroyBlocks, //Used to help determine which vanilla particle to spawn(should one need to be spawned)
boolean isImportant //If true, the particle will render from far distances despite the user's config option choice
)
The isImportant
parameter needs a little bit more explaining. If false, the user's config option will be used instead(disabled by default). However, if true, the particle will render from far away even if the user's config option is disabled. This should be used wisely! It is best to use it for bigger explosions typically viewed from very far away. Too many important explosion effects could cause lag depending on the user's hardware(though, a few won't really hurt).
Okay, we've learned a bit about the API's main method, so let's use it! The exact way you get some variables, like the world, x, y, z, and power will depend on where you are calling the method.
You will need to have Explosive Enhancement in your build.gradle
and gradle.properties
files.
build.gradle
ADD ME!!
gradle.properties
ADD ME!!
Replace the version with the latest Explosive Enhancement version, which can be found here.
We've already discussed the method, and we're ready to call it. Depending on where you call the API method, some parameters may look different. For example, the world
, x
, y
, z
, and power
parameters may look different.
TODO: Finish this