SPIGOT-7732: Issue with the "hurt()" method of EntityLiving and invulnerable time
By: LoliColleen <76620594+LoliColleen@users.noreply.github.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
@@ -90,6 +90,12 @@
|
||||
@@ -90,6 +90,13 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityDamageEvent;
|
||||
+import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -13,7 +14,7 @@
|
||||
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable, VariantHolder<Holder<WolfVariant>> {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -360,11 +366,14 @@
|
||||
@@ -360,11 +367,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -30,19 +31,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,9 +383,9 @@
|
||||
@@ -374,9 +384,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void actuallyHurt(DamageSource damagesource, float f) {
|
||||
+ public boolean actuallyHurt(DamageSource damagesource, float f) { // CraftBukkit - void -> boolean
|
||||
+ public boolean actuallyHurt(DamageSource damagesource, float f, EntityDamageEvent event) { // CraftBukkit - void -> boolean
|
||||
if (!this.canArmorAbsorb(damagesource)) {
|
||||
- super.actuallyHurt(damagesource, f);
|
||||
+ return super.actuallyHurt(damagesource, f); // CraftBukkit
|
||||
+ return super.actuallyHurt(damagesource, f, event); // CraftBukkit
|
||||
} else {
|
||||
ItemStack itemstack = this.getBodyArmorItem();
|
||||
int i = itemstack.getDamageValue();
|
||||
@@ -395,6 +404,7 @@
|
||||
@@ -395,6 +405,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +51,7 @@
|
||||
}
|
||||
|
||||
private boolean canArmorAbsorb(DamageSource damagesource) {
|
||||
@@ -405,7 +415,7 @@
|
||||
@@ -405,7 +416,7 @@
|
||||
protected void applyTamingSideEffects() {
|
||||
if (this.isTame()) {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
|
||||
@@ -59,7 +60,7 @@
|
||||
} else {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -432,7 +442,7 @@
|
||||
@@ -432,7 +443,7 @@
|
||||
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
|
||||
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
|
||||
|
||||
@@ -68,7 +69,7 @@
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
} else {
|
||||
if (item instanceof ItemDye) {
|
||||
@@ -480,7 +490,7 @@
|
||||
@@ -480,7 +491,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
@@ -77,7 +78,7 @@
|
||||
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
|
||||
} else {
|
||||
return enuminteractionresult;
|
||||
@@ -498,7 +508,8 @@
|
||||
@@ -498,7 +509,8 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
|
||||
Reference in New Issue
Block a user