Update to Minecraft 1.20

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-06-08 01:30:00 +10:00
parent bac55e67d6
commit 9d740b84b0
269 changed files with 2605 additions and 2568 deletions

View File

@@ -40,7 +40,7 @@
@@ -298,7 +321,7 @@
Entity entity = damagesource.getEntity();
if (!this.level.isClientSide) {
if (!this.level().isClientSide) {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
}
@@ -55,31 +55,31 @@
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -349,7 +372,7 @@
itemstack.shrink(1);
}
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
return EnumInteractionResult.SUCCESS;
}
@@ -360,7 +383,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS;
}
@@ -382,7 +405,8 @@
@@ -348,7 +371,7 @@
itemstack.shrink(1);
}
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.tame(entityhuman);
- this.heal((float) item.getFoodProperties().getNutrition());
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
return EnumInteractionResult.SUCCESS;
} else {
if (item instanceof ItemDye) {
@@ -376,7 +399,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
this.setTarget((EntityLiving) null);
- this.setTarget((EntityLiving) null);
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
return EnumInteractionResult.SUCCESS;
} else {
return enuminteractionresult;
@@ -387,7 +410,8 @@
itemstack.shrink(1);
}
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.tame(entityhuman);
this.navigation.stop();
this.setTarget((EntityLiving) null);