Jump to content

[Terrible Kludge][1.14.2] Making custom shears work on leaves


Recommended Posts

Posted (edited)

Advice wanted.

 

So: one can subclass ShearItem and make an adequate custom shear item that will shear sheep just fine. The problem is, it won't cut leaf blocks like minecraft:shears will. I did a bit of spelunking in the code and loot tables, and found that leaves being obtainable by breaking with shears is specified in the loot-table for each leaf block, by tool name (e.g. "minecraft:shears"). Because of this questionable design decision, the only way I can see to make custom shears work is to somehow iterate over all the vanilla loot-tables for each and every leaf type and add my custom shears (plural) to the list of tools that make leaves drop.

 

First, is there a way to do this programmatically? I'm pretty sure it has changed since 1.12, everything else has. Second, how does one replace vanilla loot tables? Finally, any general advice on the best way to solve this problem?

Edited by Sinhika
Posted (edited)

It's a clumsy hack, but you can just override the vanilla loot tables with your own copies of them. I edited the "oak_leaves" loot table to add my mod shears. I'll have to edit all the other leaf loot tables as well. Unfortunately, this solution doesn't make my mod shears work on anyone else's leaves, nor do any other mod shears work on minecraft leaves unless they make the same override tables. It's not an ideal solution. Ideally, we'd have a shears tooltype that would dictate behavior on shear-harvestable things, not have to specify every single scythe, shear, sickle or kama in Every Single Leaf, Grass, Fern, other vegetation loot table.

 

Tags would seem a solution to this, except the "item" predicates in loot table conditions don't seem to recognize tags.

Edited by Sinhika

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.