Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 13:00:06 +01:00
#650: Add method to get player's attack cooldown
Dieser Commit ist enthalten in:
Ursprung
ef706b064e
Commit
893ad93b3e
@ -221,6 +221,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openSign(TileEntitySign tileentitysign) {}
|
public void openSign(TileEntitySign tileentitysign) {}
|
||||||
|
@@ -939,7 +1030,7 @@
|
||||||
|
|
||||||
|
f *= 0.2F + f2 * f2 * 0.8F;
|
||||||
|
f1 *= f2;
|
||||||
|
- this.ey();
|
||||||
|
+ // this.ey(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
|
||||||
|
if (f > 0.0F || f1 > 0.0F) {
|
||||||
|
boolean flag = f2 > 0.9F;
|
||||||
|
boolean flag1 = false;
|
||||||
@@ -978,8 +1069,15 @@
|
@@ -978,8 +1069,15 @@
|
||||||
if (entity instanceof EntityLiving) {
|
if (entity instanceof EntityLiving) {
|
||||||
f3 = ((EntityLiving) entity).getHealth();
|
f3 = ((EntityLiving) entity).getHealth();
|
||||||
|
@ -551,7 +551,7 @@
|
|||||||
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||||
int j = 25 - i;
|
int j = 25 - i;
|
||||||
float f1 = f * (float) j;
|
float f1 = f * (float) j;
|
||||||
@@ -1293,28 +1543,170 @@
|
@@ -1293,28 +1543,173 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,6 +629,9 @@
|
|||||||
+ float absorptionModifier = absorption.apply((double) f).floatValue();
|
+ float absorptionModifier = absorption.apply((double) f).floatValue();
|
||||||
+
|
+
|
||||||
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
|
||||||
|
+ if (damagesource.getEntity() instanceof EntityHuman) {
|
||||||
|
+ ((EntityHuman) damagesource.getEntity()).ey(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
|
||||||
|
+ }
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
@ -732,7 +735,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CombatTracker getCombatTracker() {
|
public CombatTracker getCombatTracker() {
|
||||||
@@ -1401,6 +1793,7 @@
|
@@ -1401,6 +1796,7 @@
|
||||||
public AttributeMapBase getAttributeMap() {
|
public AttributeMapBase getAttributeMap() {
|
||||||
if (this.attributeMap == null) {
|
if (this.attributeMap == null) {
|
||||||
this.attributeMap = new AttributeMapServer();
|
this.attributeMap = new AttributeMapServer();
|
||||||
@ -740,7 +743,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.attributeMap;
|
return this.attributeMap;
|
||||||
@@ -1771,6 +2164,7 @@
|
@@ -1771,6 +2167,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.onGround && !this.world.isClientSide) {
|
if (this.onGround && !this.world.isClientSide) {
|
||||||
@ -748,7 +751,7 @@
|
|||||||
this.setFlag(7, false);
|
this.setFlag(7, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2168,6 +2562,7 @@
|
@@ -2168,6 +2565,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -756,7 +759,7 @@
|
|||||||
this.setFlag(7, flag);
|
this.setFlag(7, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2296,12 +2691,12 @@
|
@@ -2296,12 +2694,12 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInteractable() {
|
public boolean isInteractable() {
|
||||||
@ -771,7 +774,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2484,7 +2879,27 @@
|
@@ -2484,7 +2882,27 @@
|
||||||
} else {
|
} else {
|
||||||
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
||||||
this.b(this.activeItem, 16);
|
this.b(this.activeItem, 16);
|
||||||
@ -800,7 +803,7 @@
|
|||||||
this.dH();
|
this.dH();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2571,10 +2986,18 @@
|
@@ -2571,10 +2989,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
@ -822,7 +825,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2661,7 +3084,7 @@
|
@@ -2661,7 +3087,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void entityWakeup() {
|
public void entityWakeup() {
|
||||||
@ -831,7 +834,7 @@
|
|||||||
World world = this.world;
|
World world = this.world;
|
||||||
|
|
||||||
this.world.getClass();
|
this.world.getClass();
|
||||||
@@ -2725,7 +3148,7 @@
|
@@ -2725,7 +3151,7 @@
|
||||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||||
|
|
||||||
if (!world.isClientSide && pair.getLeft() != null && world.random.nextFloat() < (Float) pair.getRight()) {
|
if (!world.isClientSide && pair.getLeft() != null && world.random.nextFloat() < (Float) pair.getRight()) {
|
||||||
|
@ -490,6 +490,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
return getHandle().getExpToLevel();
|
return getHandle().getExpToLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAttackCooldown() {
|
||||||
|
return getHandle().s(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCooldown(Material material) {
|
public boolean hasCooldown(Material material) {
|
||||||
Preconditions.checkArgument(material != null, "material");
|
Preconditions.checkArgument(material != null, "material");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren