BloodMagic
                                
                                 BloodMagic copied to clipboard
                                
                                    BloodMagic copied to clipboard
                            
                            
                            
                        [1.18] [Bug]: Sigil of the Green Grove is consumed when Forge's `BonemealEvent` returns `ALLOW`
Issue Description:
https://github.com/Fuzss/universalbonemeal-forge/issues/3
What happens:
My Universal Bone Meal adds new bone meal behavior to a bunch of blocks using Forge's BonemealEvent. This also works with the Sigil of the Green Grove, but the sigil is consumed in the process, which shouldn't happen.
The thing is, I don't shrink the stack size, that's Forge in ForgeEventFactory::onApplyBonemeal after the event returns Event.Result.ALLOW. You specifically call that hook in your code, so that will happen for any mod that returns Event.Result.ALLOW for the event.
A simple fix would be to not call the hook, but instead invoke the event directly, skipping any stack size changes. So this:
https://github.com/WayofTime/BloodMagic/blob/720c58a5bc0325e571a60997a138f0f283a0b7ec/src/main/java/wayoftime/bloodmagic/common/item/sigil/ItemSigilGreenGrove.java#L90
should just be replaced with something like this (it's the same code from the Forge hook, just no call to ItemStack::shrink):
        BonemealEvent event = new BonemealEvent(player, worldIn, pos, blockstate, stack);
        if (MinecraftForge.EVENT_BUS.post(event)) return -1;
        if (event.getResult() == Result.ALLOW) return 1;
What you expected to happen:
The sigil should remain in the inventory, the stacksize shouldn't change.
Steps to reproduce:
- Make BonemealEventreturnEvent.Result.ALLOWviaBonemealEvent::setResultfor any block
- Sigil of the Green Grove is consumed (=the item stack is deleted as it's count is shrunk by one)
Affected Versions (Do not use "latest"):
- BloodMagic: BloodMagic-1.18.2-3.2.6-41.jar
- Minecraft: 1.18.2
- Forge: ?
Thanks for digging into this issue. I'll make these adjustments soon!