Update to Minecraft 1.16.1

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-06-25 10:00:00 +10:00
parent 3862d2811e
commit 50503fd516
424 changed files with 5960 additions and 5636 deletions

View File

@@ -8,7 +8,7 @@
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -42,6 +43,9 @@
@@ -44,6 +45,9 @@
}
@@ -18,7 +18,7 @@
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
@@ -51,6 +55,7 @@
@@ -53,6 +57,7 @@
return super.damageEntity(damagesource, f);
}
}
@@ -26,7 +26,7 @@
@Override
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
@@ -140,6 +145,7 @@
@@ -147,6 +152,7 @@
if (entityhuman != null) {
this.breedCause = entityhuman.getUniqueID();
}
@@ -34,3 +34,45 @@
this.world.broadcastEntityEffect(this, (byte) 18);
}
@@ -186,11 +192,24 @@
EntityAgeable entityageable = this.createChild(entityanimal);
if (entityageable != null) {
+ // CraftBukkit start - set persistence for tame animals
+ if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTamed()) {
+ entityageable.persistent = true;
+ }
+ // CraftBukkit end
EntityPlayer entityplayer = this.getBreedCause();
if (entityplayer == null && entityanimal.getBreedCause() != null) {
entityplayer = entityanimal.getBreedCause();
}
+ // CraftBukkit start - call EntityBreedEvent
+ int experience = this.getRandom().nextInt(7) + 1;
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this, entityanimal, entityplayer, this.breedItem, experience);
+ if (entityBreedEvent.isCancelled()) {
+ return;
+ }
+ experience = entityBreedEvent.getExperience();
+ // CraftBukkit end
if (entityplayer != null) {
entityplayer.a(StatisticList.ANIMALS_BRED);
@@ -203,10 +222,14 @@
entityanimal.resetLove();
entityageable.a(true);
entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F);
- world.addEntity(entityageable);
+ world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
world.broadcastEntityEffect(this, (byte) 18);
if (world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
- world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), this.getRandom().nextInt(7) + 1));
+ // CraftBukkit start - use event experience
+ if (experience > 0) {
+ world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience));
+ }
+ // CraftBukkit end
}
}