Give spikes their own damage type

This commit is contained in:
Sollace 2024-02-06 15:44:12 +00:00
parent f3f38aae7b
commit c30ef7e9c1
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
6 changed files with 9 additions and 4 deletions

View file

@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.block;
import org.joml.Vector3f;
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SideShapeType;
@ -37,7 +39,7 @@ public class SpikesBlock extends OrientedBlock {
if ((normVel.x + normVel.y + normVel.z) < -0.08F) {
float damage = (float)vel.lengthSquared() * 26;
entity.damage(world.getDamageSources().cactus(), damage);
entity.damage(world.getDamageSources().create(UDamageTypes.SPIKES), damage);
}
}
}
@ -50,7 +52,7 @@ public class SpikesBlock extends OrientedBlock {
if (!(e instanceof LivingEntity) || e.getType() == EntityType.FOX || e.getType() == EntityType.BEE) {
continue;
}
e.damage(world.getDamageSources().cactus(), 6);
e.damage(world.getDamageSources().create(UDamageTypes.SPIKES), 6);
}
}
}

View file

@ -19,6 +19,7 @@ import com.minelittlepony.unicopia.advancement.UCriteria;
import com.minelittlepony.unicopia.compat.trinkets.TrinketsDelegate;
import com.minelittlepony.unicopia.entity.behaviour.EntityAppearance;
import com.minelittlepony.unicopia.entity.collision.MultiBoundingBoxEntity;
import com.minelittlepony.unicopia.entity.damage.MagicalDamageSource;
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
import com.minelittlepony.unicopia.entity.effect.EffectUtils;
import com.minelittlepony.unicopia.entity.effect.UEffects;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.util;
package com.minelittlepony.unicopia.entity.damage;
import java.util.*;

View file

@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.WorldConvertable;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageType;

View file

@ -31,6 +31,7 @@ public interface UDamageTypes {
RegistryKey<DamageType> PETRIFIED = register("petrified");
RegistryKey<DamageType> ROCK = register("rock");
RegistryKey<DamageType> HORSESHOE = register("horseshoe");
RegistryKey<DamageType> SPIKES = register("spikes");
private static RegistryKey<DamageType> register(String name) {
var key = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name));

View file

@ -1447,6 +1447,8 @@
"death.attack.unicopia.horseshoe.self": "%1$s dinged himself",
"death.attack.unicopia.horseshoe.item": "%1$s was dinged by %2$s using %3$s",
"death.attack.unicopia.horseshoe.player": "%1$s was dinged by %2$s",
"death.attack.unicopia.spikes": "%1$s was pricked to death",
"death.attack.unicopia.spikes.player": "%1$s fell into some spikes whilst trying to escape %2$s",
"death.fell.accident.ladder.pegasus": "%1$s forgot they could fly and fell off a ladder",
"death.fell.accident.vines.pegasus": "%1$s forgot they could fly and fell off some vines",