Particles do not work

Published by smmmadden on
Status
Fixed
Issue description

In the Procedure below, when a user right clicks on a grass block with an item in hand, the sound referenced (block_gravel_place) is heard in-game (that works). 

However, the particle effects do not work (at all).  I've even tried putting the spawn particle under its own if/do validation of the current entity, but no particles work (SP or MP).

I ran the command directly in-game and while the screen shows "Playing effect snowballproof for 300 times" no particles appear. I can connect to a MP Forge 2768 Server and run the command and see the particle effects so I know the command is correct, just something isn't right with the execution.
/particle snowball ~ ~ ~ 1 2 1 10 300 normal

particle procedure

Am I missing something with the use of particles for an on right click event for an Item held in hand?  -Thanks, Steve

Issue comments

I have made new item and on item right clicked on block I added a procedure that only contains spawn particle procedure block. I have set particles to all. After some testing, it turned out that the particle was indeed spawning but was flying in the block and one could not see it.

The issue seems to be that SNOWBALL particles can only fall down. I have changed the particle to CRIT and it flew up. This is a particle specific and can't be changed.

I think there is a misunderstanding of what the issue is and what I was trying to achieve.  I wanted the snowball particle because it spawns above the players head and shoots downward (Vanilla MC).  That's the effect I needed. 

If I start MC Client running Forge 2768 with my mod (not started from MCreator) and the procedure above, clicking multiple times now I can see a white particle here and there as you said - nice catch!  I never saw that until I clicked on a block higher than below me. That's a bug b/c the spawn location is supposed to use the coordinates from the procedure and unfortunately, it's only looking at the coordinates of the clicked block and ignoring the vy:2 (I even changed to 8) and the height isn't getting picked up.  It should be the y location of the block I clicked plus or minus the value provided (above or below).  Or am I misreading the intent?

Second issue - if I just click the -> to compile and start MC (single player), both the /particle witchMagic ~ ~ ~ 1 2 1 10 300 normal and right clicking a block do not work for particles.  It's like it gets disabled, but SP (not in MCreator) and MP (same mod version) the /particle witchMagic ~ ~ ~ 1 2 1 10 300 normal command works fine, but the particle effects do not.

What I am trying to do is simulate a salt shaker (item in hand) for which I have 3 types (white, pink and black).  Each of which I need the particle effect appear when the click occurs. The block_gravel_place provides the shaking sound, now I need the visual. :-)  Hope this helps clarify what I was failing at. lol -Thanks, Steve

I don't know why this particle behaves differently, but we use default spawning procedure as with Minecraft. I will fix this if I find out why this is happening.

Thanks Klemen - I'll continue trying to find alternatives if any exist and post if I do. :-)

Hi Klemen,

I managed to get some particles to appear by changing the vx, vy, vz values to 1, 3, 1 but I believe the problem is the generated code isn't allowing for three important parameters supported in the spawnParticle method to be used as just adding them into java gets ignored since they are not supported.  These three parameters are: numberOfParticles, particleSpeed and particleArguments.  I found out based on trying to add them into the generated java code and got this error:

 error: no suitable method found for spawnParticle(EnumParticleTypes,int,int,int,int,int,int,int,int,String)

So what needs to be added to the UI shape, is the numberOfParticles, particleSpeed & particleArguments (which is either normal or force) and then this should work properly and be similar to executing the command directly:
 /particle angryVillager ~ ~ ~ 1 3 1 10 300 normal

Note also: BLOCK_DUST and FALLING_DUST particles crash the client as soon as the right-click event gets triggered. :-)  I haven't tested all of them, but these two definitely crash the client. -Steve

 

spawnParticle

public void spawnParticle(EnumParticleTypes particleType,
                          boolean longDistance,
                          double xCoord,
                          double yCoord,
                          double zCoord,
                          int numberOfParticles,
                          double xOffset,
                          double yOffset,
                          double zOffset,
                          double particleSpeed,
                          int... particleArguments)

Some particles can indeed cause the crash as not all of them are supported in all cases but this is how they are implemented.

In which class it this method located because I was not able to find such method in World.java for 1.12.2? Could you give me class name and line in the code? Thanks!

I originally started here and tried some of the examples overriding the generated java and then that led me to the javadoc site.

I will add a new spawn multiple particles procedure block that will be based on the code you linked.