Jump to content

Recommended Posts

Posted

I originally created an item that would lose durability each time it was used in the crafting table. I managed to get the code to work properly, but there is a problem wen I shift-click the crafting recipe output. I created a shapeless recipe where it took my container item and another item and converted it into an output. However, if I shift-clicked the output to my inventory, it would convert all the items even if there wasn't enough durability for the entire stack. What I've noticed is that it initially checks the first one and then skips to the last one after it converted all the items. I want to know if there is a way to have it so that shift-clicking only converts the items to the amount of durability still left on the item.

 

This is taking my container item with only one durability and a stack of items in the crafting table:2017-11-11_23_40_30.thumb.png.25f58ff255fd7a6369c565c995faeb4b.png

 

This is the result after I shift-click on the output:

2017-11-11_23_40_38.thumb.png.850e6ddbb5962208085bbf42cc5aa4e4.png

Posted
public class ItemCutter extends Item {

	public ItemCutter() {
		setUnlocalizedName("cutter");
		setRegistryName("itemcutter");
		setCreativeTab(CreativeTabs.MISC);
		setNoRepair();
		setMaxDamage(79);
		setMaxStackSize(1);
	}
	
	@Override
	public boolean hasContainerItem(ItemStack stack) {
		return true;
	}
	
	 @Override
	public ItemStack getContainerItem(ItemStack itemStack) {
		return itemStack.getItemDamage() < itemStack.getMaxDamage() ? new ItemStack(itemStack.getItem(), 1, itemStack.getItemDamage() + 1) : ItemStack.EMPTY;
	}
}

 

Posted

ok, then im sorry but im not very known with those,

i always create my own IRecipe implementing recipe class for that sort of stuff, i think it might be something in the forge recipe json parsing but im not 100% sure, try and find the class who reads the recipe jsons and maybe you find the method which is broken or maybe you can find the way how its suposed to be, i dont have time to do it for you,

 

im sorry for that 

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.

Announcements



×
×
  • Create New...

Important Information

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