Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

I'm not an expert on particles, but I know that you can spawn them by World#spawnParticle.

 

  • Author
On 25.7.2017 at 5:23 PM, Alexiy said:

I'm not an expert on particles, but I know that you can spawn them by World#spawnParticle.

 

Yeah, but that only works for vanilla particles 

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.