mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Leashable API
This commit is contained in:
parent
d4da32994f
commit
4641e233e7
3 changed files with 39 additions and 2 deletions
|
@ -0,0 +1,37 @@
|
||||||
|
package io.papermc.paper.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an entity that can be leashed.
|
||||||
|
*/
|
||||||
|
@NullMarked
|
||||||
|
public interface Leashable extends Entity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the entity is currently leashed.
|
||||||
|
*
|
||||||
|
* @return whether the entity is leashed
|
||||||
|
*/
|
||||||
|
boolean isLeashed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity that is currently leading this entity.
|
||||||
|
*
|
||||||
|
* @return the entity holding the leash
|
||||||
|
* @throws IllegalStateException if not currently leashed
|
||||||
|
*/
|
||||||
|
Entity getLeashHolder() throws IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the leash on this entity to be held by the supplied entity.
|
||||||
|
* <p>
|
||||||
|
* This method has no effect on players.
|
||||||
|
*
|
||||||
|
* @param holder the entity to leash this entity to, or {@code null} to unleash
|
||||||
|
* @return whether the operation was successful
|
||||||
|
*/
|
||||||
|
boolean setLeashHolder(@Nullable Entity holder);
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
/**
|
/**
|
||||||
* Represents a boat entity.
|
* Represents a boat entity.
|
||||||
*/
|
*/
|
||||||
public interface Boat extends Vehicle {
|
public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Paper - Leashable API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the wood type of the boat.
|
* Gets the wood type of the boat.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
/**
|
/**
|
||||||
* Represents a Mob. Mobs are living entities with simple AI.
|
* Represents a Mob. Mobs are living entities with simple AI.
|
||||||
*/
|
*/
|
||||||
public interface Mob extends LivingEntity, Lootable {
|
public interface Mob extends LivingEntity, Lootable, io.papermc.paper.entity.Leashable { // Paper - Leashable API
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue