diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ambient/Bat.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ambient/Bat.java.patch new file mode 100644 index 0000000000..2b20441f48 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/ambient/Bat.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/world/entity/ambient/Bat.java ++++ b/net/minecraft/world/entity/ambient/Bat.java +@@ -85,7 +_,7 @@ + } + + @Override +- public boolean isPushable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule + return false; + } + +@@ -139,13 +_,13 @@ + this.yHeadRot = this.random.nextInt(360); + } + +- if (level.getNearestPlayer(BAT_RESTING_TARGETING, this) != null) { ++ if (level.getNearestPlayer(BAT_RESTING_TARGETING, this) != null && org.bukkit.craftbukkit.event.CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent + this.setResting(false); + if (!isSilent) { + level.levelEvent(null, 1025, blockPos, 0); + } + } +- } else { ++ } else if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent + this.setResting(false); + if (!isSilent) { + level.levelEvent(null, 1025, blockPos, 0); +@@ -178,7 +_,7 @@ + float f1 = Mth.wrapDegrees(f - this.getYRot()); + this.zza = 0.5F; + this.setYRot(this.getYRot() + f1); +- if (this.random.nextInt(100) == 0 && level.getBlockState(blockPos1).isRedstoneConductor(level, blockPos1)) { ++ if (this.random.nextInt(100) == 0 && level.getBlockState(blockPos1).isRedstoneConductor(level, blockPos1) && org.bukkit.craftbukkit.event.CraftEventFactory.handleBatToggleSleepEvent(this, false)) { // CraftBukkit - Call BatToggleSleepEvent + this.setResting(true); + } + } +@@ -203,7 +_,7 @@ + if (this.isInvulnerableTo(level, damageSource)) { + return false; + } else { +- if (this.isResting()) { ++ if (this.isResting() && org.bukkit.craftbukkit.event.CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent + this.setResting(false); + } + diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ambient/Bat.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/ambient/Bat.java.patch deleted file mode 100644 index acfaa378fe..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ambient/Bat.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/net/minecraft/world/entity/ambient/Bat.java -+++ b/net/minecraft/world/entity/ambient/Bat.java -@@ -29,6 +29,9 @@ - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.levelgen.Heightmap; - import net.minecraft.world.phys.Vec3; -+// CraftBukkit start -+import org.bukkit.craftbukkit.event.CraftEventFactory; -+// CraftBukkit end - - public class Bat extends AmbientCreature { - -@@ -88,7 +91,7 @@ - } - - @Override -- public boolean isPushable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule - return false; - } - -@@ -144,13 +147,13 @@ - this.yHeadRot = (float) this.random.nextInt(360); - } - -- if (world.getNearestPlayer(Bat.BAT_RESTING_TARGETING, this) != null) { -+ if (world.getNearestPlayer(Bat.BAT_RESTING_TARGETING, this) != null && CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent - this.setResting(false); - if (!flag) { - world.levelEvent((Player) null, 1025, blockposition, 0); - } - } -- } else { -+ } else if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent - this.setResting(false); - if (!flag) { - world.levelEvent((Player) null, 1025, blockposition, 0); -@@ -177,7 +180,7 @@ - - this.zza = 0.5F; - this.setYRot(this.getYRot() + f1); -- if (this.random.nextInt(100) == 0 && world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1)) { -+ if (this.random.nextInt(100) == 0 && world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1) && CraftEventFactory.handleBatToggleSleepEvent(this, false)) { // CraftBukkit - Call BatToggleSleepEvent - this.setResting(true); - } - } -@@ -202,7 +205,7 @@ - if (this.isInvulnerableTo(world, source)) { - return false; - } else { -- if (this.isResting()) { -+ if (this.isResting() && CraftEventFactory.handleBatToggleSleepEvent(this, true)) { // CraftBukkit - Call BatToggleSleepEvent - this.setResting(false); - } -