Jump to content

Recommended Posts

Posted (edited)

So I've been looking around for tutorials on custom particles and I can't find any up-to-date tutorials or anything on the forge doc. So far from what I can tell, spawning custom particles is different from vanilla since the spawnParticle method relies on the actual EnumParticleTypeClass. 

 

Basically, what I want to do is, when I place down a block, that block starts to slowly emit a purple particle effect. I already have the particle class, I just don't know how to get the block's position (which I think is impossible) or how to set the particles to start spawning from the block

 

ParticleManu.java:

  Reveal hidden contents

 

Edited by GooberGunter
Posted
  On 7/21/2017 at 6:00 PM, GooberGunter said:

Basically, what I want to do is, when I place down a block, that block starts to slowly emit a purple particle effect. I already have the particle class, I just don't know how to get the block's position (which I think is impossible) or how to set the particles to start spawning from the block

Expand  

See how BlockFurnace does this.

Custom particles are a thing that is not easily done afaik. You either need to add an enum constant to the EnumParticleType using EnumHelper and register your particle factory for the particleID you specify in your enum constant or you need to build your own particle system from the ground.

Posted (edited)

From the looks of it, the textureAtlasSprite class, which is what loads the texture for particles, has a built in forge method that allows for custom textures. if I'm looking at this right, it's promising.

  Reveal hidden contents

 

EDIT: It looks like I need a resource manager AND resource location. Sadly, I don't know how to do resource managers

Edited by GooberGunter
Posted

I've gotten as far as the resource manager, but I don't know how to set up the resource manager.

  Reveal hidden contents

 

Posted
  On 7/21/2017 at 8:28 PM, GooberGunter said:

I've gotten as far as the resource manager, but I don't know how to set up the resource manager.

Expand  

I'm not sure if you need to create your own IResourceManager for this(I don't really think you do, but I may be mistaken), but you can get a IResourceManager instance like so.

Minecraft.getMinecraft().getResourceManager();

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I tried that and it gave me the following null exception:

  Reveal hidden contents

 

Posted

In the client proxy class:

  Reveal hidden contents

At the bottom

Posted

In the BlockManuCogBlockH class

  Reveal hidden contents

 

Posted
  On 7/21/2017 at 8:59 PM, GooberGunter said:

In the BlockManuCogBlockH class

Expand  

Then I believe that your particleTexture field is null when you access it in your constructor.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

TextureAtlasSprite has nothing to do with particles. It is simply a 'pointer' to a location of a specific image on a texture sheet(or if we disassemble the name - it is a sprite of a texture atlas(aka map)). Forge just allows custom loading of your sprites with those methods. By default there is only 1 texture map in the game - the blocks+items textures map.

Particles have that field avaliable mostly for block/item crack/break particles, as they need to know what texture to be rendered with. This field is null for other particle types and theirt textureIndex determines their location on their texture map(default vanilla particles.png file).

If you need a custom texture for your particles you can return 1 in your Particle::getFXLayer to use the blocks+items map as your texture and then call Particle::setParticleTexture with a TextureAtlasSprite object that would point to your custom texture on the blocks map. You will need to load that texture yourself using TextureStitchEvent and TextureMap::registerSprite.

  • Like 1
Posted (edited)
  On 7/22/2017 at 12:31 AM, V0idWa1k3r said:

TextureAtlasSprite object that would point to your custom texture on the blocks map. You will need to load that texture yourself using TextureStitchEvent and TextureMap::registerSprite.

Expand  

TextureMap::registerSprite returns you a TextureAtlasSprite object. This method must be called during TextureStitchEvent.Pre

Edited by V0idWa1k3r
Posted

That TextureAtlasSprite object that you recieve as a result of this method. 

There is no regular stitch event. TextureStitchEvent has 2 sub-events - pre(as the map is being setup) and post(after everything was loaded in).

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If you're in Austria and trying the Temu app for the first time, this exclusive deal is for you. New users can apply the Temu discount code [alb232118] to instantly receive a €100 Temu coupon code bundle and a generous 30% discount on their first order over €10. This welcome offer is only valid for first-time users who complete their purchase within one hour of installing the Temu mobile app. Using this Temu promo code, you'll unlock a maximum discount of €30. The coupons are applied automatically once you register a new account through the app. Please note that this promotion is only available via the mobile version of Temu and cannot be used on desktop browsers. If you've already created a Temu account in the past, this offer won't apply. But for new users in Austria, this is the perfect way to start shopping and saving right away. Download the Temu app, enter the Temu discount code [alb232118], and enjoy massive savings with verified Temu coupon code rewards in Austria.      
    • New to Temu and located in Australia? Here's your chance to claim an exclusive welcome deal. By using the Temu discount code [alb232118], first-time users of the Temu mobile app can receive an AU$100 Temu coupon code package and enjoy an instant 30% off on their first purchase over AU$20. This offer is valid only for new users who make a qualifying purchase within one hour of installing the app. The Temu promo code [alb232118] grants a maximum discount of AU$30 and works automatically at checkout. The coupons are activated as soon as you sign up with a new account through the Temu mobile app. Note that this promotion is not available on desktop and is strictly for mobile use. If you’ve registered with Temu before, this offer won’t apply. But if you're a brand-new user in Australia, this is a smart way to start saving on your first shopping experience. Download the app today, apply the Temu discount code [alb232118], and unlock your AU$100 in coupons with extra savings thanks to this verified Temu coupon code.  
    • There are client-side-only mods in your server's mods folder DayCount is mentioned Start with removing this mod from your server - if this is still crashing, add the new crash-report  
    • hi, i cant start server on aternos bc this crash i poping out, im not a programist so for me its just a lot of words. anyone cna help me out? we just wanted to play mc on mods with da boys! crash report here: https://mclo.gs/pOtNvCQ  
    • Hi Everyone, I'm FlamingPigman! About 12 years ago I developed a mod called the Power Gems Mod, which added 7 new ores to the game and added some more uses for Lapis Lazuli. Each new ore is tied to a special power with an associated armor set and tools + a special weapon/tool and a special effect when you have a full armor set! I'm currently working on creating versions that can run on some of the more popular MC versions. If this sounds like a mod that interests you, check it out here: https://www.curseforge.com/minecraft/mc-mods/power-gems-mod Appreciate the support folks!
  • Topics

×
×
  • Create New...

Important Information

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