Jump to content

1.12.2 Problem with a shapeless recipe and Ore Dictionary


Maideniles

Recommended Posts

I have an item which takes durability damage in the crafting table after each crafting.  I have it registered in the ore dictionary using the WILDCARD_VALUE. When I use the item in a shaped recipe, the item takes durability damage and is reusable just as it's supposed to be. But if I make a shapeless recipe, it becomes completely useless after only being used once.  Can someone help me figure out where I goofed up with this? Thank you.

The item class:

public class ItemMortarAndPestle extends Item {

	private Item containerItem;

	public ItemMortarAndPestle(String name) {

		setUnlocalizedName(name);
		setRegistryName(name);
		setMaxStackSize(1);
		setMaxDamage(64);
		setNoRepair();
	}

	@Override
	public boolean hasContainerItem() {
		return true;
	}
	
	 @Override
	public ItemStack getContainerItem(ItemStack itemStack) {
		return itemStack.getItemDamage() < itemStack.getMaxDamage() ? new ItemStack(itemStack.getItem(), 1, itemStack.getItemDamage() + 1) : ItemStack.EMPTY;  
	}
}

 The item's Ore Dictionary registry entry:
 

	OreDictionary.registerOre("mortar_and_pestle", new ItemStack(ItemInit.mortar_n_pestle, 1, OreDictionary.WILDCARD_VALUE));

 

And lastly, an example of a shapeless recipe in which the item is used:  (This example stops working after one use)

{ 
  "type": "minecraft:crafting_shapeless",
  "ingredients": [
    {
	  "item": "maidensmaterials:amethyst_chunk"
	},
	
	{
	  "type": "forge:ore_dict",
			"ore": "mortar_and_pestle"
	}
  ],
  "result": {
    "item": "maidensmaterials:amethyst_fragments",
    "count": 8
  }
}

 

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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