#Get how much hunger an item restores?

17 messages · Page 1 of 1 (latest)

arctic spear
#

I want to write a script to get me a list of all food items, as well as the crafting tree for all such food items, but I don't know how to determine if an item is a food item to begin with, let alone how much hunger that item restores. How do I go about this?

winged walrusBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

vocal herald
#

there is Nutrition and saturation modifier, for example

#

Here is some values from foods, and the script I made get only foods with >= 0.6 saturation modifier

arctic spear
#

This is great, thanks! I want to do some stuff with this data using a python script, so is there a way to get just the names of the items?

vocal herald
#

you can export the items to json using JsonIO
did you decided which values you want to filter? from nutrition/saturation mod

arctic spear
#

I just want all items that restore any hunger at all

#

All the food items, pretty much

#

So I set it to >= 0

#

Whoops, I meant > 0

vocal herald
#

use JsonIO.write("local/kubejs/foodItems.json", {"foods": list})

arctic spear
#

Also, I can't find an example of json io exporting in example-scripts, do you know where I can find one?

arctic spear
#

Alright, that's everything I need to do some chicanery, thanks so much!

#

Pretty much I want to set an AdminShop sell price for all of the food items. I'll start by creating a tree of crafting recipes for the food to determine the root items (eg. crops, raw meat, etc.) and give them a manual price. Next, I'll work my way up the tree and set the price of any items that have all of their ingredients prices set, generally to the sum of all of the ingredient prices * some constant like 1.2 or something based on the crafting method.

#

Fun little weekend project for a modpack I've been meaning to make for a long while 🙂