In this tutorial, I am showing you how to create your particles.
Step 1: Creating the particle class
To create your own particles, we will need to create our own particle class so that we can do whatever we want. Create a class and have it extend an Entity<particleName>FX. List of EntityFX is available at the end of this post.
I will be using the Redstone's particles as I want my particle's appearance and behaviour to be the same as the Redstone's, so I extend EntityReddustFX.
public class EntityPositiveSpeedforceFX extends EntityReddustFX
{
}
You will receive an error. Don't worry.
Now, let's look at the EntityReddustFX's main methods:
So I want to change the color so I will be calling EntityFX#particleRed, EntityFX#particleGreen, EntityFX#particleBlue in my second method. Your class should look like this:
Alrighty! That's it for our custom particle class.
Step 2: Creating a spawning particle class
We need to create a class in which we can call the method from that class to spawn our particles. So create a new class and call it ParticleSpawner or whatever you wanna name it. We need to create a field that calls Minecraft#getMinecraft.
private static Minecraft mc = Minecraft.getMinecraft();
Next we need to create a method that will be called to spawn our particles.
public class ParticleSpawner
{
private static Minecraft mc = Minecraft.getMinecraft();
public static EntityFX spawnParticle(String particleName, double par2, double par4, double par6, double par8, double par10, double par12)
{
return null;
}
}
Once you have something that look like that, we will need to type the int, double etc.
Do you see the if statement, "particleName.equals("positive_speedforce")? The string is the name of our particle when we call the spawnParticle method. Alright, I hoped I made this portion clear enough and understandable as this is the crucial part. Next step on! Full speed ahead!
Final step: Spawning our particle!
I will be calling my spawnParticle method in my EventHandler (it's where my speedsters' lightning streak will come from). And here is the method!
As you can see, the string "positive_speedforce" has to be same as the string in the if statement in our ParticleSpawner class,
else
{
if (particleName.equals("positive_speedforce"))
{
var21 = new EntityPositiveSpeedforceFX(mc.theWorld, par2, par4, par6, (float)par8, (float)par10, (float)par12);
}
mc.effectRenderer.addEffect(var21);
return var21;
}
So, talking about the parameters. The first parameter is obviously a String which has to have the same characters as in the if statement in the ParticleSpawner class. The 2nd, 3rd and 4th parameters are where the particles will be spawned, the positions to be exact, x, y, z respectively. The last 3 parameters are the offsets, and they are x, y and z offsets. I hope you understood this part!
If you got any problems, ask here. I will be creating an FAQ section when there are questions commonly asked in this thread. I hope this tutorial help you people. I think this tutorial will work for 1.8, if not just ask here too! ^^
And now, the Entity<particleName>FX list:
EntityAuraFX
EntityBlockDustFX
EntityBreakingFX
EntityBubbleFX
EntityCloudFX
EntityCrit2FX
EntityCritFX
EntityDiggingFX
EntityDropParticleFX
EntityEnchantmentTableParticleFX
EntityExplodeFX
EntityFirework
EntityFIshWakeFX
EntityFlameFX
EntityFootStepFX
EntityHeartFX
EntityHugeExplodeFX
EntityLargeExplodeFX
EntityLavaFX
EntityNoteFX
EntityParticleEmitter
EntityPickupFX
EntityPortalFX
EntityRainFX
EntityReddustFX
EntitySmokeFX
EntitySnowShovelFX
EntitySpellParticleFX
EntitySplashFX
EntitySuspendFX
You can find the Entity classes in forgeSrc<numbers>/net/minecraft/client/particle.
Thanks for reading this tutorial. If I missed anything out, please tell me in this thread or PMs and I will have it edited! If this tutorial helped, give me a like!
Give me feedback on how I can improve, examples: format of tutorial etc. See ya!
Credits
MrCrayfish for his open source mod. Without it, I wouldn't be able to figure out how to create custom particles.
Create tutorial "The rendering of the hands when holding a specific item" or tell me in a PM, really want to know(don't know how things are done in 1.8.9). I liked your topic:)
Hm, it seems I will have to create the video sooner than I thought. Either today or tomorrow, the video will be uploaded. Check my youtube channel for the update soon. Link to it is in my signature.
Rollback Post to RevisionRollBack
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov . I will always remember you
Hm, it seems I will have to create the video sooner than I thought. Either today or tomorrow, the video will be uploaded. Check my youtube channel for the update soon. Link to it is in my signature.
this tutorial teaches you how to create your own particles and event handlers. 15:30 is where the particle spawning code is, 19:50 is where the custom particle (custom texture on your particle) is. Enjoy the video and subscribe and give a thumbs up if it helped you or if you liked the video.
Rollback Post to RevisionRollBack
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov . I will always remember you
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIn this tutorial, I am showing you how to create your particles.
Step 1: Creating the particle class
To create your own particles, we will need to create our own particle class so that we can do whatever we want. Create a class and have it extend an Entity<particleName>FX. List of EntityFX is available at the end of this post.
I will be using the Redstone's particles as I want my particle's appearance and behaviour to be the same as the Redstone's, so I extend EntityReddustFX.
public class EntityPositiveSpeedforceFX extends EntityReddustFX { }You will receive an error. Don't worry.
Now, let's look at the EntityReddustFX's main methods:
protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) { this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); } protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46350_8_, float p_i46350_9_, float p_i46350_10_, float p_i46350_11_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; this.motionY *= 0.10000000149011612D; this.motionZ *= 0.10000000149011612D; if (p_i46350_9_ == 0.0F) { p_i46350_9_ = 1.0F; } float f = (float)Math.random() * 0.4F + 0.6F; this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_9_ * f; this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_10_ * f; this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_11_ * f; this.particleScale *= 0.75F; this.particleScale *= p_i46350_8_; this.reddustParticleScale = this.particleScale; this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46350_8_); this.noClip = false; }We will copy the parameters over into our entity particle class. Your entity particle class should look something like this:
public class EntityPositiveSpeedforceFX extends EntityReddustFX { public EntityPositiveSpeedforceFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) { this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); } public EntityPositiveSpeedforceFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46350_8_, float p_i46350_9_, float p_i46350_10_, float p_i46350_11_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46350_8_, p_i46350_9_, p_i46350_10_, p_i46350_11_); } }So I want to change the color so I will be calling EntityFX#particleRed, EntityFX#particleGreen, EntityFX#particleBlue in my second method. Your class should look like this:
public class EntityPositiveSpeedforceFX extends EntityReddustFX { public EntityPositiveSpeedforceFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) { this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); } public EntityPositiveSpeedforceFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46350_8_, float p_i46350_9_, float p_i46350_10_, float p_i46350_11_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46350_8_, p_i46350_9_, p_i46350_10_, p_i46350_11_); this.particleRed = 1.0F; this.particleGreen = 0.5F; this.particleBlue = 0.0F; } }Alrighty! That's it for our custom particle class.
Step 2: Creating a spawning particle class
We need to create a class in which we can call the method from that class to spawn our particles. So create a new class and call it ParticleSpawner or whatever you wanna name it. We need to create a field that calls Minecraft#getMinecraft.
Next we need to create a method that will be called to spawn our particles.
public class ParticleSpawner { private static Minecraft mc = Minecraft.getMinecraft(); public static EntityFX spawnParticle(String particleName, double par2, double par4, double par6, double par8, double par10, double par12) { return null; } }Once you have something that look like that, we will need to type the int, double etc.
public class ParticleSpawner { private static Minecraft mc = Minecraft.getMinecraft(); public static EntityFX spawnParticle(String particleName, double par2, double par4, double par6, double par8, double par10, double par12) { if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null) { int var14 = mc.gameSettings.particleSetting; if (var14 == 1 && mc.theWorld.rand.nextInt(3) == 0) { var14 = 2; } double var15 = mc.getRenderViewEntity().posX - par2; double var17 = mc.getRenderViewEntity().posY - par4; double var19 = mc.getRenderViewEntity().posZ - par6; EntityFX var21 = null; double var22 = 16.0D; if (var15 * var15 + var17 * var17 + var19 * var19 > var22 * var22) { return null; } else if (var14 > 1) { return null; } else { if (particleName.equals("positive_speedforce")) { var21 = new EntityPositiveSpeedforceFX(mc.theWorld, par2, par4, par6, (float)par8, (float)par10, (float)par12); } mc.effectRenderer.addEffect(var21); return var21; } } return null; } }Do you see the if statement, "particleName.equals("positive_speedforce")? The string is the name of our particle when we call the spawnParticle method. Alright, I hoped I made this portion clear enough and understandable as this is the crucial part. Next step on! Full speed ahead!
Final step: Spawning our particle!
I will be calling my spawnParticle method in my EventHandler (it's where my speedsters' lightning streak will come from). And here is the method!
ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 2.0D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.9D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.8D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.7D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.6D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.5D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.5D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.4D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.3D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.2D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.1D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 1.0D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.9D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.8D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.7D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.6D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.5D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.4D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.3D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.2D, player.posZ, 0.0D, 0.0D, 0.0D); ParticleSpawner.spawnParticle("positive_speedforce", player.posX, player.posY + 0.1D, player.posZ, 0.0D, 0.0D, 0.0D);As you can see, the string "positive_speedforce" has to be same as the string in the if statement in our ParticleSpawner class,
else { if (particleName.equals("positive_speedforce")) { var21 = new EntityPositiveSpeedforceFX(mc.theWorld, par2, par4, par6, (float)par8, (float)par10, (float)par12); } mc.effectRenderer.addEffect(var21); return var21; }So, talking about the parameters. The first parameter is obviously a String which has to have the same characters as in the if statement in the ParticleSpawner class. The 2nd, 3rd and 4th parameters are where the particles will be spawned, the positions to be exact, x, y, z respectively. The last 3 parameters are the offsets, and they are x, y and z offsets. I hope you understood this part!
If you got any problems, ask here. I will be creating an FAQ section when there are questions commonly asked in this thread. I hope this tutorial help you people. I think this tutorial will work for 1.8, if not just ask here too! ^^
And now, the Entity<particleName>FX list:
You can find the Entity classes in forgeSrc<numbers>/net/minecraft/client/particle.
Thanks for reading this tutorial. If I missed anything out, please tell me in this thread or PMs and I will have it edited! If this tutorial helped, give me a like!
Give me feedback on how I can improve, examples: format of tutorial etc. See ya!
Credits
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
Create tutorial "The rendering of the hands when holding a specific item" or tell me in a PM, really want to know(don't know how things are done in 1.8.9). I liked your topic:)
I don't understand. U should create a video
Nicholas Pham
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhat part of my tutorial do you not understand?
I will be creating a video tutorial on this soon, it will be on my youtube channel and on my website,
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
The question of course is not on how you solved the problem for armor when you hit hands out of armor?
Yay thanks
Nicholas Pham
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo, I was asking Flippypenguin121's question.
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou didn't answer my 1st question, which part of the tutorial did you not understand?
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
Step 1 and 2
Nicholas Pham
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHm, it seems I will have to create the video sooner than I thought. Either today or tomorrow, the video will be uploaded. Check my youtube channel for the update soon. Link to it is in my signature.
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
Post the video on this thread too
Nicholas Pham
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOf course,
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumVideo is here!
this tutorial teaches you how to create your own particles and event handlers. 15:30 is where the particle spawning code is, 19:50 is where the custom particle (custom texture on your particle) is. Enjoy the video
and subscribe and give a thumbs up if it helped you or if you liked the video.
Till next time. Thank you for delivering funny scenes to Star Trek as Chekov
. I will always remember you