net/minecraft/world/entity/ambient

This commit is contained in:
Noah van der Aa
2024-12-15 00:03:03 +01:00
parent d1369750e2
commit 6a85106951
2 changed files with 45 additions and 55 deletions

View File

@@ -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);
}