-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash When Eating Cake #113
Comments
Two things:
@SubscribeEvent
public void onGetHarvestDrops(BlockEvent.HarvestDropsEvent event)
{
if (event.getState().getBlock() == Blocks.CAKE && event.getState().getValue(BlockCake.BITES) == 0)
{
event.getDrops().add(new ItemStack(Items.CAKE));
}
} |
That single event hook would not account for all occasions where a cake block is broken in the world. I had been using events at one point, as seen here: PersistentCake.java#L25-L56. |
Ah, ok, block breaking is a pretty crazy tangle of unexpected behaviors 😢 . I've run into similar edge-cases when trying to use HarvestDropsEvent. Let me know if you run into any issues trying to use IEdibleBlock. EDIT: Also worth noting that in your case, the |
Poking around, the root issue is you will be holding a hard reference to the cake block ItemFoodProxy.java#L21 which is incompatible with registry replacements. EDIT: Secondly, I realise my class isn't the issue at all. I extend BlockCake, which would implement the interface at runtime. This is 100% an issue with your internal references not being compatible with registry replacements. ;-; Thirdly, discussing things inside an issue is frustrating lol, do you have Discord? There is a modded Minecraft discord (r/ftb) here. Ping |
Fixes #113, solves incompatibility with Persistent Cake mod
Ah, yes, you're totally right. Fixed in 0515815, and confirmed that it works without any interface compat. Will release new 1.12.x versions with the fix soon. Just for the sake of completeness, an alternative (less complete) 'fix' would be to have your mod add your block to AppleCore's edible block registry by doing: EDIT: Actually didn't realize you had merged the applecore branch into master. Checking if the version without the interface compat works now. EDIT#2: Confirmed to work without |
Should be fixed in AppleCore v3.1.1. You can safely revert ChloeDawn/PersistentCake@ddb991d if you want. |
Game crashes when trying to right-click/eat a cake block.
Mod version: 1.12.2-3.1.0
Crash report: pastebin.com/Ng1CYAXE
It may be worth noting I apply a registry replacement for the cake block, which might be the issue? I'm not sure. If that is the case, let me know what needs changing here to prevent issues with your mod.
Replacement instance: net.insomniakitten.cake.PersistentCakeBlock
The text was updated successfully, but these errors were encountered: