Elix_x Posted June 21, 2015 Posted June 21, 2015 Hello everybody,, i have a question: When/where am i supposed to spawn particles on client? So: I have a config option for particle rendering which can be different for each client, that's why i'm spawning it on client and not on server||&client. I tried to spawn it at ClientTick.pre, RenderTick.pre and WorldTick.pre and non of them is working. I know that code for spawning (world.spawnParticle) is reached (console). But i don't see any particles... If you know when/where i have to spawn particles on client - tell me please! I don't think you need any code, but if you do - i can give it! Thanks for help! If you have any questions - just ask! Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
TheGreyGhost Posted June 21, 2015 Posted June 21, 2015 Hi It should work fine to spawn particles on client in ClientTick, RenderTick, WorldTick, or anywhere else actually. Perhaps you are spawning them at the wrong location, or they are invisible. Show code? -TGG Quote
Elix_x Posted June 21, 2015 Author Posted June 21, 2015 Hi It should work fine to spawn particles on client in ClientTick, RenderTick, WorldTick, or anywhere else actually. Perhaps you are spawning them at the wrong location, or they are invisible. Show code? -TGG Ok, that the code responsible for spawning particles next to player. It is called from [event], and succesfully reaches spawnParticle (console). @Override public void createParticles(EntityLivingBase entity, boolean b){ if(b){ if(vectoredAffect(entity)){ World world = entity.worldObj; Vec3 look = entity.getLookVec(); for(int i = 0; i < particleAmount(); i++){ world.spawnParticle(getParticle(), entity.posX + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posY + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posZ + randomRangedPNDouble(getParticlePosRandomizerRange()), look.xCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.yCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.zCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange())); } } } } Helper methods: public String getParticle() { return "smoke"; } public double randomRangedPNDouble(double range) { return random.nextBoolean() ? random.nextInt((int) (range * 1000000)) / 1000000 : -random.nextInt((int) (range * 1000000)) / 1000000; } public double getParticlePosRandomizerRange() { return 0.5; } public double getParticleVelocityRandomizerRange() { return 0.125; } public int particleAmount(){ return 10 * getAmplifier(); } Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
TheGreyGhost Posted June 21, 2015 Posted June 21, 2015 Hi This is 1.7.10 yeah? I suggest first thing is to comment out this for(int i = 0; i < particleAmount(); i++){ world.spawnParticle(getParticle(), entity.posX + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posY + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posZ + randomRangedPNDouble(getParticlePosRandomizerRange()), look.xCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.yCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.zCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange())); } and replace it with (going from memory here) world.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.05, 0.05, 0.05); That should help narrow down the possible problems -TGG -TGG Quote
Elix_x Posted June 21, 2015 Author Posted June 21, 2015 Hi This is 1.7.10 yeah? I suggest first thing is to comment out this for(int i = 0; i < particleAmount(); i++){ world.spawnParticle(getParticle(), entity.posX + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posY + randomRangedPNDouble(getParticlePosRandomizerRange()), entity.posZ + randomRangedPNDouble(getParticlePosRandomizerRange()), look.xCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.yCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange()), look.zCoord * 10 + randomRangedPNDouble(getParticleVelocityRandomizerRange())); } and replace it with (going from memory here) world.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.05, 0.05, 0.05); That should help narrow down the possible problems -TGG -TGG Ok, i'll try... EDIT 1: this works... let me re-add my previouscode... EDIT 2: :o wtf? re-adding my previous code, and it works like i wanted... :o Thanks... And i still don't understand why be removing and then re adding code, it worked... but it's working now... so yeah, thanks... ... Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
Recommended Posts
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.