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

Ok so I am trying to make a crafting item for my mod that has 2 tiers. One of the tiers I want 1 durability to be taken from the items durability EXCEPT when I am trying to upgrade it to tier 2. Then I want it to take 5 durability from it. However I am having trouble changing the amount taken based on crafting.

 

 

Crystal class (item, both tiers are called to this class)

package items;

import keystuff.myMod;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;


public class Crystals extends Item
{

   

   public Crystals()
   {

      setCreativeTab(myMod.daftcraft);
      setMaxDamage(5);

   }

   @Override
   public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
   {
      return false;

   }

   @Override
   public ItemStack getContainerItem(ItemStack itemStack)
   {
      
      ItemStack cStack=itemStack.copy();
      cStack.setItemDamage(cStack.getItemDamage()+1);
      cStack.stackSize=1;
      return cStack;

   }


   @Override
   public boolean hasContainerItem(ItemStack stack)
   {
      return stack.getItemDamage()<5;
   }

}//class

 

 

crafting recipe

 

GameRegistry.addRecipe(new ItemStack(rubyCrystalT2),
              " D ",
              "DRD",
              " D ",
              'R',new ItemStack(rubyCrystal,1,OreDictionary.WILDCARD_VALUE),
              'D',Items.diamond);

 

setting the items

public static Item rubyCrystal;
   public static Item rubyCrystalT2;

rubyCrystalT2=new Crystals().setUnlocalizedName("ruby tier 2");
      GameRegistry.registerItem(rubyCrystalT2,"ruby tier 2");

      rubyCrystal=new Crystals().setUnlocalizedName("ruby");
      GameRegistry.registerItem(rubyCrystal,"ruby");

 

This uses the code but only reduces durability by 1 for them all.

Any helps would be appreciated

thanks

 

 

 

 

 

 

 

 

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.