Skip to content

Commit 6c52321

Browse files
committed
Fix #231
1 parent e2033dd commit 6c52321

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

patches/minecraft/net/minecraft/util/SpawnUtil.java.patch

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
--- a/net/minecraft/util/SpawnUtil.java
22
+++ b/net/minecraft/util/SpawnUtil.java
3-
@@ -17,6 +_,14 @@
3+
@@ -17,6 +_,19 @@
44
import net.minecraft.world.level.block.state.BlockState;
55

66
public class SpawnUtil {
77
+
88
+ //Ketting start - modified CraftBukkit code
99
+ private static org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason trySpawnMob$reason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT;
10+
+
11+
+ public static void prepareTrySpawnMob(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
12+
+ trySpawnMob$reason = reason;
13+
+ }
14+
+
1015
+ public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> p_216404_, MobSpawnType p_216405_, ServerLevel p_216406_, BlockPos p_216407_, int p_216408_, int p_216409_, int p_216410_, SpawnUtil.Strategy p_216411_, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
1116
+ trySpawnMob$reason = reason;
1217
+ return trySpawnMob(p_216404_, p_216405_, p_216406_, p_216407_, p_216408_, p_216409_, p_216410_, p_216411_);

patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@
107107
p_35409_.addFreshEntityWithPassengers(witch);
108108
this.releaseAllPois();
109109
this.discard();
110-
@@ -816,7 +_,7 @@
110+
@@ -816,7 +_,8 @@
111111
return p_186293_.wantsToSpawnGolem(p_35399_);
112112
}).limit(5L).collect(Collectors.toList());
113113
if (list1.size() >= p_35400_) {
114114
- if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, p_35398_, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM).isPresent()) {
115-
+ if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, p_35398_, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
115+
+ SpawnUtil.prepareTrySpawnMob(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE);
116+
+ if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, p_35398_, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM).isEmpty()) { // CraftBukkit
116117
list.forEach(GolemSensor::golemDetected);
117118
}
118119
}

0 commit comments

Comments
 (0)