Skip to content

Commit

Permalink
Fix entity_deal_custom_damage not referencing Player Names (%1$s etc) (
Browse files Browse the repository at this point in the history
…#501)

- code copied from the Forge base of MCreator
  • Loading branch information
HaipaDev authored Feb 3, 2024
1 parent ff87990 commit 677d490
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl
Original file line number Diff line number Diff line change
@@ -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)});
}, ${opt.toFloat(input$damage_number)});

0 comments on commit 677d490

Please sign in to comment.