Added mangoes

This commit is contained in:
Sollace 2023-05-21 17:37:38 +01:00
parent f6bca2bfa3
commit 31612a92a3
15 changed files with 59 additions and 1 deletions

View file

@ -39,6 +39,7 @@ public interface UTradeOffers {
}); });
TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 2, factories -> { 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, 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 -> { 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.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.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(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()); factories.add(new JarredItemTradeOfferFactory());
}); });
TradeOfferHelper.registerWanderingTraderOffers(2, factories -> { TradeOfferHelper.registerWanderingTraderOffers(2, factories -> {

View file

@ -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 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 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 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 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); Item ROCK = register("rock", new HeavyProjectileItem(new Item.Settings(), 3), ItemGroups.NATURAL);

View file

@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.item.toxin;
import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.*;
import com.minelittlepony.unicopia.util.RegistryUtils; import com.minelittlepony.unicopia.util.RegistryUtils;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import static com.minelittlepony.unicopia.item.toxin.Toxicity.*; import static com.minelittlepony.unicopia.item.toxin.Toxicity.*;
@ -112,6 +113,15 @@ public interface Toxics {
.with(Race.HUMAN, Ailment.INNERT) .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 void bootstrap() {}
static Toxic register(String name, Toxic.Builder builder) { static Toxic register(String name, Toxic.Builder builder) {

View file

@ -4,6 +4,7 @@ import java.util.List;
import com.minelittlepony.unicopia.entity.effect.UEffects; import com.minelittlepony.unicopia.entity.effect.UEffects;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.effect.StatusEffects;
@ -13,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.StringHelper; import net.minecraft.util.StringHelper;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
public interface Toxin extends Affliction { public interface Toxin extends Affliction {
@ -111,11 +113,16 @@ public interface Toxin extends Affliction {
return of(text, (player, stack) -> { return of(text, (player, stack) -> {
StatusEffectInstance current = player.getStatusEffect(effect); StatusEffectInstance current = player.getStatusEffect(effect);
float health = player.getHealth();
if (current != null) { if (current != null) {
player.addStatusEffect(new StatusEffectInstance(effect, ticks + current.getDuration(), amplifier + current.getAmplifier(), false, false, false)); player.addStatusEffect(new StatusEffectInstance(effect, ticks + current.getDuration(), amplifier + current.getAmplifier(), false, false, false));
} else { } else {
player.addStatusEffect(new StatusEffectInstance(effect, ticks, amplifier, false, false, false)); 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()));
}
}); });
} }

View file

@ -41,6 +41,7 @@ public interface UFoodComponents {
FoodComponent PINECONE = builder(0, 0.01F).snack().alwaysEdible().build(); FoodComponent PINECONE = builder(0, 0.01F).snack().alwaysEdible().build();
FoodComponent ACORN = builder(1, 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) { static FoodComponent.Builder builder(int hunger, float saturation) {
return new FoodComponent.Builder() return new FoodComponent.Builder()

View file

@ -73,6 +73,7 @@
"item.unicopia.juice": "Juice", "item.unicopia.juice": "Juice",
"item.unicopia.burned_juice": "Burned Juice", "item.unicopia.burned_juice": "Burned Juice",
"item.unicopia.mango": "Mango",
"item.unicopia.sunglasses": "Sunglasses", "item.unicopia.sunglasses": "Sunglasses",
"item.unicopia.broken_sunglasses": "Broken Sunglasses", "item.unicopia.broken_sunglasses": "Broken Sunglasses",

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/mango"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"unicopia:mango"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"unicopia:mango"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"unicopia:mango"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"unicopia:mango",
{ "id": "#c:mango", "required": false },
{ "id": "#c:mangoes", "required": false }
]
}

View file

@ -3,6 +3,7 @@
"values": [ "values": [
"#unicopia:food_types/raw_insect", "#unicopia:food_types/raw_insect",
"#unicopia:polearms", "#unicopia:polearms",
"unicopia:mango",
"unicopia:sunglasses", "unicopia:sunglasses",
"unicopia:broken_sunglasses" "unicopia:broken_sunglasses"
] ]

View file

@ -19,6 +19,7 @@
"unicopia:green_apple_seeds", "unicopia:green_apple_seeds",
"unicopia:sweet_apple_seeds", "unicopia:sweet_apple_seeds",
"unicopia:sour_apple_seeds", "unicopia:sour_apple_seeds",
"unicopia:mango",
"unicopia:empty_jar", "unicopia:empty_jar",
"unicopia:cooked_zap_apple", "unicopia:cooked_zap_apple",
"unicopia:zap_apple_jam_jar", "unicopia:zap_apple_jam_jar",
@ -31,6 +32,7 @@
"unicopia:hay_fries", "unicopia:hay_fries",
"unicopia:wheat_worms", "unicopia:wheat_worms",
"unicopia:muffin", "unicopia:muffin",
"unicopia:crystal_shard",
"unicopia:pebbles", "unicopia:pebbles",
"unicopia:rock", "unicopia:rock",
"unicopia:weird_rock", "unicopia:weird_rock",

View file

@ -4,6 +4,7 @@
"items": [ "items": [
"unicopia:green_apple_leaves", "unicopia:green_apple_leaves",
"unicopia:sweet_apple_leaves", "unicopia:sweet_apple_leaves",
"unicopia:sour_apple_leaves" "unicopia:sour_apple_leaves",
"unicopia:mango"
] ]
} }