User Tools

Site Tools


tutorial:particles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tutorial:particles [2021/09/09 20:49] – external edit 127.0.0.1tutorial:particles [2026/01/13 21:37] (current) cassiancc
Line 1: Line 1:
 +
 +~~REDIRECT>https://docs.fabricmc.net/develop/rendering/particles/creating-particles~~
 +
 ====== Adding Particles ====== ====== Adding Particles ======
 Particles are textures used for special events and additional VFX. They are used on explosions, torches, dripping water and more! Particles are textures used for special events and additional VFX. They are used on explosions, torches, dripping water and more!
Line 12: Line 15:
  
     // instance of our particle     // instance of our particle
-    public static final DefaultParticleType GREEN_FLAME = FabricParticleTypes.simple();+    public static final SimpleParticleType GREEN_FLAME = FabricParticleTypes.simple();
  
     @Override     @Override
     public void onInitialize() {     public void onInitialize() {
-        Registry.register(Registry.PARTICLE_TYPE, new Identifier("modid", "green_flame"), GREEN_FLAME);+        Registry.register(Registries.PARTICLE_TYPE, Identifier.fromNamespaceAndPath("modid", "green_flame"), GREEN_FLAME);
     }     }
  
Line 29: Line 32:
     @Override     @Override
     public void onInitializeClient() {     public void onInitializeClient() {
-        /* Adds our particle textures to vanilla's Texture Atlas so it can be shown properly. 
-         * Modify the namespace and particle id accordingly. 
-          
-         * This is only used if you plan to add your own textures for the particle. Otherwise, remove  this.*/ 
-        ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register(((atlasTexture, registry) -> { 
-            registry.register(new Identifier("modid", "particle/green_flame")); 
-        })); 
                  
         /* Registers our particle client-side.          /* Registers our particle client-side. 
Line 41: Line 37:
          * Second argument is the particle's factory. The factory controls how the particle behaves.           * Second argument is the particle's factory. The factory controls how the particle behaves. 
          * In this example, we'll use FlameParticle's Factory.*/          * In this example, we'll use FlameParticle's Factory.*/
-        ParticleFactoryRegistry.getInstance().register(ExampleMod.GREEN_FLAME, FlameParticle.Factory::new);+        ParticleFactoryRegistry.getInstance().register(ExampleMod.GREEN_FLAME, FlameParticle.Provider::new);
     }     }
  
tutorial/particles.txt · Last modified: 2026/01/13 21:37 by cassiancc