TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Cakes do not decay, restore hunger or nutrition.

Woody-0w0 opened this issue · 3 comments

commented

Describe the request
Make sure to include:

  1. eat cakes in tfc?
  2. 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?

commented

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:

// This should never be called directly - when it is we assume it's direct stat modifications (saturation potion, eating cake)

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

commented

maybe fix the command "/playertfc add nutrition dairy|vegetables|grain number" could make it feasible,I can ignoring decay of cakes :D

commented

Nutrition doesn't work like that - you can't add static amounts directly. It's based off the nutrition of the last N foods you consumed (which is why we need more context than cakes give for it to be simply assigned nutrition.)