Jump to content

Recommended Posts

Posted (edited)

I have a block whose model is partially transparent. I'm using the randomDisplayTick method to display some particles inside it, specifically the Totem of Undying particles. Everything looks great when the block is on top of another block, but if there's no block below it, the particles will fall down through my block and keep raining down until they hit something. Which looks terrible.

How can I force the particles I'm spawning to despawn/die if they go outside my block's range? I hope I don't need to make an entirely new particle just for that (and if I do, can someone point me to a tutorial for that? The only ones I can find are for 1.7.10 or earlier, and I know the particle system has changed since then).

 

I don't think it's too relevant, but here's the code I'm using to spawn the particles:

	@Override
	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
		for (int i = 0; i < 3; ++i) {
			int j = rand.nextInt(2) * 2 - 1;
			int k = rand.nextInt(2) * 2 - 1;
			double x = (double) pos.getX() + 0.5D + 0.25D * (double) j;
			double y = (double) ((float) pos.getY() + rand.nextFloat() * 0.625);
			double z = (double) pos.getZ() + 0.5D + 0.25D * (double) k;
			worldIn.spawnParticle(EnumParticleTypes.TOTEM, x, y, z, 0, 0, 0);
		}
	}

 

(It's basically copypasta from the Ender Chest code for this, with some values changed.)

 

*EDIT* Actually, an even better solution would be if I could make the particles act as though they've hit a block when they reach the bottom of the inside of my block. That would look superb; I get the feeling that would be much harder to do, though?

Edited by IceMetalPunk

Whatever Minecraft needs, it is most likely not yet another tool tier.

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.