aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch
new file mode 100644
index 0000000000..450a695e17
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/ambient/Bat.java.patch
@@ -0,0 +1,46 @@
+--- a/net/minecraft/world/entity/ambient/Bat.java
++++ b/net/minecraft/world/entity/ambient/Bat.java
+@@ -27,6 +28,9 @@
+ import net.minecraft.world.level.LevelAccessor;
+ import net.minecraft.world.level.block.state.BlockState;
+ import net.minecraft.world.phys.Vec3;
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
+
+ public class Bat extends AmbientCreature {
+ public static final float FLAP_LENGTH_SECONDS = 0.5F;
+@@ -138,13 +146,13 @@
+ this.yHeadRot = (float)this.random.nextInt(360);
+ }
+
+- if (this.level().getNearestPlayer(BAT_RESTING_TARGETING, this) != null) {
++ if (this.level().getNearestPlayer(Bat.BAT_RESTING_TARGETING, this) != null && CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(false);
+ if (!isSilent) {
+ this.level().levelEvent(null, 1025, blockPos, 0);
+ }
+ }
+- } else {
++ } else if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(false);
+ if (!isSilent) {
+ this.level().levelEvent(null, 1025, blockPos, 0);
+@@ -178,7 +179,7 @@
+ float f1 = Mth.wrapDegrees(f - this.getYRot());
+ this.zza = 0.5F;
+ this.setYRot(this.getYRot() + f1);
+- if (this.random.nextInt(100) == 0 && this.level().getBlockState(blockPos1).isRedstoneConductor(this.level(), blockPos1)) {
++ if (this.random.nextInt(100) == 0 && this.level().getBlockState(blockposition1).isRedstoneConductor(this.level(), blockposition1) && CraftEventFactory.handleBatToggleSleepEvent(this, false)) { // CraftBukkit - Call BatToggleSleepEvent
+ this.setResting(true);
+ }
+ }
+@@ -203,7 +204,7 @@
+ if (this.isInvulnerableTo(source)) {
+ 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);
+ }
+