Advertisement
jayhillx

BoundDamageSource02

Jun 10th, 2021
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public class BoundDamageSource extends DamageSource {
  2. protected final PlayerEntity damageSourcePlayerIn;
  3.  
  4. public BoundDamageSource(String damageTypeIn, PlayerEntity damageSourcePlayerIn) {
  5. super(damageTypeIn);
  6. this.damageSourcePlayerIn = damageSourcePlayerIn;
  7. }
  8.  
  9. public ITextComponent getDeathMessage(LivingEntity playerEntityIn) {
  10. PlayerEntity playerEntity = (PlayerEntity) playerEntityIn;
  11. String s = "death.attack." + this.damageType;
  12. String s1 = s + ".boundPlayer";
  13.  
  14. IBoundCapability boundPlayer = playerEntity.getCapability(BindingCapabilities.LIFE_BOUND_CAPABILITY).orElse(null);
  15.  
  16. return playerEntity != null ? new TranslationTextComponent(s1, playerEntityIn.getDisplayName(), playerEntity.getServer().getPlayerList().getPlayerByUUID(boundPlayer.getUUID()).getDisplayName()) : new TranslationTextComponent(s, playerEntityIn.getDisplayName());
  17. }
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement