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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ya ya i get it boolean find = false; int count = 0; BlockState dblkstate; BlockPos bpos = null; BlockPos dpos = null; for(BlockPos cursor : todos_los_blockes ){ dpos = cursor; target.particle(cursor.getCenter()); dblkstate = warudo.getBlockState(cursor); if( !dblkstate.canBeReplaced() ){  //<---------- //if( dblkstate .getBlock() instanceof tubo ){ find = true; break; } bpos = cursor; count ++; } for this case setting blocks i can know discrimaniting by the  canbereplaced tag      thanks 
    • can we have a example of that for item    inever could make it work for item  for blocks i got this  
    • When opening I am directed to a log called ´´forge-1.20.1-47.2.20-installer.jar.log´´ below the following error is written: JVM info: Oracle Corporation - 21.0.2 - 21.0.2+13- LTS-58 java.net.preferIPv4Stack=true Current Time: 02/27/2024 16:58:33 Host: files.minecraftforge.net [51.79.83.165] Host: maven.minecraftforge.net [51.79.83.165] Host: libraries.minecraft.net [13.107.246.33, 13.107.213.33] Host: launchermeta.mojang.com [13.107.246.33, 13.107.213.33] Host: piston-meta.mojang.com [13.107.246.33, 13.107.213.33] java.net.UnknownHostException: This host is not known (authserver.mojang.com) at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52) at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211) at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828) at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688) at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:290) at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120) Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "net.minecraftforge.installer.DownloadUtils.getIps(String)" is null at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120)
    • I have downloaded forge version 1.20.4 and I have Java 17 installed but my .jar will not open and the error log text file below is created     JVM info: Oracle Corporation - 17.0.10 - 17.0.10+11-LTS-240 java.net.preferIPv4Stack=true Current Time: 27/02/2024 19:43:19 Host: files.minecraftforge.net [51.79.83.165, 2607:5300:203:65a5:0:0:0:0] Host: maven.minecraftforge.net [51.79.83.165, 2607:5300:203:65a5:0:0:0:0] Host: libraries.minecraft.net [13.107.246.64, 13.107.213.64, 2620:1ec:46:0:0:0:0:64, 2620:1ec:bdf:0:0:0:0:64] Host: launchermeta.mojang.com [13.107.213.64, 13.107.246.64, 2620:1ec:bdf:0:0:0:0:64, 2620:1ec:46:0:0:0:0:64] Host: piston-meta.mojang.com [13.107.213.64, 13.107.246.64, 2620:1ec:46:0:0:0:0:64, 2620:1ec:bdf:0:0:0:0:64] java.net.UnknownHostException: No such host is known (authserver.mojang.com)     at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)     at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933)     at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543)     at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)     at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1532)     at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1384)     at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1305)     at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:290)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120) Exception in thread "main"  java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "net.minecraftforge.installer.DownloadUtils.getIps(String)" is null     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120)  
    • we tried both versions and both cant run on her laptop for some reason idk what to do  
  • Topics

×
×
  • Create New...

Important Information

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