From 4d4647a3853d552688d7094503b024f699c5490d Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 12 Mar 2024 17:57:09 +0000 Subject: [PATCH] Added a nuts food category for hippogriffs --- .../com/minelittlepony/unicopia/diet/DietProfile.java | 5 ++++- src/main/resources/assets/unicopia/lang/en_us.json | 1 + src/main/resources/data/c/tags/items/nuts.json | 6 ++++++ .../unicopia/diets/food_effects/nuts_and_seeds.json | 11 +++++++++++ .../data/unicopia/diets/races/hippogriff.json | 7 +++++++ .../data/unicopia/tags/items/food_types/fruit.json | 3 ++- .../tags/items/food_types/nuts_and_seeds.json | 11 +++++++++++ 7 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/data/c/tags/items/nuts.json create mode 100644 src/main/resources/data/unicopia/diets/food_effects/nuts_and_seeds.json create mode 100644 src/main/resources/data/unicopia/tags/items/food_types/nuts_and_seeds.json diff --git a/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java b/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java index 104d6958..a71c8499 100644 --- a/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java +++ b/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java @@ -80,8 +80,11 @@ public record DietProfile( return null; } + float hunger = food.getHunger() * ratios.getFirst(); + int baseline = (int)hunger; + return FoodAttributes.copy(food) - .hunger(Math.max(1, (int)(food.getHunger() * ratios.getFirst()))) + .hunger(Math.max(1, (hunger - baseline) >= 0.5F ? baseline + 1 : baseline)) .saturationModifier(food.getSaturationModifier() * ratios.getSecond()) .build(); } diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index b3280703..9213335e 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -612,6 +612,7 @@ "tag.unicopia.food_types.cooked_fish": "Prepared Fish", "tag.unicopia.food_types.raw_insect": "Bugs & Insects", "tag.unicopia.food_types.cooked_insect": "Cooked Bugs & Insects", + "tag.unicopia.food_types.nuts_and_seeds": "Nuts & Seeds", "tag.unicopia.food_types.love": "Love", "tag.unicopia.food_types.rocks": "Rocks", "tag.unicopia.food_types.pinecone": "Nuts & Seeds", diff --git a/src/main/resources/data/c/tags/items/nuts.json b/src/main/resources/data/c/tags/items/nuts.json new file mode 100644 index 00000000..7fb489da --- /dev/null +++ b/src/main/resources/data/c/tags/items/nuts.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + { "id": "#c:crops/peanuts", "require": false } + ] +} diff --git a/src/main/resources/data/unicopia/diets/food_effects/nuts_and_seeds.json b/src/main/resources/data/unicopia/diets/food_effects/nuts_and_seeds.json new file mode 100644 index 00000000..30f205a2 --- /dev/null +++ b/src/main/resources/data/unicopia/diets/food_effects/nuts_and_seeds.json @@ -0,0 +1,11 @@ +{ + "tags": [ "unicopia:food_types/nuts_and_seeds" ], + "food_component": { + "hunger": 2, + "saturation": 2.5 + }, + "ailment": { + "effects": [ + ] + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/diets/races/hippogriff.json b/src/main/resources/data/unicopia/diets/races/hippogriff.json index f20a092a..c91d791e 100644 --- a/src/main/resources/data/unicopia/diets/races/hippogriff.json +++ b/src/main/resources/data/unicopia/diets/races/hippogriff.json @@ -10,6 +10,13 @@ "hunger": 1.6, "saturation": 1.6 }, + { + "tags": [ + "unicopia:food_types/nuts_and_seeds" + ], + "hunger": 1.4, + "saturation": 1.4 + }, { "tags": [ "unicopia:food_types/baked_goods" diff --git a/src/main/resources/data/unicopia/tags/items/food_types/fruit.json b/src/main/resources/data/unicopia/tags/items/food_types/fruit.json index b3f9d285..4421c2ff 100644 --- a/src/main/resources/data/unicopia/tags/items/food_types/fruit.json +++ b/src/main/resources/data/unicopia/tags/items/food_types/fruit.json @@ -13,6 +13,7 @@ { "id": "farmersdelight:pumpkin_slice", "required": false }, { "id": "farmersdelight:tomato", "required": false }, { "id": "farmersdelight:melon_juice", "required": false }, - { "id": "farmersdelight:fruit_salad", "required": false } + { "id": "farmersdelight:fruit_salad", "required": false }, + { "id": "#garnished:berries", "require": false } ] } diff --git a/src/main/resources/data/unicopia/tags/items/food_types/nuts_and_seeds.json b/src/main/resources/data/unicopia/tags/items/food_types/nuts_and_seeds.json new file mode 100644 index 00000000..20042716 --- /dev/null +++ b/src/main/resources/data/unicopia/tags/items/food_types/nuts_and_seeds.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "#c:seeds", + "#c:acorns", + "#c:nuts", + { "id": "#garnished:nuts", "require": false }, + { "id": "#garnished:nut_mix", "require": false }, + { "id": "#garnished:neverable_delecacies", "require": false } + ] +}