Jump to content

[1.7.10] Spawning particles the world


Recommended Posts

I have attempted to spawn particles into the world using a tutorial, however it wont generate the particles in the world on the entity that has my custom potion effect.


here is my bit of code in the EventHandler for LivingUpdateEvent:



Entity entity = event.entityLiving;
		if(!event.entityLiving.worldObj.isRemote && event.entityLiving.worldObj.rand.nextInt(20) == 0){
			Random rand = new Random();
			double motionX = rand.nextGaussian() * 0.02D;
			double motionY = rand.nextGaussian() * 0.02D;
			double motionZ = rand.nextGaussian() * 0.02D;
			entity.worldObj.spawnParticle("", (double)(entity.posX + rand.nextFloat() * entity.width * 2.0F - entity.width), (double)(entity.posY + 0.5D + rand.nextFloat() * entity.height), (double)(entity.posY + rand.nextFloat() * entity.width * 2.0F - entity.width), motionX, motionY, motionZ);
			System.out.println("Particles on " + entity);




any help will be welcomed

Link to comment
Share on other sites

Than thats a pretty bad tutorial in my opinion. The only particle that is spawned server side is the xp-orb. But thats because it should be able to be picked up by players.


As Ernio said, spawn it ClientSide by either using packets, or using a ClientSide event/method. Maybe try to find where vanilla potion particles are spawned from. Cause than you would be able to implement yours as well!



- N2ConfigAPI

- Meachanical Crafting Table



- CollectionUtils



- InGameConfigManager

Link to comment
Share on other sites




for every registered




(the client-side


) spawns a particle in its implementation of this method,


(the server-side


) does nothing.


WorldServer#func_147487_a(String particleName, double x, double y, double z, int numParticles, double displacementX, double displacementY, double displacementZ, double velocity)

sends a packet from the server to the clients of the players within 256 blocks of the specified position telling them to spawn particles there.


Look at


to see which particle names you can use.


Use your IDE to find usages of these methods to see how they're used.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

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.


  • Create New...

Important Information

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