mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
1e7dd72f15
The game uses 0.95d now
29 lines
2.0 KiB
Diff
29 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: nossr50 <nossr50@gmail.com>
|
|
Date: Thu, 26 Mar 2020 19:44:50 -0700
|
|
Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 8577eb85cfe6d061e9e8b7e380db452a8c4ec858..9eea89e4c3ec5f999ec7f5773f4c37209211c173 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2190,7 +2190,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
|
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {
|
|
- ((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
|
+ // Paper start - PlayerAttackEntityCooldownResetEvent
|
|
+ if (damagesource.getEntity() instanceof ServerPlayer) {
|
|
+ ServerPlayer player = (ServerPlayer) damagesource.getEntity();
|
|
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getAttackStrengthScale(0F)).callEvent()) {
|
|
+ player.resetAttackStrengthTicker();
|
|
+ }
|
|
+ } else {
|
|
+ ((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
if (event.isCancelled()) {
|
|
return false;
|