AppleCore

AppleCore

56M Downloads

Allow event to decide whether cake be eaten while full

primetoxinz opened this issue · 9 comments

commented

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

commented

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

commented

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

commented

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

  • An event that allows modifying that boolean, as suggested
  • Have AppleCore make BlockCake implement IEdible and then add a setAlwaysEdible method to IEdible a la ItemFood. Then, to make BlockCake always edible you'd do something like ((IEdible)Blocks.CAKE).setAlwaysEdible(true) at startup.

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...

commented

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

commented

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

commented

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

Let me know if you have any issues with it.

commented

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)

commented

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

commented

Works great, thanks :)