13
0
geforkt von Mirrors/Paper

SPIGOT-7316: Cancelling EntityUnmountEvent does not stop the all effects of the unmounting

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-03-25 11:26:10 +11:00
Ursprung c8d32f6ca3
Commit 4f394499b7

Datei anzeigen

@ -70,7 +70,24 @@
} }
} }
@@ -505,7 +530,8 @@ @@ -477,8 +502,14 @@
public void rideTick() {
if (!this.level.isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
- this.setShiftKeyDown(false);
- } else {
+ // CraftBukkit start - SPIGOT-7316: no longer passenger, dismount and return
+ if (!this.isPassenger()) {
+ this.setShiftKeyDown(false);
+ return;
+ }
+ }
+ {
+ // CraftBukkit end
double d0 = this.getX();
double d1 = this.getY();
double d2 = this.getZ();
@@ -505,7 +536,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) { if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@ -80,7 +97,7 @@
} }
if (this.foodData.needsFood() && this.tickCount % 10 == 0) { if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -664,6 +690,13 @@ @@ -664,6 +696,13 @@
@Nullable @Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) { public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@ -94,7 +111,7 @@
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return null; return null;
} else { } else {
@@ -698,6 +731,33 @@ @@ -698,6 +737,33 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6); entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
} }
@ -128,7 +145,7 @@
return entityitem; return entityitem;
} }
} }
@@ -788,7 +848,7 @@ @@ -788,7 +854,7 @@
} }
if (nbttagcompound.contains("LastDeathLocation", 10)) { if (nbttagcompound.contains("LastDeathLocation", 10)) {
@ -137,7 +154,7 @@
Logger logger = EntityHuman.LOGGER; Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -821,7 +881,7 @@ @@ -821,7 +887,7 @@
} }
this.getLastDeathLocation().flatMap((globalpos) -> { this.getLastDeathLocation().flatMap((globalpos) -> {
@ -146,7 +163,7 @@
Logger logger = EntityHuman.LOGGER; Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -848,12 +908,12 @@ @@ -848,12 +914,12 @@
return false; return false;
} else { } else {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -161,7 +178,7 @@
} }
if (this.level.getDifficulty() == EnumDifficulty.EASY) { if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -865,7 +925,13 @@ @@ -865,7 +931,13 @@
} }
} }
@ -176,7 +193,7 @@
} }
} }
} }
@@ -885,10 +951,29 @@ @@ -885,10 +957,29 @@
} }
public boolean canHarmPlayer(EntityHuman entityhuman) { public boolean canHarmPlayer(EntityHuman entityhuman) {
@ -209,7 +226,7 @@
} }
@Override @Override
@@ -930,8 +1015,13 @@ @@ -930,8 +1021,13 @@
} }
} }
@ -224,7 +241,7 @@
if (!this.isInvulnerableTo(damagesource)) { if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f); f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f); f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -946,7 +1036,7 @@ @@ -946,7 +1042,7 @@
} }
if (f != 0.0F) { if (f != 0.0F) {
@ -233,7 +250,7 @@
float f3 = this.getHealth(); float f3 = this.getHealth();
this.getCombatTracker().recordDamage(damagesource, f3, f); this.getCombatTracker().recordDamage(damagesource, f3, f);
@@ -957,6 +1047,7 @@ @@ -957,6 +1053,7 @@
} }
} }
@ -241,7 +258,7 @@
} }
@Override @Override
@@ -1121,7 +1212,7 @@ @@ -1121,7 +1218,7 @@
f *= 0.2F + f2 * f2 * 0.8F; f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2; f1 *= f2;
@ -250,7 +267,7 @@
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F; boolean flag = f2 > 0.9F;
boolean flag1 = false; boolean flag1 = false;
@@ -1160,8 +1251,15 @@ @@ -1160,8 +1257,15 @@
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth(); f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) { if (j > 0 && !entity.isOnFire()) {
@ -268,7 +285,7 @@
} }
} }
@@ -1189,8 +1287,11 @@ @@ -1189,8 +1293,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next(); EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
@ -281,7 +298,7 @@
} }
} }
@@ -1199,9 +1300,26 @@ @@ -1199,9 +1306,26 @@
} }
if (entity instanceof EntityPlayer && entity.hurtMarked) { if (entity instanceof EntityPlayer && entity.hurtMarked) {
@ -308,7 +325,7 @@
} }
if (flag2) { if (flag2) {
@@ -1246,7 +1364,14 @@ @@ -1246,7 +1370,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
@ -324,7 +341,7 @@
} }
if (this.level instanceof WorldServer && f5 > 2.0F) { if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1256,12 +1381,17 @@ @@ -1256,12 +1387,17 @@
} }
} }
@ -343,7 +360,7 @@
} }
} }
@@ -1338,6 +1468,12 @@ @@ -1338,6 +1474,12 @@
} }
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) { public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@ -356,7 +373,7 @@
this.startSleeping(blockposition); this.startSleeping(blockposition);
this.sleepCounter = 0; this.sleepCounter = 0;
return Either.right(Unit.INSTANCE); return Either.right(Unit.INSTANCE);
@@ -1422,9 +1558,9 @@ @@ -1422,9 +1564,9 @@
super.jumpFromGround(); super.jumpFromGround();
this.awardStat(StatisticList.JUMP); this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) { if (this.isSprinting()) {
@ -368,7 +385,7 @@
} }
} }
@@ -1454,7 +1590,11 @@ @@ -1454,7 +1596,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z); this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.resetFallDistance(); this.resetFallDistance();
@ -381,7 +398,7 @@
} else { } else {
super.travel(vec3d); super.travel(vec3d);
} }
@@ -1489,19 +1629,19 @@ @@ -1489,19 +1635,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) { if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i); this.awardStat(StatisticList.SWIM_ONE_CM, i);
@ -404,7 +421,7 @@
} }
} else if (this.onClimbable()) { } else if (this.onClimbable()) {
if (d1 > 0.0D) { if (d1 > 0.0D) {
@@ -1512,13 +1652,13 @@ @@ -1512,13 +1658,13 @@
if (i > 0) { if (i > 0) {
if (this.isSprinting()) { if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i); this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@ -421,7 +438,7 @@
} }
} }
} else if (this.isFallFlying()) { } else if (this.isFallFlying()) {
@@ -1584,12 +1724,24 @@ @@ -1584,12 +1730,24 @@
} }
public void startFallFlying() { public void startFallFlying() {
@ -447,7 +464,7 @@
} }
@Override @Override
@@ -1680,10 +1832,21 @@ @@ -1680,10 +1838,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
} }
@ -470,7 +487,7 @@
} }
} }
@@ -1769,13 +1932,20 @@ @@ -1769,13 +1938,20 @@
@Override @Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) { public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@ -494,7 +511,7 @@
} }
} }
@@ -1814,26 +1984,31 @@ @@ -1814,26 +1990,31 @@
protected void removeEntitiesOnShoulder() { protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) { if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {