dannydjdk / Nutritional-Balance

A Minecraft mod that enhances the food system to encourage you to eat a balanced diet.
https://www.curseforge.com/minecraft/mc-mods/nutritional-balance
GNU General Public License v3.0
3 stars 6 forks source link

Placeable food items (?) #37

Open GoatGamerHUN opened 11 months ago

GoatGamerHUN commented 11 months ago

If I'm being correct, manually applying nutrient to placed blocks has no effect. For example, Tinkers' cakes have built-in compat and so they work. However, those that aren't compatible by default can't be made to have nutrients. For example, Sweet Berry Cheesecake from Farmer's Delight. Let's say I applied the "carbs" nutrient. It simply doesn't work.

My game version is 1.18.2, but I presume the situation is the same with all versions.

dannydjdk commented 11 months ago

Nutrients are defined by item tags, so either the cake item or one or more of its crafting ingredients need to be tagged. Also, the block has to be defined as an instance of the CakeBlock class. Otherwise, Nutritional Balance doesn't know you just clicked on an edible block.

If Tinkers' cakes work, then the above conditions have been met. I haven't done anything on my end to explicitly add compatibility for them.

Do the Farmer's Delight cheesecakes act like cake blocks where you just right click them and instantly consume a portion, or do you right click with a bowl, and then eat from the bowl like many other Farmer's Delight foods? If the former, then the cheesecake item needs to be tagged. If the latter, then the cheesecake bowl item that you actually eat has to be tagged.

GoatGamerHUN commented 11 months ago

Ahh, I see. How can I manually assing the CakeBlock class to a placeable food item? Is it a tag too?

dannydjdk commented 11 months ago

It's defined in the code. I just checked the Farmer's Delight source, and they are not inheriting CakeBlock or triggering any events to hook into. Unfortunately, that means it's not possible for NB to detect this. I'll need to figure out a workaround for this, though I'm not exactly sure what that would be at the moment. One big problem is that it is also possible to cut a slice from the cheesecake with a knife, so I can't just hook into the right click event like I do with regular cake.