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

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -90,6 +90,13 @@
@@ -86,6 +86,13 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
@@ -14,32 +14,31 @@
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 +367,14 @@
if (this.isInvulnerableTo(damagesource)) {
@@ -345,8 +352,14 @@
if (this.isInvulnerableTo(worldserver, damagesource)) {
return false;
} else {
- if (!this.level().isClientSide) {
+ // CraftBukkit start
+ boolean result = super.hurt(damagesource, f);
+ if (!this.level().isClientSide && result) {
+ // CraftBukkit end
this.setOrderedToSit(false);
}
- return super.hurt(damagesource, f);
+ boolean result = super.hurtServer(worldserver, damagesource, f);
+ if (!result) {
+ return result;
+ }
+ // CraftBukkit end
this.setOrderedToSit(false);
- return super.hurtServer(worldserver, damagesource, f);
+ return result; // CraftBukkit
}
}
@@ -374,10 +384,15 @@
@@ -356,10 +369,15 @@
}
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
+ public boolean actuallyHurt(DamageSource damagesource, float f, EntityDamageEvent event) { // CraftBukkit - void -> boolean
- protected void actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f) {
+ public boolean actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f, EntityDamageEvent event) { // CraftBukkit - void -> boolean
if (!this.canArmorAbsorb(damagesource)) {
- super.actuallyHurt(damagesource, f);
+ return super.actuallyHurt(damagesource, f, event); // CraftBukkit
- super.actuallyHurt(worldserver, damagesource, f);
+ return super.actuallyHurt(worldserver, damagesource, f, event); // CraftBukkit
} else {
+ // CraftBukkit start - SPIGOT-7815: if the damage was cancelled, no need to run the wolf armor behaviour
+ if (event.isCancelled()) {
@@ -49,7 +48,7 @@
ItemStack itemstack = this.getBodyArmorItem();
int i = itemstack.getDamageValue();
int j = itemstack.getMaxDamage();
@@ -395,6 +410,7 @@
@@ -371,6 +389,7 @@
}
}
@@ -57,7 +56,7 @@
}
private boolean canArmorAbsorb(DamageSource damagesource) {
@@ -405,7 +421,7 @@
@@ -381,7 +400,7 @@
protected void applyTamingSideEffects() {
if (this.isTame()) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
@@ -66,35 +65,35 @@
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -432,7 +448,7 @@
@@ -404,7 +423,7 @@
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
- this.heal(2.0F * f);
+ this.heal(2.0F * f, EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
return EnumInteractionResult.SUCCESS;
} else {
if (item instanceof ItemDye) {
@@ -463,7 +479,9 @@
this.playSound(SoundEffects.ARMOR_UNEQUIP_WOLF);
itemstack1 = this.getBodyArmorItem();
this.setBodyArmorItem(ItemStack.EMPTY);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // CraftBukkit
@@ -440,7 +459,9 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(worldserver, itemstack1);
+ this.forceDrops = false; // CraftBukkit
}
return EnumInteractionResult.SUCCESS;
} else if (((RecipeItemStack) ((ArmorMaterial) EnumArmorMaterial.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(entityhuman) && this.getBodyArmorItem().isDamaged()) {
itemstack.shrink(1);
@@ -480,7 +498,7 @@
@@ -459,7 +480,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
return EnumInteractionResult.SUCCESS.withoutItem();
} else {
return enuminteractionresult;
@@ -498,7 +516,8 @@
@@ -477,7 +498,8 @@
}
private void tryToTame(EntityHuman entityhuman) {