Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Fri, 23 Jan 2026 18:47:34 +0900
Subject: [PATCH] fix skeleton horse trap NPE


diff --git a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
index d958741b7d218a4bc7e5a06beca308c7d6bb94ba..82c59d2742d94273db698a5ec0f4c411932b3f52 100644
--- a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
+++ b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
@@ -204,8 +204,10 @@ public class SkeletonHorse extends AbstractHorse {
this.isTrap = isTrap;
if (isTrap) {
this.goalSelector.addGoal(1, this.skeletonTrapGoal);
+ this.skeletonTrapGoal.doTrap = true; // Leaf - fix skeleton horse trap NPE
} else {
- this.goalSelector.removeGoal(this.skeletonTrapGoal);
+ //this.goalSelector.removeGoal(this.skeletonTrapGoal); // Leaf - fix skeleton horse trap NPE
+ this.skeletonTrapGoal.doTrap = false; // Leaf - fix skeleton horse trap NPE
}
}
}
diff --git a/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java b/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java
index c014fafd9144698f778430d6a7d9bda977941aa3..7631685c6760ec0c9001105ebf740996cac82505 100644
--- a/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java
+++ b/net/minecraft/world/entity/animal/equine/SkeletonTrapGoal.java
@@ -19,6 +19,7 @@ import org.jspecify.annotations.Nullable;
public class SkeletonTrapGoal extends Goal {
private final SkeletonHorse horse;
private java.util.List<org.bukkit.entity.HumanEntity> eligiblePlayers; // Paper
+ public boolean doTrap = true; // Leaf - fix skeleton horse trap NPE

public SkeletonTrapGoal(SkeletonHorse horse) {
this.horse = horse;
@@ -26,7 +27,7 @@ public class SkeletonTrapGoal extends Goal {

@Override
public boolean canUse() {
- return !(this.eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent
+ return doTrap && !(this.eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent // Leaf - fix skeleton horse trap NPE
}

@Override
@@ -102,4 +103,11 @@ public class SkeletonTrapGoal extends Goal {
);
skeleton.setItemSlot(slot, itemBySlot);
}
+
+ // Leaf start - fix eligiblePlayers leak
+ @Override
+ public void stop() {
+ eligiblePlayers = null;
+ }
+ // Leaf end - fix eligiblePlayers leak
}