mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Added sun-related death messages
This commit is contained in:
parent
9824801609
commit
2a13627b3f
4 changed files with 40 additions and 32 deletions
|
@ -6,11 +6,11 @@ import com.minelittlepony.unicopia.EquinePredicates;
|
|||
import com.minelittlepony.unicopia.UTags;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.trinkets.TrinketsDelegate;
|
||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||
|
@ -37,8 +37,8 @@ public class SunBlindnessStatusEffect extends StatusEffect {
|
|||
if (entity.age % 15 == 0) {
|
||||
if (!hasSunExposure(entity)) {
|
||||
entity.setStatusEffect(new StatusEffectInstance(this, (int)(state.getDuration() * 0.8F), Math.max(1, amplifier - 1), true, false), entity);
|
||||
} else if (amplifier > 1) {
|
||||
entity.damage(DamageSource.IN_FIRE, amplifier / 20F);
|
||||
} else {
|
||||
entity.damage(amplifier == 2 ? MagicalDamageSource.SUN : MagicalDamageSource.SUNLIGHT, amplifier / 5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
}
|
||||
}
|
||||
|
||||
if (entity.hurtTime == 1) {
|
||||
if (entity.hurtTime == 1 && getSpecies().canCast()) {
|
||||
corruption.add(1);
|
||||
setDirty();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.unicopia.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -15,17 +14,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.text.Text;
|
||||
|
||||
public class MagicalDamageSource extends EntityDamageSource {
|
||||
|
||||
public static final DamageSource EXHAUSTION = new MagicalDamageSource("magical_exhaustion", null, true, true);
|
||||
public static final DamageSource ALICORN_AMULET = new MagicalDamageSource("alicorn_amulet", null, true, true);
|
||||
public static final DamageSource FOOD_POISONING = mundane("food_poisoning");
|
||||
public static final DamageSource TRIBE_SWAP = mundane("tribe_swap");
|
||||
public static final DamageSource FOOD_POISONING = new DamageSource("food_poisoning");
|
||||
public static final DamageSource TRIBE_SWAP = new DamageSource("tribe_swap");
|
||||
public static final DamageSource ZAP_APPLE = create("zap");
|
||||
public static final DamageSource KICK = create("kick");
|
||||
|
||||
public static DamageSource mundane(String type) {
|
||||
return new DamageSource(type) {};
|
||||
}
|
||||
public static final DamageSource SUN = new DamageSource("sun").setBypassesArmor().setFire();
|
||||
public static final DamageSource SUNLIGHT = new DamageSource("sunlight").setBypassesArmor().setFire();
|
||||
public static final DamageSource PETRIFIED = new DamageSource("petrified").setBypassesArmor().setFire();
|
||||
|
||||
public static MagicalDamageSource create(String type) {
|
||||
return new MagicalDamageSource(type, null, null, false, false);
|
||||
|
@ -84,22 +81,23 @@ public class MagicalDamageSource extends EntityDamageSource {
|
|||
|
||||
@Nullable
|
||||
Entity attacker = source != null ? source : target.getPrimeAdversary();
|
||||
ItemStack item = attacker instanceof LivingEntity ? ((LivingEntity)attacker).getMainHandStack() : ItemStack.EMPTY;
|
||||
|
||||
if (attacker != null) {
|
||||
if (attacker == target) {
|
||||
basic += ".self";
|
||||
} else {
|
||||
basic += ".attacker";
|
||||
params.add(attacker.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack item = attacker instanceof LivingEntity ? ((LivingEntity)attacker).getMainHandStack() : ItemStack.EMPTY;
|
||||
|
||||
if (!item.isEmpty() && item.hasCustomName()) {
|
||||
basic += ".item";
|
||||
params.add(item.toHoverableText());
|
||||
}
|
||||
} else if (!item.isEmpty() && item.hasCustomName()) {
|
||||
basic += ".item";
|
||||
params.add(attacker.getDisplayName());
|
||||
params.add(item.toHoverableText());
|
||||
} else if (attacker != null) {
|
||||
basic += ".player";
|
||||
params.add(attacker.getDisplayName());
|
||||
}
|
||||
|
||||
return Text.translatable(basic, params.toArray());
|
||||
}
|
||||
|
|
|
@ -493,28 +493,38 @@
|
|||
|
||||
"death.attack.generic.and_also": "%1$s and %2$s",
|
||||
"death.attack.tribe_swap": "%1$s was reborn into a different tribe",
|
||||
"death.attack.sun": "%1$s stared into the sun",
|
||||
"death.attack.sun.player": "%1$s stared into the sun whilst fighting %2$s",
|
||||
"death.attack.sunlight": "%1$s was burned by the sun",
|
||||
"death.attack.sunlight.player": "%1$s was burned by the sun whilst fighting %2$s",
|
||||
"death.attack.petrified": "%1$s turned to stone",
|
||||
"death.attack.petrified.player": "%1$s turned to stone whilst fighting %2$s",
|
||||
"death.attack.magical_exhaustion": "%1$s exhausted themselves",
|
||||
"death.attack.magical_exhaustion.player": "%1$s exhausted themselves whilst fighting %2$s",
|
||||
"death.attack.alicorn_amulet": "%1$s was driven insane",
|
||||
"death.attack.alicorn_amulet.player": "%1$s went insane whilst fighting %2$s",
|
||||
"death.attack.darkness": "%1$s went missing",
|
||||
"death.attack.feed": "%1$s was drained of all life",
|
||||
"death.attack.feed.attacker": "%1$s died to feed %2$s",
|
||||
"death.attack.feed.player": "%1$s died to feed %2$s",
|
||||
"death.attack.drain": "%1$s was drained of all life",
|
||||
"death.attack.drain.self": "%1$s was killed by their own spell",
|
||||
"death.attack.drain.attacker": "%1$s was killed by a spell cast by %2$s",
|
||||
"death.attack.drain.player": "%1$s was killed by a spell cast by %2$s",
|
||||
"death.attack.eeee": "%1$s was frightened to death",
|
||||
"death.attack.eeee.attacker": "%2$s scared %1$s",
|
||||
"death.attack.eeee.attacker.item": "%1$s was frightened to death by %2$s using %3$s",
|
||||
"death.attack.eeee.player": "%2$s scared %1$s",
|
||||
"death.attack.eeee.item": "%1$s was frightened to death by %2$s using %3$s",
|
||||
"death.attack.eeee.self": "%1$s scared themselves to death",
|
||||
"death.attack.smash": "%1$s was crushed under hoof",
|
||||
"death.attack.smash.attacker": "%1$s was crushed by %2$s",
|
||||
"death.attack.smash.player": "%1$s was crushed by %2$s",
|
||||
"death.attack.zap": "%1$s bit into a Zap Apple",
|
||||
"death.attack.zap.player": "%1$s bit into a Zap Apple whilst fighting %2$s",
|
||||
"death.attack.paradox": "%1$s imploded",
|
||||
"death.attack.paradox.player": "%1$s imploded with some help from %2$s",
|
||||
"death.attack.food_poisoning": "%1$s died of food poisoning",
|
||||
"death.attack.food_poisoning.attacker": "%2$s poisoned %1$s to death",
|
||||
"death.attack.food_poisoning.player": "%2$s poisoned %1$s to death",
|
||||
"death.attack.black_hole": "%1$s was sucked into a black hole",
|
||||
"death.attack.black_hole.attacker": "%1$s got sucked into %2$s's black hole",
|
||||
"death.attack.black_hole.player": "%1$s got sucked into %2$s's black hole",
|
||||
"death.attack.kick": "%1$s was kicked really hard",
|
||||
"death.attack.kick.attacker": "%2$s kicked %1$s really hard",
|
||||
"death.attack.kick.player": "%2$s kicked %1$s really hard",
|
||||
|
||||
"unicopia.subtitle.flap_wings": "Wing flaps",
|
||||
"unicopia.subtitle.dash": "Pony Dashes",
|
||||
|
|
Loading…
Reference in a new issue