Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello all! :D

 

Before updating, I had my mob call an event when its health reached a certain point. However, "this.gethealth();" and "this.getMaxhealth();" are no longer useable. My question is, how do I recreate this functionality in 1.6.2? Here is my entity class, and thank you in advance! :D

 

EntityRiot_Zombie:

http://pastebin.com/4K69nMyL

 

Thanks to everyone who helps, and sorry if this is a bit noobish. :P

 

--Tenyar97

I haven't looked at your block yet, but I believe these are the functions you want for your mob.

 

func_110143_aJ()  should replace gethealth()

func_110138_aP() should be getMaxhealth()

 

EDIT:

Fixed your block,

the dispenser face uses the block icon name, there is two places to easily fix this.

 

when you set up your block make sure you have .func_111022_d("dispenser")

example:

dispenser = (new Dispenser(2000)).setHardness(3.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("dispenser").func_111022_d("dispenser");

 

or add it here:

 

protected Dispenser(int par1)

{

    super(par1);

    func_111022_d("dispenser");

    this.setCreativeTab(null);

}

 

  • Author

Thank you! My dispenser works properly now.  ;D

 

However, the functions you gave me don't seem to be doing anything. :( Below is my new code

 

public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
    {
        if (par1DamageSource.isFireDamage())
        {
            par2 = 0;
        }

        if (super.attackEntityFrom(par1DamageSource, par2))
        {
            if (par1DamageSource.getEntity() != null)
            {
                Entity par1Entity = par1DamageSource.getEntity();
                int j = 0;
                if (par1Entity instanceof EntityLiving)
                {
                    j += EnchantmentHelper.getKnockbackModifier((EntityLiving) par1Entity, this);

                    if (j > 0)
                    {
                        this.motionX /= 0.6D;
                        this.motionZ /= 0.6D;
                        this.addVelocity((double) (MathHelper.sin(par1Entity.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F), -0.1D,
                                (double) (-MathHelper.cos(par1Entity.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F));
                    }
                }

            }
    
    if (this.func_110143_aJ() < this.func_110138_aP() * 0.75)
    {
        stage++;
        System.out.println("Stage advanced!");
    } else if (stage == 1 && this.func_110143_aJ() < this.func_110138_aP() * 0.5)
    {
    	stage++;
        System.out.println("Stage advanced, again!");
    } else if (stage == 2 && this.func_110143_aJ() < this.func_110138_aP() * 0.25)
    {
        stage++;
    }
    return true;
}

return false;
}

 

I have a feeling that it is my fault, and the health values are messed up, because I'm not familiar with this new system, but before I get myself anymore confused, I'm asking. :P

 

Thanks! :D

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.