Jump to content

[1.6.4] Particle Questions


Recommended Posts

Normally you would use-

public void randomDisplayTick(World world, int x, int y, int z, Random rand)

Go and check out Minecraft's BlockFire.class, it spawns a particle at a psuedo-random location whenever the above method is called.


But since you want it to spawn when the block is right-clicked, instead of randomly, spawn the particle in-

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float x1, float y1, float z1)

(check if "world.isRemote" and note that this is in Block.class not TileEntity.class)


To spawn a custom particle instead of one of the vanilla ones-

Minecraft.getMinecraft().effectRenderer.addEffect(new CustomFX(args...));

stick some more coherent arguments in there and CustomFX will need to extend EntityFX.


There aren't any handlers involved unless I'm just losing it. I would say that creating a custom particle can be somewhat non-trivial though. There are tutorials for it floating around somewhere.

Link to comment
Share on other sites

From what I gathered in MoxEmerald's reply, you need to make a custom class, in the example he has it called CustomFX. This class will need to extend EntityFX. You can look at the BlockFire class for an example on how a particle is created. After that, you would put the

Minecraft.getMinecraft().effectRenderer.addEffect(new CustomFX(args...));

in the onBlockActivated() method.


You also shouldn't need to register particles, just make sure you are calling them on the client instead of the server. As for the textures, you can probably find in the BlockFire class.

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.