Jump to content

Recommended Posts

Posted (edited)

Hi, i'm trying to add a recipe that lowers the durability of a tool in the crafting table but i can't figure out how to do it.

Here is an example of the basic json file where a melon is cut into 4 slices with an axe

{
  "type": "minecraft:crafting_shapeless",
  "category": "misc",
  "ingredients": [
    [
      "minecraft:melon"
    ],
    "#minecraft:axes"
  ],
  "result": {
    "id": "minecraft:melon_slice",
    "count": 4
  }
}

The axe disappears with this method, how do i get to lower the durability of the axe?

Edited by yoggiou
fix typo
  • yoggiou changed the title to [1.21.3] Lower the durability of a tool in a crafting table recipe
Posted

You need to create a custom recipe type that overrides IRecipe#getRemainingItems to return a copy of the axe with its durability reduced.

I've got a very similar recipe implementation here, there's code in other parts of the repository to handle things like registration and data generation.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.