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

Hi i am a new to modding and am trying to get a item to take damage in the crafting grid.

at the moment i can craft with the item and it takes durability damage but once it takes one durability damage i can not use the item to craft with again.

 

import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;



public class ItemIronPress extends Item{



public ItemIronPress(int id) {
	super(id);
	maxStackSize = 1;
	setMaxDamage(10 - 1);
	setNoRepair();
	// TODO Auto-generated constructor stub
    


}

	@Override 
	public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {

     return false;
     
    }


	@Override
	 public ItemStack getContainerItemStack(ItemStack itemStack) {

	     itemStack.setItemDamage(itemStack.getItemDamage() + 1);
	     
	     	return itemStack;
	     	
	    }

 

Any help that you guys can give is appreciated

Thanks

  • Author

Thanks for replying. I have no idea how to do that.

This is my code for the recipe the tool is going to be used in

        GameRegistry.addRecipe(new ItemStack(carbonDust, 4),
                new Object[] {"i","c",
            Character.valueOf('c'), Item.coal,
            Character.valueOf('i'), ironPress
        });

You can use ItemStacks instead of Items or Blocks in your recipes, so you'd replace

ironPress

with

new ItemStack(ironPress(1, -1)

  • Author

i have put that in to my code and what i get is an error saying to create a method

ironPress(int, int) when i create the method it doesn't work

 

this is the code for the recipe changed to how u suggested i might not have implemented it properly.

       GameRegistry.addRecipe(new ItemStack(carbonDust, 4),
                new Object[] {"i","c",
            Character.valueOf('c'), Item.coal,
            Character.valueOf('i'), new ItemStack(ironPress(1, -1))
        });

 

here is the pastebin for the error report i am getting http://pastebin.com/bY9mKtyv

 

thanks again for your help

  • Author

Thank you that worked. but it did present a new problem the tool leaves the crafting table after 10 uses like i want it to but the recipe doesn't reset. so when the tool is go i can still get the carbon dust from the remaining stack of coal.

  • Author

Never mind that problem is sorted it was just me being a derp and leaving a shapeless recipe in that shouldn't have been.

 

Thanks again for the help much appreciated

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.