Cakes do not decay, restore hunger or nutrition.
Woody-0w0 opened this issue · 3 comments
Describe the request
Make sure to include:
- eat cakes in tfc?
- add player food and nutrition!
Meta Info
- TFC Version: 1.5.2.152
- now this is a compatibility feature with other mods, hope a enhancement for TFC alone.
- now, Crafttweaker2\ContentTweaker\modtweaker required
create eat_cake_in_tfc.zs in scripts file fold:
import crafttweaker.events.IEventManager;
import crafttweaker.event.PlayerInteractBlockEvent;
import crafttweaker.block.IBlock;
import mods.contenttweaker.Commands;
import crafttweaker.player.IPlayer;
import crafttweaker.player.IFoodStats;
events.onPlayerInteractBlock(function(event as crafttweaker.event.PlayerInteractBlockEvent){
val block as IBlock = event.block;
if (block.definition.id == "minecraft:cake"&& event.player.foodStats.foodLevel < 20 ) { // get cake && check food
Commands.call("playertfc add food 5", event.player, event.world, false, false);
// Commands.call("playertfc add nutrition dairy 10", event.player, event.world, false, false); // not feasible
}
});
maybe an update will fix it.
and.... could you add cake like foodRegistry compat for crafttweaker?
Yes, eating cakes will not work as cakes call the food stat methods directly (i.e. without providing an item). AKA no, we can't hook externally into cakes without replacing them as they call this:
which we no-op due to it not having the required context.
This is a rather fundamental issue with blocks that are meant to be food items (vanilla carrots, potatoes, cake, pumpkins, melons). They don't transfer expiration dates correctly and thus we basically ignore their existence (or their effect).
and.... could you add cake like foodRegistry compat for crafttweaker?
Due to the above reasons this would require a lot more than just the item. (I believe the best solution would be registry replacement, but that's rather annoying.)
maybe fix the command "/playertfc add nutrition dairy|vegetables|grain number" could make it feasible,I can ignoring decay of cakes :D