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
2024-04-24 01:15:00 +10:00
@@ -54,6 +54,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());
2021-11-22 09:00:00 +11:00
+ this.spawnPotentials = SimpleWeightedRandomList.empty(); // 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) {
2024-04-24 01:15:00 +10:00
@@ -157,13 +158,18 @@
((EntityInsentient) entity).finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entity.blockPosition()), EnumMobSpawn.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;
}