aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch b/patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch
new file mode 100644
index 0000000000..dfb7ac2bcc
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/ambient/EntityBat.patch
@@ -0,0 +1,47 @@
+--- a/net/minecraft/world/entity/ambient/EntityBat.java
++++ b/net/minecraft/world/entity/ambient/EntityBat.java
+@@ -29,6 +29,10 @@
+ import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.phys.Vec3D;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
++
+ public class EntityBat extends EntityAmbient {
+
+ public static final float FLAP_LENGTH_SECONDS = 0.5F;
+@@ -143,13 +147,13 @@
+ this.yHeadRot = (float) this.random.nextInt(360);
+ }
+
+- if (this.level().getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
++ if (this.level().getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null && CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(false);
+ if (!flag) {
+ this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
+ }
+ }
+- } else {
++ } else if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(false);
+ if (!flag) {
+ this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
+@@ -176,7 +180,7 @@
+
+ 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) && CraftEventFactory.handleBatToggleSleepEvent(this, false)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(true);
+ }
+ }
+@@ -201,7 +205,7 @@
+ if (this.isInvulnerableTo(damagesource)) {
+ return false;
+ } else {
+- if (!this.level().isClientSide && this.isResting()) {
++ if (!this.level().isClientSide && this.isResting() && CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(false);
+ }
+