2024-12-11 22:26:55 +01:00
|
|
|
--- a/net/minecraft/world/level/BaseSpawner.java
|
|
|
|
+++ b/net/minecraft/world/level/BaseSpawner.java
|
2016-03-01 14:47:52 -06:00
|
|
|
@@ -54,10 +54,11 @@
|
2024-12-11 22:26:55 +01:00
|
|
|
|
|
|
|
public void setEntityId(EntityType<?> type, @Nullable Level world, RandomSource random, BlockPos pos) {
|
|
|
|
this.getOrCreateNextSpawnData(world, random, pos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(type).toString());
|
|
|
|
+ this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNearPlayer(Level world, BlockPos pos) {
|
2016-03-01 14:47:52 -06:00
|
|
|
- return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange);
|
|
|
|
+ return world.hasNearbyAlivePlayerThatAffectsSpawning((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper - Affects Spawning API
|
|
|
|
}
|
|
|
|
|
|
|
|
public void clientTick(Level world, BlockPos pos) {
|
2014-02-02 16:55:46 +00:00
|
|
|
@@ -157,13 +158,24 @@
|
2024-12-11 22:26:55 +01:00
|
|
|
((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, (SpawnGroupData) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
- Optional optional1 = mobspawnerdata.getEquipment();
|
|
|
|
+ Optional<net.minecraft.world.entity.EquipmentTable> optional1 = mobspawnerdata.getEquipment(); // CraftBukkit - decompile error
|
|
|
|
|
|
|
|
Objects.requireNonNull(entityinsentient);
|
|
|
|
optional1.ifPresent(entityinsentient::equip);
|
2014-02-02 16:55:46 +00:00
|
|
|
+ // Spigot Start
|
|
|
|
+ if ( entityinsentient.level().spigotConfig.nerfSpawnerMobs )
|
|
|
|
+ {
|
|
|
|
+ entityinsentient.aware = false;
|
|
|
|
+ }
|
|
|
|
+ // Spigot End
|
2024-12-11 22:26:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- if (!world.tryAddFreshEntityWithPassengers(entity)) {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (!world.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) {
|
|
|
|
+ // CraftBukkit end
|
|
|
|
this.delay(world, pos);
|
|
|
|
return;
|
|
|
|
}
|