SPIGOT-3324: Improve tameable damage handling

This commit is contained in:
md_5 2017-06-24 10:01:46 +10:00
parent 763827668e
commit 753a8e700d
4 changed files with 29 additions and 28 deletions

View File

@ -309,10 +309,10 @@
}
+ // CraftBukkit start
+ if(this instanceof EntityAnimal){
+ ((EntityAnimal)this).resetLove();
+ if(this instanceof EntityTameableAnimal){
+ ((EntityTameableAnimal)this).getGoalSit().setSitting(false);
+ if (this instanceof EntityAnimal) {
+ ((EntityAnimal) this).resetLove();
+ if (this instanceof EntityTameableAnimal) {
+ ((EntityTameableAnimal) this).getGoalSit().setSitting(false);
+ }
+ }
+ // CraftBukkit end

View File

@ -9,25 +9,17 @@
}
protected void initAttributes() {
@@ -103,6 +103,9 @@
return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
}
+ /* CraftBukkit start
+ // Function disabled as it has no special function anymore after
+ // setSitting is disabled.
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
@@ -108,7 +108,8 @@
return false;
@@ -114,6 +117,7 @@
return super.damageEntity(damagesource, f);
}
}
+ // CraftBukkit end */
} else {
if (this.goalSit != null) {
- this.goalSit.setSitting(false);
+ // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+ // this.goalSit.setSitting(false);
}
@Nullable
protected MinecraftKey J() {
@@ -133,7 +137,8 @@
return super.damageEntity(damagesource, f);
@@ -133,7 +134,8 @@
}
if (!this.world.isClientSide) {
@ -37,7 +29,7 @@
this.c(entityhuman);
this.setCatType(1 + this.world.random.nextInt(3));
this.p(true);
@@ -237,7 +242,7 @@
@@ -237,7 +239,7 @@
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);

View File

@ -27,7 +27,17 @@
this.c(entityhuman);
this.p(true);
this.world.broadcastEntityEffect(this, (byte) 7);
@@ -316,33 +316,35 @@
@@ -276,7 +276,8 @@
return false;
} else {
if (this.goalSit != null) {
- this.goalSit.setSitting(false);
+ // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+ // this.goalSit.setSitting(false);
}
return super.damageEntity(damagesource, f);
@@ -316,33 +317,35 @@
}
static {

View File

@ -35,20 +35,19 @@
public void setGoalTarget(@Nullable EntityLiving entityliving) {
super.setGoalTarget(entityliving);
if (entityliving == null) {
@@ -200,9 +221,10 @@
@@ -200,9 +221,9 @@
Entity entity = damagesource.getEntity();
if (this.goalSit != null) {
- this.goalSit.setSitting(false);
+ // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+ // PAIL : checkme
+ // this.goalSit.setSitting(false);
}
-
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
}
@@ -245,7 +267,7 @@
@@ -245,7 +266,7 @@
itemstack.subtract(1);
}
@ -57,7 +56,7 @@
return true;
}
} else if (itemstack.getItem() == Items.DYE) {
@@ -266,7 +288,7 @@
@@ -266,7 +287,7 @@
this.goalSit.setSitting(!this.isSitting());
this.bd = false;
this.navigation.p();
@ -66,7 +65,7 @@
}
} else if (itemstack.getItem() == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -274,12 +296,13 @@
@@ -274,12 +295,13 @@
}
if (!this.world.isClientSide) {