diff --git a/src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl b/src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl index 46fc1052..4233158d 100644 --- a/src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl +++ b/src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl @@ -1,6 +1,19 @@ if (${input$entity} instanceof LivingEntity _entity) - _entity.hurt(new DamageSource(_entity.level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.GENERIC)) { + _entity.hurt(new DamageSource(_entity.level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.GENERIC)){ @Override public Component getLocalizedDeathMessage(LivingEntity _msgEntity) { - return Component.translatable("death.attack." + ${input$localization_text}); + String _translatekey = "death.attack." + ${input$localization_text}; + if (this.getEntity() == null && this.getDirectEntity() == null) { + return _msgEntity.getKillCredit() != null ? + Component.translatable(_translatekey + ".player", _msgEntity.getDisplayName(), _msgEntity.getKillCredit().getDisplayName()) : + Component.translatable(_translatekey, _msgEntity.getDisplayName()); + } else { + Component _component = this.getEntity() == null ? this.getDirectEntity().getDisplayName() : this.getEntity().getDisplayName(); + ItemStack _itemstack = ItemStack.EMPTY; + if (this.getEntity() instanceof LivingEntity _livingentity) + _itemstack = _livingentity.getMainHandItem(); + return !_itemstack.isEmpty() && _itemstack.hasCustomHoverName() ? + Component.translatable(_translatekey + ".item", _msgEntity.getDisplayName(), _component, _itemstack.getDisplayName()) : + Component.translatable(_translatekey, _msgEntity.getDisplayName(), _component); + } } - }, ${opt.toFloat(input$damage_number)}); \ No newline at end of file +}, ${opt.toFloat(input$damage_number)}); \ No newline at end of file