mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 23:01:01 +01:00
SPIGOT-3071, #1345: Add entity spawn method with spawn reason
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
9c58e790bc
commit
4a1ae2fa02
1 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue