aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch
new file mode 100644
index 0000000000..d597c8cea9
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BaseSpawner.java.patch
@@ -0,0 +1,30 @@
+--- a/net/minecraft/world/level/BaseSpawner.java
++++ b/net/minecraft/world/level/BaseSpawner.java
+@@ -50,8 +50,9 @@
+
+ public BaseSpawner() {}
+
+- public void setEntityId(EntityType<?> entitytype, @Nullable Level level, RandomSource randomsource, BlockPos blockpos) {
+- this.getOrCreateNextSpawnData(level, randomsource, blockpos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(entitytype).toString());
++ public void setEntityId(EntityType<?> type, @Nullable Level level, RandomSource random, BlockPos pos) {
++ this.getOrCreateNextSpawnData(level, random, pos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(type).toString());
++ this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282
+ }
+
+ private boolean isNearPlayer(Level level, BlockPos blockpos) {
+@@ -154,8 +155,13 @@
+ }
+ }
+
+- if (!serverlevel.tryAddFreshEntityWithPassengers(entity)) {
+- this.delay(serverlevel, blockpos);
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
++ continue;
++ }
++ if (!serverLevel.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) {
++ // CraftBukkit end
++ this.delay(serverLevel, pos);
+ return;
+ }
+