craftbukkit/nms-patches/net/minecraft/world/level/MobSpawnerAbstract.patch

32 lines
1.9 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
2025-03-26 03:05:00 +11:00
@@ -55,6 +55,7 @@
2022-12-08 03:00:00 +11:00
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());
2025-03-26 03:05:00 +11:00
+ this.spawnPotentials = WeightedList.of(); // CraftBukkit - SPIGOT-3496, MC-92282
}
2018-07-15 10:00:00 +10:00
2021-11-22 09:00:00 +11:00
private boolean isNearPlayer(World world, BlockPosition blockposition) {
2025-03-26 03:05:00 +11:00
@@ -156,13 +157,18 @@
2024-10-23 02:15:00 +11:00
((EntityInsentient) entity).finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, (GroupDataEntity) null);
2020-08-12 07:00:00 +10:00
}
2024-04-24 01:15:00 +10:00
- Optional optional1 = mobspawnerdata.getEquipment();
+ Optional<net.minecraft.world.entity.EquipmentTable> optional1 = mobspawnerdata.getEquipment(); // CraftBukkit - decompile error
Objects.requireNonNull(entityinsentient);
optional1.ifPresent(entityinsentient::equip);
2021-06-11 15:00:00 +10:00
}
2016-03-01 08:32:46 +11:00
2021-11-22 09:00:00 +11:00
- 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
2021-11-22 09:00:00 +11:00
this.delay(worldserver, blockposition);
2021-06-11 15:00:00 +10:00
return;
}