Integrate changeling love sickness into the toxics system so we can have more nuanced control over what makes changelings sick

This commit is contained in:
Sollace 2022-09-30 10:37:56 +02:00
parent 5fff677f79
commit aa724f56b0
4 changed files with 43 additions and 49 deletions

View file

@ -17,6 +17,7 @@ public interface UTags {
TagKey<Item> MAGIC_FEATHERS = item("magic_feathers");
TagKey<Item> SHADES = item("shades");
TagKey<Item> CHANGELING_EDIBLE = item("food_types/changeling_edible");
TagKey<Item> POLEARMS = item("polearms");
TagKey<Item> APPLE_SEEDS = item("apple_seeds");

View file

@ -25,7 +25,6 @@ import com.minelittlepony.unicopia.entity.effect.SunBlindnessStatusEffect;
import com.minelittlepony.unicopia.entity.effect.UEffects;
import com.minelittlepony.unicopia.item.FriendshipBraceletItem;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.item.toxin.Toxin;
import com.minelittlepony.unicopia.network.Channel;
import com.minelittlepony.unicopia.network.MsgOtherPlayerCapabilities;
import com.minelittlepony.unicopia.network.MsgPlayerAnimationChange;
@ -543,12 +542,6 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
return getCharms().getArmour().contains(UItems.ALICORN_AMULET) || super.isEnemy(other);
}
public void onEat(ItemStack stack) {
if (getSpecies() == Race.CHANGELING) {
Toxin.LOVE_SICKNESS.afflict(getMaster(), stack);
}
}
@Override
public void toNBT(NbtCompound compound) {
super.toNBT(compound);

View file

@ -7,85 +7,94 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import static com.minelittlepony.unicopia.item.toxin.Toxicity.*;
import static com.minelittlepony.unicopia.item.toxin.Ailment.*;
import static com.minelittlepony.unicopia.item.toxin.Toxin.*;
public interface Toxics {
Registry<Toxic> REGISTRY = Registries.createSimple(new Identifier("unicopia:toxic"));
Toxic EDIBLE = register("forage_edible", new Toxic.Builder(Ailment.of(SAFE, INNERT))
Toxic EDIBLE = register("forage_edible", new Toxic.Builder(Ailment.INNERT)
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING))
.with(Race.CHANGELING, of(FAIR, LOVE_SICKNESS))
);
Toxic RISKY = register("forage_risky", new Toxic.Builder(Ailment.of(FAIR, WEAK_NAUSEA.withChance(20)))
Toxic RISKY = register("forage_risky", new Toxic.Builder(of(FAIR, WEAK_NAUSEA.withChance(20)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING))
);
Toxic MODERATE = register("forage_moderate", new Toxic.Builder(Ailment.of(MILD, POISON.and(WEAK_NAUSEA)))
Toxic MODERATE = register("forage_moderate", new Toxic.Builder(of(MILD, POISON.and(WEAK_NAUSEA)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING))
);
Toxic DANGEROUS = register("forage_dangerous", new Toxic.Builder(Ailment.of(SEVERE, FOOD_POISONING))
Toxic DANGEROUS = register("forage_dangerous", new Toxic.Builder(of(SEVERE, FOOD_POISONING))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(NAUSEA)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(NAUSEA)))
);
Toxic NAUSEATING = register("forage_nauseating", new Toxic.Builder(Ailment.of(SAFE, NAUSEA.and(WEAKNESS.withChance(30))))
Toxic NAUSEATING = register("forage_nauseating", new Toxic.Builder(of(SAFE, NAUSEA.and(WEAKNESS.withChance(30))))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(NAUSEA)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(NAUSEA)))
);
Toxic RADIOACTIVE = register("forage_radioactive", new Toxic.Builder(Ailment.of(SAFE, NAUSEA.and(RADIOACTIVITY.withChance(30))))
Toxic RADIOACTIVE = register("forage_radioactive", new Toxic.Builder(of(SAFE, NAUSEA.and(RADIOACTIVITY.withChance(30))))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(NAUSEA)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(NAUSEA)))
);
Toxic PRICKLY = register("forage_prickly", new Toxic.Builder(Ailment.of(SAFE, PRICKLING.withChance(30)))
Toxic PRICKLY = register("forage_prickly", new Toxic.Builder(of(SAFE, PRICKLING.withChance(30)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(NAUSEA)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(NAUSEA)))
);
Toxic STRENGHTENING = register("forage_strengthening", new Toxic.Builder(Ailment.of(SEVERE, STRENGTH.and(WEAK_NAUSEA)))
Toxic STRENGHTENING = register("forage_strengthening", new Toxic.Builder(of(SEVERE, STRENGTH.and(WEAK_NAUSEA)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(WEAKNESS)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(WEAKNESS)))
);
Toxic SEVERELY_NAUSEATING = register("forage_severely_nauseating", new Toxic.Builder(Ailment.of(SEVERE, STRONG_NAUSEA.and(WEAKNESS)))
Toxic SEVERELY_NAUSEATING = register("forage_severely_nauseating", new Toxic.Builder(of(SEVERE, STRONG_NAUSEA.and(WEAKNESS)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING.and(WEAKNESS)))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING.and(WEAKNESS)))
);
Toxic BLINDING = register("forage_blinding", new Toxic.Builder(Ailment.of(SEVERE, BLINDNESS.and(WEAK_NAUSEA)))
Toxic BLINDING = register("forage_blinding", new Toxic.Builder(of(SEVERE, BLINDNESS.and(WEAK_NAUSEA)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING))
);
Toxic SEVERELY_PRICKLY = register("forage_severely_prickly", new Toxic.Builder(Ailment.of(SEVERE, PRICKLING.and(NAUSEA)))
Toxic SEVERELY_PRICKLY = register("forage_severely_prickly", new Toxic.Builder(of(SEVERE, PRICKLING.and(NAUSEA)))
.food(UFoodComponents.RANDOM_FOLIAGE)
.with(Race.HUMAN, Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.HUMAN, of(LETHAL, FOOD_POISONING))
);
Toxic RAW_MEAT = register("raw_meat", new Toxic.Builder(Ailment.of(SEVERE, FOOD_POISONING.withChance(5).and(POISON.withChance(20))))
Toxic RAW_MEAT = register("raw_meat", new Toxic.Builder(of(SEVERE, FOOD_POISONING.withChance(5).and(POISON.withChance(20))))
.with(Race.HUMAN, Ailment.INNERT)
.with(Race.BAT, Ailment.of(MILD, WEAK_NAUSEA))
.with(Race.CHANGELING, Ailment.INNERT)
.with(Race.BAT, of(MILD, WEAK_NAUSEA))
);
Toxic ROTTEN_MEAT = register("rotten_meat", new Toxic.Builder(Ailment.of(SEVERE, FOOD_POISONING.and(POISON)))
Toxic ROTTEN_MEAT = register("rotten_meat", new Toxic.Builder(of(SEVERE, FOOD_POISONING.and(POISON)))
.with(Race.HUMAN, Ailment.INNERT)
.with(Race.BAT, Ailment.of(MILD, STRONG_NAUSEA))
.with(Race.BAT, of(MILD, STRONG_NAUSEA))
.with(Race.CHANGELING, Ailment.INNERT)
);
Toxic COOKED_MEAT = register("cooked_meat", new Toxic.Builder(Ailment.of(FAIR, FOOD_POISONING))
Toxic COOKED_MEAT = register("cooked_meat", new Toxic.Builder(of(FAIR, FOOD_POISONING))
.with(Race.HUMAN, Ailment.INNERT)
.with(Race.CHANGELING, Ailment.INNERT)
.with(Race.BAT, Ailment.INNERT)
);
Toxic RAW_FISH = register("raw_fish", new Toxic.Builder(Ailment.of(FAIR, FOOD_POISONING.and(POISON)))
Toxic RAW_FISH = register("raw_fish", new Toxic.Builder(of(FAIR, FOOD_POISONING.and(POISON)))
.with(Race.HUMAN, Ailment.INNERT)
.with(Race.PEGASUS, Ailment.of(MILD, POISON.and(WEAK_NAUSEA)))
.with(Race.PEGASUS, of(MILD, POISON.and(WEAK_NAUSEA)))
.with(Race.ALICORN, Ailment.INNERT)
.with(Race.CHANGELING, of(FAIR, LOVE_SICKNESS))
);
Toxic COOKED_FISH = register("cooked_fish", new Toxic.Builder(Ailment.of(MILD, FOOD_POISONING))
Toxic COOKED_FISH = register("cooked_fish", new Toxic.Builder(of(MILD, FOOD_POISONING))
.with(Race.HUMAN, Ailment.INNERT)
.with(Race.PEGASUS, Ailment.INNERT)
.with(Race.ALICORN, Ailment.INNERT)
.with(Race.CHANGELING, of(FAIR, LOVE_SICKNESS))
);
Toxic RAW_INSECT = register("raw_insect", new Toxic.Builder(Ailment.of(LETHAL, FOOD_POISONING))
.with(Race.BAT, Ailment.of(MILD, WEAK_NAUSEA))
Toxic RAW_INSECT = register("raw_insect", new Toxic.Builder(of(LETHAL, FOOD_POISONING))
.with(Race.BAT, of(MILD, WEAK_NAUSEA))
.with(Race.CHANGELING, Ailment.INNERT)
);
Toxic COOKED_INSECT = register("cooked_insect", new Toxic.Builder(Ailment.of(LETHAL, FOOD_POISONING))
Toxic COOKED_INSECT = register("cooked_insect", new Toxic.Builder(of(LETHAL, FOOD_POISONING))
.food(UFoodComponents.INSECTS)
.with(Race.CHANGELING, Ailment.INNERT)
.with(Race.BAT, Ailment.INNERT)
);

View file

@ -25,7 +25,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stat.Stats;
import net.minecraft.util.Unit;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@Mixin(PlayerEntity.class)
abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<Pony>, PlayerEntityDuck {
@ -62,14 +61,6 @@ abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<P
Pony.registerAttributes(info.getReturnValue());
}
@Inject(method = "eatFood(Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;",
at = @At("HEAD"))
private void onEatFood(World world, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
if (stack.isFood()) {
get().onEat(stack);
}
}
@Inject(method = "trySleep(Lnet/minecraft/util/math/BlockPos;)Lcom/mojang/datafixers/util/Either;",
at = @At("HEAD"),
cancellable = true)