@@ -8,16 +8,16 @@
|
||||
+
|
||||
public class EntityBat extends EntityAmbient {
|
||||
|
||||
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityBat.class, DataWatcherRegistry.a);
|
||||
@@ -130,16 +132,24 @@
|
||||
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
|
||||
@@ -138,16 +140,24 @@
|
||||
}
|
||||
|
||||
if (this.world.a(EntityBat.c, (EntityLiving) this) != null) {
|
||||
if (this.level.a(EntityBat.BAT_RESTING_TARGETING, (EntityLiving) this) != null) {
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
+ this.setAsleep(false);
|
||||
+ if (!flag) {
|
||||
+ this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
@@ -27,22 +27,22 @@
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
this.setAsleep(false);
|
||||
if (!flag) {
|
||||
this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
}
|
||||
}
|
||||
- } else {
|
||||
- this.setAsleep(false);
|
||||
- if (!flag) {
|
||||
- this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
- this.level.a((EntityHuman) null, 1025, blockposition, 0);
|
||||
- }
|
||||
+ // CraftBukkit End - Call BatToggleSleepEvent
|
||||
}
|
||||
} else {
|
||||
if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) {
|
||||
@@ -163,7 +173,11 @@
|
||||
this.aT = 0.5F;
|
||||
this.yaw += f1;
|
||||
if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) {
|
||||
if (this.targetPosition != null && (!this.level.isEmpty(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
@@ -171,7 +181,11 @@
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getType(blockposition1).isOccluding(this.level, blockposition1)) {
|
||||
- this.setAsleep(true);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, false)) {
|
||||
@@ -52,10 +52,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +207,11 @@
|
||||
@@ -201,7 +215,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.world.isClientSide && this.isAsleep()) {
|
||||
if (!this.level.isClientSide && this.isAsleep()) {
|
||||
- this.setAsleep(false);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
|
||||
Reference in New Issue
Block a user