#1045: Revert changes to persistence required checks

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2022-05-03 23:13:03 +10:00
parent 465b2801f1
commit aba0972e9a
12 changed files with 58 additions and 176 deletions

View File

@@ -57,17 +57,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
}
@@ -220,11 +238,26 @@
EntityAgeable entityageable = this.getBreedOffspring(worldserver, entityanimal);
if (entityageable != null) {
+ // CraftBukkit start - set persistence for tame animals
+ if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTame()) {
+ entityageable.setPersistenceRequired(true);
+ }
+ // CraftBukkit end
EntityPlayer entityplayer = this.getLoveCause();
@@ -225,6 +243,16 @@
if (entityplayer == null && entityanimal.getLoveCause() != null) {
entityplayer = entityanimal.getLoveCause();
}
@@ -84,7 +74,7 @@
if (entityplayer != null) {
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
@@ -235,12 +268,14 @@
@@ -235,12 +263,14 @@
entityanimal.setAge(6000);
this.resetLove();
entityanimal.resetLove();

View File

@@ -1,18 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityChicken.java
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
@@ -75,6 +75,11 @@
@Override
public void aiStep() {
+ // CraftBukkit start
+ if (this.isChickenJockey()) {
+ this.setPersistenceRequired(!this.removeWhenFarAway(0));
+ }
+ // CraftBukkit end
super.aiStep();
this.oFlap = this.flap;
this.oFlapSpeed = this.flapSpeed;
@@ -94,7 +99,9 @@
@@ -94,7 +94,9 @@
this.flap += this.flapping * 2.0F;
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);

View File

@@ -1,19 +0,0 @@
--- a/net/minecraft/world/entity/animal/EntityFish.java
+++ b/net/minecraft/world/entity/animal/EntityFish.java
@@ -59,7 +59,7 @@
@Override
public boolean removeWhenFarAway(double d0) {
- return !this.fromBucket() && !this.hasCustomName();
+ return true; // CraftBukkit
}
@Override
@@ -81,6 +81,7 @@
@Override
public void setFromBucket(boolean flag) {
this.entityData.set(EntityFish.FROM_BUCKET, flag);
+ this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence
}
@Override

View File

@@ -1,14 +1,5 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -133,7 +133,7 @@
@Override
public boolean removeWhenFarAway(double d0) {
- return !this.isTrusting() && this.tickCount > 2400;
+ return !this.isTrusting() /*&& this.tickCount > 2400*/; // CraftBukkit
}
public static AttributeProvider.Builder createAttributes() {
@@ -182,7 +182,8 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack);

View File

@@ -28,15 +28,7 @@
}
public Axolotl.Variant getVariant() {
@@ -238,6 +245,7 @@
@Override
public void setFromBucket(boolean flag) {
this.entityData.set(Axolotl.FROM_BUCKET, flag);
+ this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence
}
@Nullable
@@ -428,7 +436,7 @@
@@ -428,7 +435,7 @@
if (i < 2400) {
i = Math.min(2400, 100 + i);
@@ -45,7 +37,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -478,7 +486,7 @@
@@ -478,7 +485,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {
@@ -54,12 +46,3 @@
}
@Override
@@ -511,7 +519,7 @@
@Override
public boolean removeWhenFarAway(double d0) {
- return !this.fromBucket() && !this.hasCustomName();
+ return true; // CraftBukkit
}
public static boolean checkAxolotlSpawnRules(EntityTypes<? extends EntityLiving> entitytypes, WorldAccess worldaccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {