Jump to content

Forge Hooks


Jade_Knightblazer

Recommended Posts

Hiya, I am just about finished porting my "Asgard Shield" Mod to Forge and have ran into one last step.

 

Are there any hooks I can use for this line of code I normally edit in the EntityPlayer.class "og.class"

 

//Mod_shield

par2 = mod_AsgardShield.calcDamage(par1DamageSource, par2, this);

//end

 

 

    protected void damageEntity(DamageSource par1DamageSource, int par2)
    {
        if (!par1DamageSource.isUnblockable() && this.isBlocking())
        {
            par2 = 1 + par2 >> 1;
        }
//Mod_shield
par2 = mod_AsgardShield.calcDamage(par1DamageSource, par2, this);
//end
        par2 = this.applyArmorCalculations(par1DamageSource, par2);
        par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
        this.addExhaustion(par1DamageSource.getHungerDamage());
        this.health -= par2;
    }

 

If no hooks are around, then am I still able to modify the EntityPlayer.class or have to use Player API?

Link to comment
Share on other sites

Sweet Lex, please direct me xD. I been looking for a nice wiki or just a class file with all the hooks in it. (Only way I learn coding is to dive into it @_@ )

 

I really wish to take full advantage of Forge and would like to learn what it can do. You gave me a starting point, but please more info.

 

-Thanks in advance

 

Looking through all the events, only one seems sorta what I am looking for is:

 

@Cancelable

public class LivingHurtEvent extends LivingEvent

{

    public final DamageSource source;

    public int ammount;

    public LivingHurtEvent(EntityLiving entity, DamageSource source, int ammount)

    {

        super(entity);

        this.source = source;

        this.ammount = ammount;

    }

 

}

 

But forgive me, how would I use it? @_@

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.



×
×
  • Create New...

Important Information

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