-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix entity_deal_custom_damage not referencing Player Names (%1$s etc) (…
…#501) - code copied from the Forge base of MCreator
- Loading branch information
Showing
1 changed file
with
16 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 16 additions & 3 deletions
19
src/fabric-1.20.1/procedures/entity_deal_custom_damage.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}); |