Jump to content

[1.7.10] Spawning Particles Around Blocks


Recommended Posts


I'm a beginning mod developer, this is only my second mod so I don't know much. I am currently trying to set up an ore so that it emits the "happy villager" particles in caves. I don't know much of java yet, so can someone help me with this or at least point me in the right direction?

Link to comment
Share on other sites

1. Read my caption.

2. Update to 1.9+ or you'll get close to none support.

3. Go to official Java tutorials - they are really good, study some java before modding.

4. Now back to MC - few things you need to know, some are in official docs (same link), but most importantly:


5. Particles are client-only, you basically need to grab a block and make it spawn particles on client whenever block is in cave (if i understood correctly).

6. I recommend looking up BlockFurnace - it has a method #randomDisplayTick (naming might vary) - it basically is used to spawn flame particles.

You want to override same method for your block (don't forget annotations).

7. For checking "if cave" - this is quite dynamic problem that has no good answer. How do you know block is in cave? Cave can be deep underground or inside mountain. Cave can have a hole in ceiling, tho it would still be underground - how would you define it that is a cave?

There are few things to check:

Skylight - that doesn't define if it is cave or room.

Depth (y coord) - well, there is a mountain problem.

Blocks around - you can check against surrounding blocks if they naturally spawn underground - like stone, ores, gravel (but the what about dirt?)

Scanning - scanning surrounding is generally considered very expensive. It has n^3 (box) checks so anything further than dozen or so becomes expensive. Happy for you - particles are client side and whole method #randomDisplayTick is also client only so whole process would go on client thread/side. basically you would have to write some dynamic algorithm that would know if the block is inside a "room".

Combine them all and you can somehow define "cave".

Point of interest (I don't remember if applies to 1.7):

When in cave there is a special "cave" music - try tracking down how MC knows about caves, apply similar checks (I think it probably checks some stuff I mentioned).

1.7.10 is no longer supported by forge, you are on your own.

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.