Cleanup damage source a bit (#12106)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
if (entity instanceof Player player) {
|
||||
+ // CraftBukkit start
|
||||
+ DamageSource source = player.damageSources().playerAttack(player);
|
||||
+ DamageSource source = player.damageSources().generic().eventEntityDamager(entity);
|
||||
+ org.bukkit.event.entity.EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNonLivingEntityDamageEvent(this, source, 1.0F, false);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return true;
|
||||
@@ -14,7 +14,7 @@
|
||||
this.attack = new Interaction.PlayerAction(player.getUUID(), this.level().getGameTime());
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
- CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverPlayer, this, player.damageSources().generic(), 1.0F, 1.0F, false);
|
||||
+ CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverPlayer, this, player.damageSources().generic(), 1.0F, (float) event.getFinalDamage(), false); // CraftBukkit // Paper - use correct source and fix taken/dealt param order
|
||||
+ CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverPlayer, this, source, 1.0F, (float) event.getFinalDamage(), false); // CraftBukkit // Paper - use correct source and fix taken/dealt param order
|
||||
}
|
||||
|
||||
return !this.getResponse();
|
||||
|
||||
Reference in New Issue
Block a user