Posted November 12, 20178 yr 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: This is the result after I shift-click on the output:
November 12, 20178 yr Author 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; } }
November 12, 20178 yr 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
November 12, 20178 yr Author Thanks anyways. Edited November 12, 20178 yr by ChampionAsh5357 My idea didn't affect the outcome whatsoever
November 12, 20178 yr 1 hour ago, ChampionAsh5357 said: Thanks anyways. tomorrow i can maybe help you
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.