Jump to content

[1.7.10] When/where spawn particles on client???


Elix_x

Recommended Posts

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!

Link to comment
Share on other sites

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();
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :o :o wtf? re-adding my previous code, and it works like i wanted...  :o :o :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...  :o...

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.



×
×
  • Create New...

Important Information

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