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, non meta user here!

i am working with damage bars and i'm having a bit of trouble.

i wanted to make an item that dosent break so i put in this code:

    public boolean isDamageable()

    {

        return this.getMaxDamage()>this.getMetadata(par1) ;

    }

waht would i put in the par1 to get the current item's damage value?

Also, I should have you know that you are reading my signature.

  • Author

im kinda rushed on this one guys.

anyone have anything?

Also, I should have you know that you are reading my signature.

I made my own tool class and it the events to damage items are these:

 

    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)

    {

        par1ItemStack.damageItem(2, par3EntityLiving);

        return true;

    }

 

    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)

    {

        par1ItemStack.damageItem(1, par7EntityLiving);

        return true;

    }

 

 

 

you can change it to this and the tools will not break:

 

    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)

    {

        if(par1ItemStack.getMaxDamage() == par1ItemStack.getItemDamage())

        {

            return true;

        }

        else

        {

              par1ItemStack.damageItem(2, par3EntityLiving);

              return true;

        }

    }

 

    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)

    {

        if(par1ItemStack.getItemDamage() == par1ItemStack.getMaxDamage())

        {

              return true;

        }

        else

        {

            par1ItemStack.damageItem(1, par7EntityLiving);

            return true;

          }

    }

 

 

hope it helps

I just make tools have -1 durability, does the same thing, you can't encahnt using an encahntment table however... (It's a "feature")

This is the creator of the Rareores mod! Be sure to check it out at

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.