@@ -12,12 +12,12 @@
|
||||
@@ -140,16 +142,24 @@
|
||||
}
|
||||
|
||||
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
if (this.level().getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
+ this.setResting(false);
|
||||
+ if (!flag) {
|
||||
+ this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
@@ -27,22 +27,22 @@
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
this.setResting(false);
|
||||
if (!flag) {
|
||||
this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
}
|
||||
}
|
||||
- } else {
|
||||
- this.setResting(false);
|
||||
- if (!flag) {
|
||||
- this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
- this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
- }
|
||||
+ // CraftBukkit End - Call BatToggleSleepEvent
|
||||
}
|
||||
} else {
|
||||
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
if (this.targetPosition != null && (!this.level().isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level().getMinBuildHeight())) {
|
||||
@@ -173,7 +183,11 @@
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
|
||||
if (this.random.nextInt(100) == 0 && this.level().getBlockState(blockposition1).isRedstoneConductor(this.level(), blockposition1)) {
|
||||
- this.setResting(true);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, false)) {
|
||||
@@ -55,7 +55,7 @@
|
||||
@@ -198,7 +212,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide && this.isResting()) {
|
||||
if (!this.level().isClientSide && this.isResting()) {
|
||||
- this.setResting(false);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
|
||||
Reference in New Issue
Block a user