Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -42,16 +42,16 @@
}
}
@@ -230,7 +247,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.hitTargetOrDeflectSelf(movingobjectposition);
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
}
@@ -239,7 +256,7 @@
}
@@ -307,7 +324,7 @@
if (movingobjectposition != null && this.isAlive() && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.hitTargetOrDeflectSelf(movingobjectposition);
+ this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
}
ProjectileHelper.rotateTowardsMovement(this, 0.5F);
@@ -312,7 +329,7 @@
if (entity instanceof EntityLiving) {
EntityLiving entityliving1 = (EntityLiving) entity;
@@ -60,7 +60,7 @@
}
}
@@ -321,14 +338,20 @@
@@ -326,14 +343,20 @@
}
private void destroy() {
@@ -83,20 +83,19 @@
}
@Override
@@ -338,10 +361,15 @@
@@ -348,9 +371,14 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {
public boolean hurtServer(WorldServer worldserver, DamageSource damagesource, float f) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
if (!this.level().isClientSide) {
this.playSound(SoundEffects.SHULKER_BULLET_HURT, 1.0F, 1.0F);
((WorldServer) this.level()).sendParticles(Particles.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
- this.destroy();
+ this.destroy(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
}
this.playSound(SoundEffects.SHULKER_BULLET_HURT, 1.0F, 1.0F);
worldserver.sendParticles(Particles.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);
- this.destroy();
+ this.destroy(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
return true;
}