13
0
geforkt von Mirrors/Paper

SPIGOT-3071, #1345: Add entity spawn method with spawn reason

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-01-31 20:08:05 +11:00
Ursprung 9c58e790bc
Commit 4a1ae2fa02

Datei anzeigen

@ -117,6 +117,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.entity.SpectralArrow;
@ -144,6 +145,7 @@ import org.bukkit.util.RayTraceResult;
import org.bukkit.util.StructureSearchResult;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class CraftWorld extends CraftRegionAccessor implements World {
public static final int CUSTOM_DIMENSION_OFFSET = 10;
@ -732,6 +734,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return populators;
}
@NotNull
@Override
public <T extends LivingEntity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @NotNull SpawnReason spawnReason, boolean randomizeData, @Nullable Consumer<? super T> function) throws IllegalArgumentException {
Preconditions.checkArgument(spawnReason != null, "Spawn reason cannot be null");
return spawn(location, clazz, function, spawnReason, randomizeData);
}
@Override
public Block getHighestBlockAt(int x, int z) {
return getBlockAt(x, getHighestBlockYAt(x, z), z);