Jump to content

[1.11.2] Some questions about particles


Tschipp

Recommended Posts

I have a few questions about Particles:

 
1. How do I make my own?
I made a class that extended Particle, and I changed some values. I was able to spawn them, but it doesn't seem right? Do I have to register them anywhere?
 
2. How do I properly spawn them?
I made a method that calls Minecraft#getMinecraft().effectRenderer.addEffect(). I pass along my particle, because it has a public constructor. It seems very hacky, is there a more official way to do this? 
How do I get an Instance of a vanilla particle? How do i get Instances of other mod's particles?
 
3. How do I get a list of all registered Particles? 
I know of EnumParticleTypes, but that obviously only includes vanilla particles, not modded ones. Is there a registry I can access?
 
4. How do I spawn Particles with custom textures? 
I made a Particle that has its FXLayer set to 1, meaning I can use Particle#setParticleTexture. I tried getting a TextureAtlasSprite using Minecraft.getMinecraft().getTextureMapBlocks.getAtlasSprite() with my resource location (I've double, triple and quadruple checked the location, the texture is there), but it always returns the missingno texture. When I changed the resource location to the item texture of one of my items it worked, so my guess Is that the texture is not registered (somehow, never knew you needed to do this, I've made things like guis in the past and  never registered a texture).
 
 
Thank you for your responses!
Link to comment
Share on other sites

Please remove the formatting of the text in the post(when you paste the text in there is a "remove formatting" popup) or do not color it. Your post is impossible to read on the dark theme.

1. This is correct. If you really want you can register your particle with ParticleManager::registerParticle. You can add your own enum constant to EnumParticleTypes with EnumHelper but that is not necessary.

2. Your way is correct. To get an instance of a particle you either instantinate them, or get their IParticleFactory(if it is present) and invoke it's createParticle method.

3. That is the only particle registry. If a mod doesn't register their particle there - you can't. At that point the best you can do is reflection. A Particle is not a IForgeRegistryEntry - there are no registries for them.

4. Please clarify this point a bit more. A TextureMap is not your regular texture - if a sprite is not registered onto it it won't be there - TextureMap does not support dynamically adding textures to it. If you want to add your own texture to it you need to use TextureStitchEvent.Pre and TextureMap::registerSprite. The later returns you a TextureAtlasSprite object.

  • Like 1
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.

Announcements



×
×
  • Create New...

Important Information

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