Jump to content

[REQUEST] Request for hook in EffectRenderer.addEffect(EntityFX)


Recommended Posts

Posted

Hello

I just saw that Forge has a hook in EffectRenderer.addEffect(EntityFX,Object) but there seams to be no ability to get a own texture into EffectRenderer.addEffect(EntityFX) with Forge. This would be very useful for easily adding custom particles. I don't know if there was this request before, but this part would have to be recoded a little bit. My mod needs to bypass this atm by changing an if-statement in minecraft. But I would like my mod to be fully Forge-compatible, so it would be very nice, if you could add this.

 

P.S. I know, it is possible to do this in another way, but that is very complicated. not as nice as just letting the custom particle implement ITextureProvider

 

Thank you

Tobias

Posted

Channeling LexManos here:

If you can do something the hard way, do it the hard way. Don't ask for the easy way.

Done channeling.

But really, that would be nice to have.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Posted

Thank you for replying so fast.

Yes, I could set up a special Renderer for that, but this is really complicated in comparison to Creating a MyParticleFX.java and just letting this implement ITextureProvider and then using:

 

	EntitySmilieFX var21 = new EntitySmilieFX(mc.theWorld, playz0r.lastTickPosX,playz0r.lastTickPosY,playz0r.lastTickPosZ, 0.1D, 1.0D, 0.1D,5);
	mc.effectRenderer.addEffect((EntityFX)var21,var21);

 

but atm this

 

    public void addEffect(EntityFX effect, Object effectObject)
    {
        if (effectObject == null || !(effect instanceof EntityDiggingFX || effect instanceof EntityBreakingFX))
        {
            addEffect(effect);
            return;
        }
       :
       :

 

prevents this by calling addEffect(EntityFX)

 

    public void addEffect(EntityFX par1EntityFX)
    {
        int var2 = par1EntityFX.getFXLayer();

        if (this.fxLayers[var2].size() >= 4000)
        {
            this.fxLayers[var2].remove(0);
        }

        this.fxLayers[var2].add(par1EntityFX);
    }

 

Here, for some reason, the hashtable for linking a texture-file with the EntityFX is not used.

Using custom particles would be a LOT easier with this small change. I think this would not be too hard to change. I'll change this for my mod, so I can use this the easy way.

 

mfg,

Tobias

 

Posted

Sorry for double-posting, but found the easiest way for all modders:

    public void addEffect(EntityFX effect, Object effectObject)
    {
        if (effectObject == null || !(effect instanceof EntityDiggingFX || effect instanceof ITextureProvider || effect instanceof EntityBreakingFX))
        {
            addEffect(effect);
            return;
        }

        String texture = "/terrain.png";
        if (effect.getFXLayer() == 0)
        {
            texture = "/particles.png";
        }
        else if (effect.getFXLayer() == 2)
        {
            texture = "/gui/items.png";
        }        
        texture = ForgeHooksClient.getTexture(texture, effectObject);
        
        ArrayList<EntityFX> set = effectList.get(texture);
        if (set == null)
        {
            set = new ArrayList<EntityFX>();
            effectList.put(texture, set);
        }
        set.add(effect);
    }

 

Just a very small change in this if-statement.

Would be really cool, if you could implement this in forge!

 

Thank you

Tobias

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.