mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 08:36:13 +01:00
61 lines
2.4 KiB
Diff
61 lines
2.4 KiB
Diff
--- a/net/minecraft/server/EntityBat.java
|
|
+++ b/net/minecraft/server/EntityBat.java
|
|
@@ -3,6 +3,7 @@
|
|
import java.time.LocalDate;
|
|
import java.time.temporal.ChronoField;
|
|
import javax.annotation.Nullable;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
public class EntityBat extends EntityAmbient {
|
|
|
|
@@ -104,12 +105,20 @@
|
|
}
|
|
|
|
if (this.world.a(EntityBat.c, (EntityLiving) this) != null) {
|
|
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
|
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
|
+ this.setAsleep(false);
|
|
+ this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
|
+ }
|
|
+ // CraftBukkit End
|
|
+ }
|
|
+ } else {
|
|
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
|
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
|
this.setAsleep(false);
|
|
this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
|
}
|
|
- } else {
|
|
- this.setAsleep(false);
|
|
- this.world.a((EntityHuman) null, 1025, blockposition, 0);
|
|
+ // CraftBukkit End - Call BatToggleSleepEvent
|
|
}
|
|
} else {
|
|
if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) {
|
|
@@ -133,7 +142,11 @@
|
|
this.bd = 0.5F;
|
|
this.yaw += f1;
|
|
if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) {
|
|
- this.setAsleep(true);
|
|
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
|
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, false)) {
|
|
+ this.setAsleep(true);
|
|
+ }
|
|
+ // CraftBukkit End
|
|
}
|
|
}
|
|
|
|
@@ -161,7 +174,11 @@
|
|
return false;
|
|
} else {
|
|
if (!this.world.isClientSide && this.isAsleep()) {
|
|
- this.setAsleep(false);
|
|
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
|
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
|
+ this.setAsleep(false);
|
|
+ }
|
|
+ // CraftBukkit End - Call BatToggleSleepEvent
|
|
}
|
|
|
|
return super.damageEntity(damagesource, f);
|