Jump to content

[1.7.10] Registering New Particles


Thornack

Recommended Posts

Hi Everyone,

 

I was wondering if anyone could explain how the vanilla particles are registered to a string. I want to try and set up a system where I can use my custom particle sheet in tandem with the vanilla particle sheet that contains their textures, to add more particles to the game. I like their spawning of particles using the string but I have been looking at this and I dont really understand how it works. (the string part - how exactly does vanilla associate the "snowshovel" string with the particle class that is the EntityFX for snowshovel particle)

 

 public void spawnParticle(String particleName, double xCoord, double yCoord, double zCoord, double velX, double velY, double velZ)

 

if the particle name is snowshovel I know how to spawn it but lets say I wanted to add a particle with name dustydesert how would I map this name to that particle EntityFX so that I can spawn it the same way vanilla does it.

 

This is currently how I spawn vanilla particles - nothing fancy but I want to be able to create my own custom particle with custom parameters such as (particleMaxAge, Scale,...etc etc) so that I can give it custom motion and all of that good stuff. Then register it in such a way so that I can spawn it the same way vanilla does it. Is this even possible

 

@Override
public void spawnParticles(World world, double xCoord, double yCoord, double zCoord, float radius, Vec3 lookVector)
{

	yCoord += 1.62D;
	for (float f = 0; f < radius; f += 0.5F) {
		xCoord += lookVector.xCoord;
		yCoord += lookVector.yCoord;
		zCoord += lookVector.zCoord;
		for (int numberOfParticles = 0; numberOfParticles < maxNumberOfPrticles; ++numberOfParticles) {
			world.spawnParticle("snowshovel",
					xCoord + 0.5F - world.rand.nextFloat(),
					yCoord + 0.5F - world.rand.nextFloat(),
					zCoord + 0.5F - world.rand.nextFloat(),
					lookVector.xCoord * (0.5F * world.rand.nextFloat()),
					lookVector.yCoord * (0.5F * world.rand.nextFloat()),
					lookVector.zCoord * (0.5F * world.rand.nextFloat()));
		}
	}
}

Link to comment
Share on other sites

After some major digging around I have found the function that seems to do the "registering of particles" but I dont think there is an easy way to register new ones...

 

Located in public class RenderGlobal

public EntityFX doSpawnParticle(String p_72726_1_, double p_72726_2_, double p_72726_4_, double p_72726_6_, double p_72726_8_, double p_72726_10_, double p_72726_12_){
}

 

it seems to be called by the following method located in public class RenderGlobal

public void spawnParticle(String p_72708_1_, final double p_72708_2_, final double p_72708_4_, final double p_72708_6_, double p_72708_8_, double p_72708_10_, double p_72708_12_){}  

 

which is called by the following method located in public abstract class World

public void spawnParticle(String p_72869_1_, double p_72869_2_, double p_72869_4_, double p_72869_6_, double p_72869_8_, double p_72869_10_, double p_72869_12_){}

 

which is called by everything that spawns particles in vanilla... Does anyone have any idea how to access this in a smart way to allow registration of new particles in the same way vanilla does it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.