Advertisement
jayhillx

BoundDamageSource

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