squeek502 / AppleCore

An API for modifying the food and hunger mechanics of Minecraft
The Unlicense
55 stars 24 forks source link

Allow event to decide whether cake be eaten while full #108

Closed primetoxinz closed 6 years ago

primetoxinz commented 6 years ago

as per title. As per BTW cake is supposed to be edible even when hunger is full.

squeek502 commented 6 years ago

To be clear, you're talking about BlockCake, right?

primetoxinz commented 6 years ago

Correct, being able to somehow pass ignore to if (player.canEat(false)) in BlockCake

squeek502 commented 6 years ago

Hm, I see two possible implementations, and I'm not sure which would be better.

The second would be faster as it'd avoid having to fire events, but it might be more confusing for developers because IEdible wouldn't show up as implemented by BlockCake in their IDEs...

primetoxinz commented 6 years ago

I also think the latter would be preferable, as long as it is well documented I don't think the IDE information is too big of a deal. Doubt many people will need this hook anyways

squeek502 commented 6 years ago

Sounds good, will try to get this done in the next few days.

squeek502 commented 6 years ago

Ok, got it tested and working in 1.7.10. Need to port it forward now (which might take a little while ☹️ ). Just FYI, the way to do it will be: ((IEdibleBlock) Blocks.CAKE).setEdibleAtMaxHunger(true)

primetoxinz commented 6 years ago

Awesome. Take your time, not dire on my end. Thanks for the hard work though :)

squeek502 commented 6 years ago

Released v3.1.0: http://www.ryanliptak.com/maven/

Let me know if you have any issues with it.

primetoxinz commented 6 years ago

Works great, thanks :)