mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
31 lines
1.9 KiB
Diff
31 lines
1.9 KiB
Diff
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
@@ -54,6 +54,7 @@
|
|
|
|
public void setEntityId(EntityTypes<?> entitytypes, @Nullable World world, RandomSource randomsource, BlockPosition blockposition) {
|
|
this.getOrCreateNextSpawnData(world, randomsource, blockposition).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(entitytypes).toString());
|
|
+ this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282
|
|
}
|
|
|
|
private boolean isNearPlayer(World world, BlockPosition blockposition) {
|
|
@@ -157,13 +158,18 @@
|
|
((EntityInsentient) entity).finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entity.blockPosition()), EnumMobSpawn.SPAWNER, (GroupDataEntity) null);
|
|
}
|
|
|
|
- Optional optional1 = mobspawnerdata.getEquipment();
|
|
+ Optional<net.minecraft.world.entity.EquipmentTable> optional1 = mobspawnerdata.getEquipment(); // CraftBukkit - decompile error
|
|
|
|
Objects.requireNonNull(entityinsentient);
|
|
optional1.ifPresent(entityinsentient::equip);
|
|
}
|
|
|
|
- if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
|
+ continue;
|
|
+ }
|
|
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) {
|
|
+ // CraftBukkit end
|
|
this.delay(worldserver, blockposition);
|
|
return;
|
|
}
|