Posted February 14, 20169 yr 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
February 14, 20169 yr Which particle should it spawn? I miss that parameter in world#spawnParticle which determine what particle should be spawned. Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
February 14, 20169 yr Particles are client side. You need to call code on client or send packet from server to client saying to do it. 1.7.10 is no longer supported by forge, you are on your own.
February 14, 20169 yr Author How would i spawn it using a packet. The tut said to spawn it server side and render it client side so other players can see still
February 14, 20169 yr 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! Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
February 15, 20169 yr Author My understanding of particles are that they are entities and just like entities and blocks the textures are rendered client side but spawned server side. If anyone has a good tutorial for this or the location if the vanilla particle spawning that would be great
February 15, 20169 yr Author btw: You should get off the internet and grab a creeper plushie because you're 7 years old. I have a creeper plushie, but I am 22....my mom gave it to me for Christmas
February 15, 20169 yr World#spawnParticle calls IWorldAccess#spawnParticle for every registered IWorldAccess . RenderGlobal (the client-side IWorldAccess ) spawns a particle in its implementation of this method, WorldManager (the server-side IWorldAccess ) 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 RenderGlobal#doSpawnParticle 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.
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.