修改伤害类型名称

This commit is contained in:
17146 2024-05-19 18:43:24 +08:00
parent ed952be5cd
commit 7fe21681dc
6 changed files with 17 additions and 17 deletions

View file

@ -144,9 +144,9 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
boolean hurt; boolean hurt;
if (headshot) { if (headshot) {
hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainHeadshotDamage(this.level().registryAccess(), this.getOwner()), (float) i * 2); hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this.getOwner()), (float) i * 2);
} else { } else {
hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this.getOwner()), (float) i); hurt = entity.hurt(TargetModDamageTypes.causeArrowInKneeDamage(this.level().registryAccess(), this.getOwner()), (float) i);
} }
if (!hurt) { if (!hurt) {

View file

@ -62,7 +62,7 @@ public class LivingEntityEventHandler {
double damage = amount; double damage = amount;
ItemStack stack = sourceentity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY; ItemStack stack = sourceentity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
if (damagesource.is(TargetModDamageTypes.ARROW_IN_BRAIN) || damagesource.is(TargetModDamageTypes.ARROW_IN_BRAIN_HEADSHOT)) { if (damagesource.is(TargetModDamageTypes.ARROW_IN_KNEE) || damagesource.is(TargetModDamageTypes.ARROW_IN_BRAIN)) {
stack.getOrCreateTag().putDouble("damagetotal", stack.getOrCreateTag().getDouble("damagetotal") + damage); stack.getOrCreateTag().putDouble("damagetotal", stack.getOrCreateTag().getDouble("damagetotal") + damage);
} }
if ((damagesource.is(DamageTypes.EXPLOSION) || damagesource.is(DamageTypes.PLAYER_EXPLOSION) || damagesource.is(DamageTypes.ARROW)) if ((damagesource.is(DamageTypes.EXPLOSION) || damagesource.is(DamageTypes.PLAYER_EXPLOSION) || damagesource.is(DamageTypes.ARROW))
@ -218,9 +218,9 @@ public class LivingEntityEventHandler {
} }
if (source.getDirectEntity() instanceof ServerPlayer player) { if (source.getDirectEntity() instanceof ServerPlayer player) {
if (source.is(TargetModDamageTypes.GUN_FIRE) || source.is(TargetModDamageTypes.ARROW_IN_BRAIN)) { if (source.is(TargetModDamageTypes.GUN_FIRE) || source.is(TargetModDamageTypes.ARROW_IN_KNEE)) {
TargetMod.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new PlayerKillMessage(player.getId(), entity.getId(), false)); TargetMod.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new PlayerKillMessage(player.getId(), entity.getId(), false));
} else if (source.is(TargetModDamageTypes.GUN_FIRE_HEADSHOT) || source.is(TargetModDamageTypes.ARROW_IN_BRAIN_HEADSHOT)) { } else if (source.is(TargetModDamageTypes.GUN_FIRE_HEADSHOT) || source.is(TargetModDamageTypes.ARROW_IN_BRAIN)) {
TargetMod.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new PlayerKillMessage(player.getId(), entity.getId(), true)); TargetMod.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new PlayerKillMessage(player.getId(), entity.getId(), true));
} }
} }

View file

@ -18,8 +18,8 @@ import javax.annotation.Nullable;
public class TargetModDamageTypes { public class TargetModDamageTypes {
public static final ResourceKey<DamageType> GUN_FIRE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "gunfire")); public static final ResourceKey<DamageType> GUN_FIRE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "gunfire"));
public static final ResourceKey<DamageType> GUN_FIRE_HEADSHOT = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "gunfire_headshot")); public static final ResourceKey<DamageType> GUN_FIRE_HEADSHOT = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "gunfire_headshot"));
public static final ResourceKey<DamageType> ARROW_IN_KNEE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "arrow_in_knee"));
public static final ResourceKey<DamageType> ARROW_IN_BRAIN = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "arrow_in_brain")); public static final ResourceKey<DamageType> ARROW_IN_BRAIN = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "arrow_in_brain"));
public static final ResourceKey<DamageType> ARROW_IN_BRAIN_HEADSHOT = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "arrow_in_brain_headshot"));
public static final ResourceKey<DamageType> MINE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "mine")); public static final ResourceKey<DamageType> MINE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(TargetMod.MODID, "mine"));
@ -31,12 +31,12 @@ public class TargetModDamageTypes {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE_HEADSHOT), entity); return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE_HEADSHOT), entity);
} }
public static DamageSource causeArrowInBrainDamage(RegistryAccess registryAccess, @Nullable Entity entity) { public static DamageSource causeArrowInKneeDamage(RegistryAccess registryAccess, @Nullable Entity entity) {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(ARROW_IN_BRAIN), entity); return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(ARROW_IN_KNEE), entity);
} }
public static DamageSource causeArrowInBrainHeadshotDamage(RegistryAccess registryAccess, @Nullable Entity entity) { public static DamageSource causeArrowInBrainDamage(RegistryAccess registryAccess, @Nullable Entity entity) {
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(ARROW_IN_BRAIN_HEADSHOT), entity); return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(ARROW_IN_BRAIN), entity);
} }
public static DamageSource causeMineDamage(RegistryAccess registryAccess, @Nullable Entity entity) { public static DamageSource causeMineDamage(RegistryAccess registryAccess, @Nullable Entity entity) {

View file

@ -156,12 +156,12 @@
"death.attack.gunfire_headshot": "%1$s was headshot by %2$s", "death.attack.gunfire_headshot": "%1$s was headshot by %2$s",
"death.attack.gunfire_headshot.entity": "%1$s was headshot by %2$s", "death.attack.gunfire_headshot.entity": "%1$s was headshot by %2$s",
"death.attack.gunfire_headshot.item": "%1$s was headshot by %2$s using %3$s", "death.attack.gunfire_headshot.item": "%1$s was headshot by %2$s using %3$s",
"death.attack.arrow_in_knee": "%1$s's knee was taken an arrow by %2$s",
"death.attack.arrow_in_knee.entity": "%1$s took an arrow in the knee while escaping from %2$s",
"death.attack.arrow_in_knee.item": "%1$s's knee was taken an arrow by %2$s using %3$s",
"death.attack.arrow_in_brain": "%2$s's arrow shot into %1$s's brain", "death.attack.arrow_in_brain": "%2$s's arrow shot into %1$s's brain",
"death.attack.arrow_in_brain.entity": "An arrow shot into %1$s's brain whilst trying to escape %2$s", "death.attack.arrow_in_brain.entity": "An arrow shot into %1$s's brain whilst trying to escape %2$s",
"death.attack.arrow_in_brain.item": "%2$s used %3$s to make an arrow shot into %1$s's brain", "death.attack.arrow_in_brain.item": "%2$s used %3$s to make an arrow shot into %1$s's brain",
"death.attack.arrow_in_brain_headshot": "%1$s was headshot by an arrow from %2$s",
"death.attack.arrow_in_brain_headshot.entity": "%1$s was headshot by an arrow while escaping from %2$s",
"death.attack.arrow_in_brain_headshot.item": "%2$s used %3$s to let %1$s be headshot by an arrow",
"death.attack.beast_gun": "%1$s was killed by %2$s using BEAST guns", "death.attack.beast_gun": "%1$s was killed by %2$s using BEAST guns",
"Shell Estimated Range": "Estimated Range:", "Shell Estimated Range": "Estimated Range:",

View file

@ -156,12 +156,12 @@
"death.attack.gunfire_headshot": "%1$s被%2$s射爆了脑袋", "death.attack.gunfire_headshot": "%1$s被%2$s射爆了脑袋",
"death.attack.gunfire_headshot.entity": "%1$s被%2$s射爆了脑袋", "death.attack.gunfire_headshot.entity": "%1$s被%2$s射爆了脑袋",
"death.attack.gunfire_headshot.item": "%1$s被%2$s用%3$s射爆了脑袋", "death.attack.gunfire_headshot.item": "%1$s被%2$s用%3$s射爆了脑袋",
"death.attack.arrow_in_knee": "%1$s的膝盖中了一箭凶手是%2$s",
"death.attack.arrow_in_knee.entity": "%1$s在逃离%2$s的时候膝盖中了一箭",
"death.attack.arrow_in_knee.item": "%2$s用%3$s让%1$s的膝盖中了一箭",
"death.attack.arrow_in_brain": "%1$s的脑子进矢了凶手是%2$s", "death.attack.arrow_in_brain": "%1$s的脑子进矢了凶手是%2$s",
"death.attack.arrow_in_brain.entity": "%1$s在逃离%2$s的时候脑子进矢了", "death.attack.arrow_in_brain.entity": "%1$s在逃离%2$s的时候脑子进矢了",
"death.attack.arrow_in_brain.item": "%2$s用%3$s让%1$s的脑子进矢了", "death.attack.arrow_in_brain.item": "%2$s用%3$s让%1$s的脑子进矢了",
"death.attack.arrow_in_brain_headshot": "%1$s被矢爆头了凶手是%2$s",
"death.attack.arrow_in_brain_headshot.entity": "%1$s在逃离%2$s的时候被矢爆头了",
"death.attack.arrow_in_brain_headshot.item": "%2$s用%3$s让%1$s被矢爆头了",
"death.attack.beast_gun": "%1$s被%2$s用BEAST枪械臭炸了", "death.attack.beast_gun": "%1$s被%2$s用BEAST枪械臭炸了",
"Shell Estimated Range": "炮弹预估射程:", "Shell Estimated Range": "炮弹预估射程:",

View file

@ -1,5 +1,5 @@
{ {
"exhaustion": 0, "exhaustion": 0,
"message_id": "arrow_in_brain_headshot", "message_id": "arrow_in_knee",
"scaling": "never" "scaling": "never"
} }