[1.18-BUG] Wheat seeds are consumed twice over when used on farmland
Delfite opened this issue ยท 11 comments
Information
Minecraft version: 1.18
Modloader: Fabric
Fabric loader version: 0.12.8
Environment: Singleplayer
Mod name: Grass Seeds
Mod version: grassseeds-fabric_1.18.x-1.6.jar
Description
When using wheat seeds on farmland they are consumed twice instead of once.
Showcase of the bug: https://youtu.be/ysOOCN9gbRc
Crash report
Still an issue in Minecraft 1.18.2/Fabric 0.13.3/Grass Seeds 1.6
The wheat seeds are being used to plant grass on the dirt block below the farmland. If the farmland is above a different block, only 1 wheat seed will be consumed. See video.
Okay two things:
- That's kinda weird how it just bypasses the farmland on the first seed use
- WMG actually released the claim on my video when I disputed it which is just weird to think about
I didn't realise at first this was Grass Seeds and missed this thread when I was searching for the issue due to wording. Issue is still actively present today and very annoying, as it can eat an entire stack of seeds if you aren't careful.
Is there any update on this? We are experiencing it on our server to a degree where my players are asking for the mod to be removed. However, I really like the feature and was hoping it might be something easily fixable.
I haven't done any work with a multi-loader project, but I'd be willing to take a stab at this if you are interested in a PR.
Based on my testing, the answer to both of those is, in fact, "yes".
Edit: there probably needs to be a check along these lines:
BlockPos hitpos = BlockPosFunctions.getBlockPosFromHitResult(hitResult);
BlockPos cpos = BlockPosFunctions.getBlockPosFromHitResult(hitResult).below();
Block hitblock = world.getBlockState(hitpos).getBlock();
Block block = world.getBlockState(cpos).getBlock();
if (!hitblock.equals(Blocks.FARMLAND) && block.equals(Blocks.DIRT)) {
- Does planting wheat cost just 1 seed (not 2) if the block below the farmland is NOT dirt?
- When planting wheat seeds on farmland with dirt below, does the dirt below (briefly) turn into a grass block?
This can be tested by either digging up the farmland right after planting the seed.
If the answer is yes to both of these, then the if condition in the following code must be true:
https://github.com/ricksouth/serilum-mc-mods/blob/b2eb98b90833cda6a878368a81d0cebbb44a8077/sources-fabric/Grass%20Seeds%20(Fabric)/src/main/java/com/natamus/grassseeds/events/GrassEvent.java#L38-L40
@ricksouth would you accept a PR fixing this?
Hey, no worries. I understand how that goes, and life definitely comes first! I'll try to get a PR your way this evening.
Apologies, I'm slowly getting back into modding after a break due to other obligations. If you want to open a PR I'll definitely merge it. Thanks
This has been fixed in version 2.2 of Grass Seeds. Thanks for using the mod and opening the issue!
https://www.curseforge.com/minecraft/mc-mods/grass-seeds-fabric/files