Food Effects

Food Effects

173k Downloads

Feature Suggestion: Setting global eating duration.

MattB70 opened this issue · 2 comments

commented

I've been reading through your classes looking for something obvious that may be causing issue #5 , and saw your implementation for changing eating times to be nice and simple. I've been searching for a method to speed up the eating time of all foods and believe this mod would be the place for that feature to live. Here is two methods of implementing what I'm thinking:

A preferable method:

Detect when any food item is being eaten, and set the event duration to a preset time (say 16 ticks for half the eating time), then let the event naturally end with its new duration. (I'm not sure if this method would work, I really don't know much about foods.

A less elegant method:

On server start // (delayed to allow mods other mods to load first, does @PostInit still exist?)
{

  • iterate through all Food items // assuming food items are still identified as being of type 'Food'.
  • generate a map of [food_item,[saturation,hunger]] // this list should be short as I don't suspect there to ever be more than a couple hundred food items.
  • when player begins eating an item, grab the corresponding map entry (you could hash all this to improve runtime speed) and apply its stats after a preset time (say 16 ticks for half the eating time), and then remove 1 item from the itemstack. effectively simulating the consumption of the food. This method would likely break other mods.

}

Ultimately, I'm looking for a way to make eating foods faster to find a middle ground between pre and post hunger Minecraft.

I wrote this in the middle of the night, so sorry if it wasn't all that clear. Thanks for your time and I hope you find this suggestion at least interesting! :)
I didn't see anything obvious causing #5.

commented

Hi there! I just posted #7, a suggestion for a config overhaul which would implement your suggestion.

commented

Outdated, closing.