Bees get gravity in void. Fixes MC-167279

This commit is contained in:
William Blake Galbreath 2020-01-26 16:30:19 -06:00
parent c7b38e2bc7
commit e4290a3697

View File

@ -12,7 +12,31 @@
public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -198,21 +203,28 @@
@@ -149,7 +154,22 @@
public Bee(EntityType<? extends Bee> type, Level world) {
super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);
- this.moveControl = new FlyingMoveControl(this, 20, true);
+ // Paper start - Fix MC-167279
+ class BeeFlyingMoveControl extends FlyingMoveControl {
+ public BeeFlyingMoveControl(final Mob entity, final int maxPitchChange, final boolean noGravity) {
+ super(entity, maxPitchChange, noGravity);
+ }
+
+ @Override
+ public void tick() {
+ if (this.mob.getY() <= Bee.this.level().getMinY()) {
+ this.mob.setNoGravity(false);
+ }
+ super.tick();
+ }
+ }
+ this.moveControl = new BeeFlyingMoveControl(this, 20, true);
+ // Paper end - Fix MC-167279
this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
this.setPathfindingMalus(PathType.WATER, -1.0F);
@@ -198,21 +218,28 @@
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
@ -52,7 +76,7 @@
}
@Override
@@ -223,8 +235,8 @@
@@ -223,8 +250,8 @@
this.ticksWithoutNectarSinceExitingHive = nbt.getInt("TicksSincePollination");
this.stayOutOfHiveCountdown = nbt.getInt("CannotEnterHiveTicks");
this.numCropsGrownSincePollination = nbt.getInt("CropsGrownSincePollination");
@ -63,7 +87,7 @@
this.readPersistentAngerSaveData(this.level(), nbt);
}
@@ -248,7 +260,7 @@
@@ -248,7 +275,7 @@
}
if (b0 > 0) {
@ -72,7 +96,7 @@
}
}
@@ -506,7 +518,12 @@
@@ -506,7 +533,12 @@
@Nullable
BeehiveBlockEntity getBeehiveBlockEntity() {
@ -86,7 +110,7 @@
}
boolean isHiveValid() {
@@ -671,8 +688,14 @@
@@ -671,8 +703,14 @@
if (this.isInvulnerableTo(world, source)) {
return false;
} else {
@ -102,7 +126,7 @@
}
}
@@ -1082,7 +1105,7 @@
@@ -1082,7 +1120,7 @@
BeeGoToHiveGoal() {
super();
@ -111,7 +135,7 @@
this.blacklistedTargets = Lists.newArrayList();
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@@ -1196,7 +1219,7 @@
@@ -1196,7 +1234,7 @@
BeeGoToKnownFlowerGoal() {
super();
@ -120,7 +144,7 @@
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@@ -1301,7 +1324,7 @@
@@ -1301,7 +1339,7 @@
}
}
@ -129,7 +153,7 @@
Bee.this.level().levelEvent(2011, blockposition, 15);
Bee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
Bee.this.incrementNumCropsGrownSincePollination();
@@ -1378,7 +1401,7 @@
@@ -1378,7 +1416,7 @@
@Override
protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Bee && this.mob.hasLineOfSight(target)) {
@ -138,7 +162,7 @@
}
}
@@ -1387,7 +1410,7 @@
@@ -1387,7 +1425,7 @@
private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> {
BeeBecomeAngryTargetGoal(Bee bee) {