3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Paper/nms-patches/SpawnerCreature.patch

39 Zeilen
2.8 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/SpawnerCreature.java
+++ b/net/minecraft/server/SpawnerCreature.java
2019-04-23 04:00:00 +02:00
@@ -7,6 +7,10 @@
2018-07-15 02:00:00 +02:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2016-07-15 12:08:04 +02:00
+// CraftBukkit start
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
2016-07-15 12:08:04 +02:00
+
public final class SpawnerCreature {
2019-04-25 04:00:00 +02:00
private static final Logger LOGGER = LogManager.getLogger();
2019-07-20 01:00:00 +02:00
@@ -88,9 +92,12 @@
2019-12-10 23:00:00 +01:00
entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, worldserver.random.nextFloat() * 360.0F, 0.0F);
if ((d0 <= 16384.0D || !entityinsentient.isTypeNotPersistent(d0)) && entityinsentient.a((GeneratorAccess) worldserver, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) worldserver)) {
groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
2019-07-20 01:00:00 +02:00
- ++i;
- ++i2;
2019-12-10 23:00:00 +01:00
- worldserver.addEntity(entityinsentient);
2019-07-20 01:00:00 +02:00
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) {
2019-07-20 01:00:00 +02:00
+ ++i;
+ ++i2;
+ }
+ // CraftBukkit end
2019-12-10 23:00:00 +01:00
if (i >= entityinsentient.getMaxSpawnGroup()) {
2019-07-20 01:00:00 +02:00
return;
}
@@ -216,7 +223,7 @@
2019-04-23 04:00:00 +02:00
if (entityinsentient.a(generatoraccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) generatoraccess)) {
groupdataentity = entityinsentient.prepare(generatoraccess, generatoraccess.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
- generatoraccess.addEntity(entityinsentient);
+ generatoraccess.addEntity(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit
flag = true;
}
}