use local class for movecontrol stuff to prevent reobf mapping issue

This commit is contained in:
MiniDigger 2021-06-14 01:19:51 +02:00
parent 69e6160294
commit 2372198eb4
2 changed files with 14 additions and 9 deletions

View File

@ -5,16 +5,20 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index f3ba4b26553915917c79f013ed9dd7c87d9f65a4..b4cd490a1b2a2a118dc5f49bcb0fb755fbad853b 100644 index f3ba4b26553915917c79f013ed9dd7c87d9f65a4..3d049e43c8ea85597e98e9dad61c8d4c49b01b1c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -143,7 +143,17 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -143,7 +143,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public Bee(EntityType<? extends Bee> type, Level world) { public Bee(EntityType<? extends Bee> type, Level world) {
super(type, world); super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);
- this.moveControl = new FlyingMoveControl(this, 20, true); - this.moveControl = new FlyingMoveControl(this, 20, true);
+ // Paper start - apply gravity to bees when they get stuck in the void, fixes MC-167279 + // Paper start - apply gravity to bees when they get stuck in the void, fixes MC-167279
+ this.moveControl = new FlyingMoveControl(this, 20, true) { + class BeeFlyingMoveControl extends FlyingMoveControl {
+ public BeeFlyingMoveControl(final Mob entity, final int maxPitchChange, final boolean noGravity) {
+ super(entity, maxPitchChange, noGravity);
+ }
+
+ @Override + @Override
+ public void tick() { + public void tick() {
+ if (this.mob.getY() <= 0) { + if (this.mob.getY() <= 0) {
@ -22,7 +26,8 @@ index f3ba4b26553915917c79f013ed9dd7c87d9f65a4..b4cd490a1b2a2a118dc5f49bcb0fb755
+ } + }
+ super.tick(); + super.tick();
+ } + }
+ }; + }
+ this.moveControl = new BeeFlyingMoveControl(this, 20, true);
+ // Paper end + // Paper end
this.lookControl = new Bee.BeeLookControl(this); this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F); this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Do not allow bees to load chunks for beehives
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index b4cd490a1b2a2a118dc5f49bcb0fb755fbad853b..4aeffd9efe6f845007f35a3fd23fdfda2d1f20aa 100644 index 3d049e43c8ea85597e98e9dad61c8d4c49b01b1c..207e6f411491d01f9ca5b49aa65a66e16255ff3e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -404,6 +404,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -409,6 +409,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.hivePos == null) { if (this.hivePos == null) {
return false; return false;
} else { } else {
@ -16,7 +16,7 @@ index b4cd490a1b2a2a118dc5f49bcb0fb755fbad853b..4aeffd9efe6f845007f35a3fd23fdfda
BlockEntity tileentity = this.level.getBlockEntity(this.hivePos); BlockEntity tileentity = this.level.getBlockEntity(this.hivePos);
return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby(); return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby();
@@ -436,6 +437,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -441,6 +442,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} }
private boolean doesHiveHaveSpace(BlockPos pos) { private boolean doesHiveHaveSpace(BlockPos pos) {
@ -24,7 +24,7 @@ index b4cd490a1b2a2a118dc5f49bcb0fb755fbad853b..4aeffd9efe6f845007f35a3fd23fdfda
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false; return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false;
@@ -909,6 +911,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -914,6 +916,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override @Override
public boolean canBeeUse() { public boolean canBeeUse() {
if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerThan((Position) Bee.this.position(), 2.0D)) { if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerThan((Position) Bee.this.position(), 2.0D)) {
@ -32,7 +32,7 @@ index b4cd490a1b2a2a118dc5f49bcb0fb755fbad853b..4aeffd9efe6f845007f35a3fd23fdfda
BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos); BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity) { if (tileentity instanceof BeehiveBlockEntity) {
@@ -932,6 +935,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -937,6 +940,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override @Override
public void start() { public void start() {