Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Terrible Kludge][1.14.2] Making custom shears work on leaves
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
Sinhika

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

By Sinhika, June 19 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Sinhika    7

Sinhika

Sinhika    7

  • Stone Miner
  • Sinhika
  • Members
  • 7
  • 60 posts
Posted June 19 (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 June 29 by Sinhika
  • Quote

Share this post


Link to post
Share on other sites

Sinhika    7

Sinhika

Sinhika    7

  • Stone Miner
  • Sinhika
  • Members
  • 7
  • 60 posts
Posted June 23

Also, does anyone know if there's anything being done at the Forge end about this?

  • Quote

Share this post


Link to post
Share on other sites

Sinhika    7

Sinhika

Sinhika    7

  • Stone Miner
  • Sinhika
  • Members
  • 7
  • 60 posts
Posted June 23 (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 June 23 by Sinhika
  • Quote

Share this post


Link to post
Share on other sites

Sinhika    7

Sinhika

Sinhika    7

  • Stone Miner
  • Sinhika
  • Members
  • 7
  • 60 posts
Posted June 29 (edited)

We need a better way to do this. One of the problems I foresaw above has already come to pass: conflicting mod shears' drop tables.  Help?

 

ETA: Thread about that problem:

 

 

Edited June 30 by Sinhika
added link to relevant topic
  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      [1.12.2] NBT inconsistencies

      By diesieben07 · Posted 8 minutes ago

      Did you verify your tile entity was being saved? Or just the custom item?
    • BeardlessBrady
      [1.12.2] NBT inconsistencies

      By BeardlessBrady · Posted 9 minutes ago

      I was not, I added it to all the places I change the data and it did not change the issue unfortunately. 
    • diesieben07
      [1.12.2] NBT inconsistencies

      By diesieben07 · Posted 16 minutes ago

      Are you calling markDirty on your tile entity whenever you change it's data?
    • BeardlessBrady
      [1.12.2] NBT inconsistencies

      By BeardlessBrady · Posted 21 minutes ago

      I tried debugging the #toNBT and #fromNBT methods in my itemVendor class. It seems to only save the NBT when I pause the game for the very first time after first placing the block but when I quit the world it does not save the NBT nor does it do it when I pause any other time. It will however save NBT and load NBT on world startup... Any ideas?
    • diesieben07
      pw.mods.fml.common.LoaderException: java.lang.NoSuchFieldError: rock

      By diesieben07 · Posted 1 hour ago

      1.7.10 is no longer supported on this forum due to it's age. Update to a modern version of Minecraft to receive support.
  • Topics

    • BeardlessBrady
      7
      [1.12.2] NBT inconsistencies

      By BeardlessBrady
      Started Yesterday at 04:12 AM

    • Baconator
      4
      pw.mods.fml.common.LoaderException: java.lang.NoSuchFieldError: rock

      By Baconator
      Started 4 hours ago

    • BruhSoundEffectNumberTwo
      1
      [SOLVED] [1.14.4] How do I read a Jsonarray from a file?

      By BruhSoundEffectNumberTwo
      Started 1 hour ago

    • plugsmustard
      6
      JSON questions

      By plugsmustard
      Started Yesterday at 07:28 PM

    • meloncin
      1
      forge no me funciona

      By meloncin
      Started 3 hours ago

  • Who's Online (See full list)

    • BeardlessBrady
    • Draco18s
    • BruhSoundEffectNumberTwo
    • diesieben07
    • plugsmustard
    • BatHeart
    • F43nd1r
    • Blackout03
    • SerpentDagger
    • Mustacheman013
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Terrible Kludge][1.14.2] Making custom shears work on leaves
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community