AgriCraft

AgriCraft

30M Downloads

Weeding producing extra crop-sticks

dshadowwolf opened this issue ยท 3 comments

commented

Recently spotted that using a hand-rake to weed seems to be giving me crop-sticks in addition to weed seeds. I'm pretty certain that giving me crop-sticks and leaving the set in the world is not an intended effect.

commented

You're welcome!

[For later reference: line 395.]

commented

I was just looking at the related code, so I can at least link to the probable cause of this.

  • In the TileEntityCrops::getDrops method, crop sticks are included with the drops. L138
  • And that method (different from the Block or Event variations) is called in at least four different places:
    • When you punch a crop, destroying it and getting back the sticks/seeds/fruit. L127
    • When a crop is raked, causing the plant and seed to be removed, but the crop left in place. L393
    • And finally inside BlockCrop::getDrops L212 and BlockCrop::dropBlockAsItemWithChance L117.

Speculation: Given that three out of the four are when the crop is being destroyed, the simplest solution I can think of is to change the lambda inside TileEntityCrop::onRaked to filter out crop sticks. I don't have an IDE in front of me right now, but perhaps something like:

stack -> if (stack.getItem() != AgriItems.getInstance().CROPS) WorldHelper.spawnItemInWorld(this.worldObj, this.pos, stack)

Hope any of this is helpful!

commented

This has been fixed for the next alpha. Thanks for the report!

Also, thanks @CodesCubesAndCrashes for the in-depth analysis!