From 31612a92a3adcab485e7bbd46b47682deb614750 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 21 May 2023 17:37:38 +0100 Subject: [PATCH] Added mangoes --- .../unicopia/entity/UTradeOffers.java | 2 ++ .../com/minelittlepony/unicopia/item/UItems.java | 1 + .../unicopia/item/toxin/Toxics.java | 10 ++++++++++ .../unicopia/item/toxin/Toxin.java | 7 +++++++ .../unicopia/item/toxin/UFoodComponents.java | 1 + .../resources/assets/unicopia/lang/en_us.json | 1 + .../assets/unicopia/models/item/mango.json | 6 ++++++ .../assets/unicopia/textures/item/mango.png | Bin 0 -> 2009 bytes src/main/resources/data/c/tags/items/fruit.json | 6 ++++++ src/main/resources/data/c/tags/items/fruits.json | 6 ++++++ .../resources/data/c/tags/items/mangoes.json | 6 ++++++ .../tags/items/food_types/bat_ponys_delight.json | 8 ++++++++ .../unicopia/tags/items/groups/bat_pony.json | 1 + .../unicopia/tags/items/groups/earth_pony.json | 2 ++ .../unicopia/traits/organic_plant_derived.json | 3 ++- 15 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/unicopia/models/item/mango.json create mode 100644 src/main/resources/assets/unicopia/textures/item/mango.png create mode 100644 src/main/resources/data/c/tags/items/fruit.json create mode 100644 src/main/resources/data/c/tags/items/fruits.json create mode 100644 src/main/resources/data/c/tags/items/mangoes.json create mode 100644 src/main/resources/data/unicopia/tags/items/food_types/bat_ponys_delight.json diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java b/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java index 1b541108..26721e32 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UTradeOffers.java @@ -39,6 +39,7 @@ public interface UTradeOffers { }); TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 2, factories -> { factories.add(buy(Items.EMERALD, 4, UTags.APPLE_SEEDS, 2, 20, 1, 0.05F)); + factories.add(buy(Items.EMERALD, 8, UItems.MANGO, 1, 15, 1, 0.025F)); }); TradeOfferHelper.registerWanderingTraderOffers(1, factories -> { @@ -50,6 +51,7 @@ public interface UTradeOffers { factories.add(buy(UItems.ZAP_APPLE, 45, UItems.ZAP_APPLE_JAM_JAR, 5, 50, 3, 0.07F)); factories.add(buy(UItems.CIDER, 1, UItems.FRIENDSHIP_BRACELET, 1, 6, 1, 0.05F)); factories.add(buy(UItems.GEMSTONE, 5, UTags.FRESH_APPLES, 2, 12, 3, 0.05F)); + factories.add(buy(Items.EMERALD, 4, UItems.MANGO, 1, 35, 1, 0.025F)); factories.add(new JarredItemTradeOfferFactory()); }); TradeOfferHelper.registerWanderingTraderOffers(2, factories -> { diff --git a/src/main/java/com/minelittlepony/unicopia/item/UItems.java b/src/main/java/com/minelittlepony/unicopia/item/UItems.java index ee357920..6b04956e 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/item/UItems.java @@ -74,6 +74,7 @@ public interface UItems { Item MUFFIN = register("muffin", new MuffinItem(new Item.Settings().maxCount(32).food(FoodComponents.BREAD), 0), ItemGroups.FOOD_AND_DRINK); Item PINECONE = register("pinecone", new Item(new Item.Settings().food(UFoodComponents.PINECONE).maxCount(3)), ItemGroups.FOOD_AND_DRINK); Item ACORN = register("acorn", new Item(new Item.Settings().food(UFoodComponents.ACORN).maxCount(16)), ItemGroups.FOOD_AND_DRINK); + Item MANGO = register("mango", new Item(new Item.Settings().food(UFoodComponents.MANGO)), ItemGroups.FOOD_AND_DRINK); Item PEBBLES = register("pebbles", new RacePredicatedAliasedBlockItem(UBlocks.ROCKS, new Item.Settings(), Race::canUseEarth), ItemGroups.NATURAL); Item ROCK = register("rock", new HeavyProjectileItem(new Item.Settings(), 3), ItemGroups.NATURAL); diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java index 144aa925..64486cd6 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxics.java @@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.item.toxin; import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.util.RegistryUtils; +import net.minecraft.entity.effect.StatusEffects; import net.minecraft.registry.Registry; import static com.minelittlepony.unicopia.item.toxin.Toxicity.*; @@ -112,6 +113,15 @@ public interface Toxics { .with(Race.HUMAN, Ailment.INNERT) ); + Toxic BAT_PONYS_DELIGHT = register("bat_ponys_delight", new Toxic.Builder(Ailment.INNERT) + .with(Race.BAT, Ailment.of(Toxicity.SAFE, + Toxin.of(StatusEffects.HEALTH_BOOST, 30, 2) + .and(Toxin.of(StatusEffects.JUMP_BOOST, 30, 1)) + .and(Toxin.of(StatusEffects.SPEED, 30, 1)) + .and(Toxin.of(StatusEffects.REGENERATION, 3, 3)) + )) + ); + static void bootstrap() {} static Toxic register(String name, Toxic.Builder builder) { diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java index d9de87c1..d5ecaeda 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/Toxin.java @@ -4,6 +4,7 @@ import java.util.List; import com.minelittlepony.unicopia.entity.effect.UEffects; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -13,6 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.StringHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.Difficulty; public interface Toxin extends Affliction { @@ -111,11 +113,16 @@ public interface Toxin extends Affliction { return of(text, (player, stack) -> { StatusEffectInstance current = player.getStatusEffect(effect); + float health = player.getHealth(); if (current != null) { player.addStatusEffect(new StatusEffectInstance(effect, ticks + current.getDuration(), amplifier + current.getAmplifier(), false, false, false)); } else { player.addStatusEffect(new StatusEffectInstance(effect, ticks, amplifier, false, false, false)); } + // keep original health + if (effect.getAttributeModifiers().containsKey(EntityAttributes.GENERIC_MAX_HEALTH)) { + player.setHealth(MathHelper.clamp(health, 0, player.getMaxHealth())); + } }); } diff --git a/src/main/java/com/minelittlepony/unicopia/item/toxin/UFoodComponents.java b/src/main/java/com/minelittlepony/unicopia/item/toxin/UFoodComponents.java index 3200ee2e..8e7d56d7 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/toxin/UFoodComponents.java +++ b/src/main/java/com/minelittlepony/unicopia/item/toxin/UFoodComponents.java @@ -41,6 +41,7 @@ public interface UFoodComponents { FoodComponent PINECONE = builder(0, 0.01F).snack().alwaysEdible().build(); FoodComponent ACORN = builder(1, 0.01F).snack().alwaysEdible().build(); + FoodComponent MANGO = builder(8, 0.8F).alwaysEdible().build(); static FoodComponent.Builder builder(int hunger, float saturation) { return new FoodComponent.Builder() diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index c422727e..b837e5f6 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -73,6 +73,7 @@ "item.unicopia.juice": "Juice", "item.unicopia.burned_juice": "Burned Juice", + "item.unicopia.mango": "Mango", "item.unicopia.sunglasses": "Sunglasses", "item.unicopia.broken_sunglasses": "Broken Sunglasses", diff --git a/src/main/resources/assets/unicopia/models/item/mango.json b/src/main/resources/assets/unicopia/models/item/mango.json new file mode 100644 index 00000000..eba4d587 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/mango.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/mango" + } +} diff --git a/src/main/resources/assets/unicopia/textures/item/mango.png b/src/main/resources/assets/unicopia/textures/item/mango.png new file mode 100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Q9ziN;O#9Te#~O}g2|;(l9x^RQ-W7)SvOvYR zqi$Bzf(Js@4+w``kyst{NhEH4*ZVzIC}!Mv>%m6ScAymaoDVV6+a|X{8)3Xh~MTXa!QaQj$0qmXj6`BQWIC z4fmL9JrM*EL+GcU;NPPH14qwZZ2)&9Uo|`0iq9x?j?+;do^zC0%N*znd4w(xBrux& z2gL3RbiP>2gj&Kq3FE?#eZ9ed1IFYx z?&lv`_XFm)uo0oYkF&|l)9+NaD+Cai^ARM_<$BlwEj^)>*mHo6Z^QxGuOYcVDH(#k zV=%tKy$l_e>np8^)Tf-Q%TOnNy|I33-G7?!yX{{Yl7WIWqY(W!=P3Blo;4b@0005# zNkljxr6r41&vBzeE@Jr03ZQt;BNPM&bjBD3;!5ukW2T@!2BBo zV0z(KM*j`Ga~f{fz`7m`Fn4x<3Lcz;B!b*QX?RGE9@tLSZqV(7EG@(PZ>Y=n{~&mD z9y$?N3+3@KsZJhZYh?%0dW+54+_?JzKm|Trn(KSQOikke90Y-pBh|f3R3^yQR>+*f zF~ZbAFa}BT9^?HChmphjO15k(GkJI)qvI9u%1E+Ip8JRk7z#kiM$&ab7&(&M$nolK z%KJ~CZIdicvGsYh(GUx15}@=j^;UPY0EJvQS;DLA!R0wF^GQ}eBVmZ~EQOIVT-KsI zYVgc&#`viPDoZhO6PF3$%16k1J=TR1N)#pkJ4^MDLJ@3i3O1^e400000NkvXXu0mjf`pMSZ literal 0 HcmV?d00001 diff --git a/src/main/resources/data/c/tags/items/fruit.json b/src/main/resources/data/c/tags/items/fruit.json new file mode 100644 index 00000000..2f6d5efe --- /dev/null +++ b/src/main/resources/data/c/tags/items/fruit.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "unicopia:mango" + ] +} diff --git a/src/main/resources/data/c/tags/items/fruits.json b/src/main/resources/data/c/tags/items/fruits.json new file mode 100644 index 00000000..2f6d5efe --- /dev/null +++ b/src/main/resources/data/c/tags/items/fruits.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "unicopia:mango" + ] +} diff --git a/src/main/resources/data/c/tags/items/mangoes.json b/src/main/resources/data/c/tags/items/mangoes.json new file mode 100644 index 00000000..2f6d5efe --- /dev/null +++ b/src/main/resources/data/c/tags/items/mangoes.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "unicopia:mango" + ] +} diff --git a/src/main/resources/data/unicopia/tags/items/food_types/bat_ponys_delight.json b/src/main/resources/data/unicopia/tags/items/food_types/bat_ponys_delight.json new file mode 100644 index 00000000..8309c0f0 --- /dev/null +++ b/src/main/resources/data/unicopia/tags/items/food_types/bat_ponys_delight.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "unicopia:mango", + { "id": "#c:mango", "required": false }, + { "id": "#c:mangoes", "required": false } + ] +} diff --git a/src/main/resources/data/unicopia/tags/items/groups/bat_pony.json b/src/main/resources/data/unicopia/tags/items/groups/bat_pony.json index 5bbf16f4..9055f23e 100644 --- a/src/main/resources/data/unicopia/tags/items/groups/bat_pony.json +++ b/src/main/resources/data/unicopia/tags/items/groups/bat_pony.json @@ -3,6 +3,7 @@ "values": [ "#unicopia:food_types/raw_insect", "#unicopia:polearms", + "unicopia:mango", "unicopia:sunglasses", "unicopia:broken_sunglasses" ] diff --git a/src/main/resources/data/unicopia/tags/items/groups/earth_pony.json b/src/main/resources/data/unicopia/tags/items/groups/earth_pony.json index 82a2d37f..5f8d8fc8 100644 --- a/src/main/resources/data/unicopia/tags/items/groups/earth_pony.json +++ b/src/main/resources/data/unicopia/tags/items/groups/earth_pony.json @@ -19,6 +19,7 @@ "unicopia:green_apple_seeds", "unicopia:sweet_apple_seeds", "unicopia:sour_apple_seeds", + "unicopia:mango", "unicopia:empty_jar", "unicopia:cooked_zap_apple", "unicopia:zap_apple_jam_jar", @@ -31,6 +32,7 @@ "unicopia:hay_fries", "unicopia:wheat_worms", "unicopia:muffin", + "unicopia:crystal_shard", "unicopia:pebbles", "unicopia:rock", "unicopia:weird_rock", diff --git a/src/main/resources/data/unicopia/traits/organic_plant_derived.json b/src/main/resources/data/unicopia/traits/organic_plant_derived.json index dc650d27..c2167d62 100644 --- a/src/main/resources/data/unicopia/traits/organic_plant_derived.json +++ b/src/main/resources/data/unicopia/traits/organic_plant_derived.json @@ -4,6 +4,7 @@ "items": [ "unicopia:green_apple_leaves", "unicopia:sweet_apple_leaves", - "unicopia:sour_apple_leaves" + "unicopia:sour_apple_leaves", + "unicopia:mango" ] } \ No newline at end of file