#869: Add Enderman#teleport and Enderman#teleportTowards

By: Collin <collinjbarber@gmail.com>
This commit is contained in:
Bukkit/Spigot 2023-06-14 18:36:11 +10:00
parent 54d5defe73
commit 50d16687d4

View file

@ -2,6 +2,7 @@ package org.bukkit.entity;
import org.bukkit.block.data.BlockData;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -39,4 +40,38 @@ public interface Enderman extends Monster {
* @param blockData data to set the carried block to, or null to remove
*/
public void setCarriedBlock(@Nullable BlockData blockData);
/**
* Randomly teleports the Enderman in a 64x64x64 block cuboid region.
* <p>
* If the randomly selected point is in the ground, the point is moved 1 block
* down until air is found or until it goes under
* {@link org.bukkit.World#getMinHeight()}.
* <p>
* This method will return false if this Enderman is not alive, or if the
* teleport location was obstructed, or if the teleport location is in water.
*
* @return true if the teleport succeeded.
*/
@ApiStatus.Experimental
public boolean teleport();
/**
* Randomly teleports the Enderman towards the given <code>entity</code>.
* <p>
* The point is selected by drawing a vector between this enderman and the
* given <code>entity</code>. That vector's length is set to 16 blocks.
* That point is then moved within a 8x8x8 cuboid region. If the randomly
* selected point is in the ground, the point is moved 1 block down until
* air is found or until it goes under
* {@link org.bukkit.World#getMinHeight()}.
* <p>
* This method will return false if this Enderman is not alive, or if the
* teleport location was obstructed, or if the teleport location is in water.
*
* @param entity The entity to teleport towards.
* @return true if the teleport succeeded.
*/
@ApiStatus.Experimental
public boolean teleportTowards(@NotNull Entity entity);
}