Plants drop seeds when harvested. Bug? (a18+)
TokkenGmr opened this issue ยท 4 comments
I was doing some testing in the current 19a release, did something change with seeds? In previous builds I would only get seeds from crops if I broke them with a left click. My JSON files do not have seeds as an output for products. The seed drop chance was set to 1.0 and everything worked like I was expecting. Now with the seed drop chance set to 1.0 I get seeds when I harvest and when I break the plant. If I set seed drop chance to 0.0 then I no longer get a seed at all.
Perhaps set seed drop chance to 0, and use a trowel clippers when you need to move the plant?
EDIT: Clippers are the right tool
@TokkenGmr Went back and looked at this, found the cause. A big commit on May 24th subtly changed the logic for this. It was first included in a18, but since that didn't run it wouldn't have shown up until a19 (like you noticed).
So there used to be a method called getFruits
. It would calculate the produce, and get called by either onHarvested
or getDrops
. The latter of those adds the seeds to the drop and gets called by onBroken
and onRaked
.
As a result of that big refactor, those things got simplified: getDrops
calculates everything itself (no more fruit method), and onHarvested
now uses it as well. Which means you don't have separate behavior for harvesting any more.
Now, @RlonRyan would know best if that was an intentional change or not. I myself hadn't notice the behavior, and wasn't sure what was correct. Plus, vanilla does throw a lot of seeds at you. But in my personal estimation, getting seeds like that undermines a large part of the mechanics (regular spreading, clippings, and the trowel). It can become trivial to fill a whole field, unless the seed drop chance is very low. So I've wanted the mechanic to be the other way already, but I didn't have confirmation until now that it possibly should be that way officially anyhow.
What to do? I'm going to chew on it. Like I said, there were those major changes that moved code around, and combined stuff. So I can't just call a different method. It doesn't exist any more! And I will probably ask for more input. But it should be straight forward to figure out. Keep your fingers crossed?
I went ahead and put the change for this into a21
. After testing the fix for a while, and making sure that harvesting, raking, and breaking all worked, I could immediately say that I felt the difference in gameplay.
In the photo, you can see how I ended up with exactly two seeds for almost all of them. The items in the second row are the fruits, so they don't have the NBT tags. And the third row has the vanilla seed without any tag, which were how I jump-started the crops. And if these were plants with good stats, then I would still only have the couple of each with the high stat. I should clarify that it's two seeds each because creative planting doesn't consume any. And so after I went grow -> harvest -> grow -> rake -> plant -> grow -> break, I would end up with an extra one each. Could have demo'ed it better. ;)
I do want to write the code a better way at some point, but for now it works.