mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-24 16:56:14 +00:00
35 lines
2.2 KiB
Diff
35 lines
2.2 KiB
Diff
--- a/net/minecraft/util/SpawnUtil.java
|
|
+++ b/net/minecraft/util/SpawnUtil.java
|
|
@@ -21,6 +21,12 @@
|
|
public SpawnUtil() {}
|
|
|
|
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a) {
|
|
+ // CraftBukkit start
|
|
+ return trySpawnMob(entitytypes, entityspawnreason, worldserver, blockposition, i, j, k, spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
|
+ }
|
|
+
|
|
+ public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
|
+ // CraftBukkit end
|
|
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
|
|
|
for (int l = 0; l < i; ++l) {
|
|
@@ -29,15 +35,15 @@
|
|
|
|
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
|
|
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
|
|
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (Consumer) null, blockposition_mutableblockposition, entityspawnreason, false, false);
|
|
+ T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, entityspawnreason, false, false); // CraftBukkit - decompile error
|
|
|
|
if (t0 != null) {
|
|
if (t0.checkSpawnRules(worldserver, entityspawnreason) && t0.checkSpawnObstruction(worldserver)) {
|
|
- worldserver.addFreshEntityWithPassengers(t0);
|
|
+ worldserver.addFreshEntityWithPassengers(t0, reason); // CraftBukkit
|
|
return Optional.of(t0);
|
|
}
|
|
|
|
- t0.discard();
|
|
+ t0.discard(null); // CraftBukkit - add Bukkit remove cause
|
|
}
|
|
}
|
|
}
|