diff --git a/paper-api/src/main/java/org/bukkit/entity/Pig.java b/paper-api/src/main/java/org/bukkit/entity/Pig.java index 28f59f2c22..cb02837157 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Pig.java +++ b/paper-api/src/main/java/org/bukkit/entity/Pig.java @@ -3,19 +3,4 @@ package org.bukkit.entity; /** * Represents a Pig. */ -public interface Pig extends Animals, Vehicle { - - /** - * Check if the pig has a saddle. - * - * @return if the pig has been saddled. - */ - public boolean hasSaddle(); - - /** - * Sets if the pig has a saddle or not - * - * @param saddled set if the pig has a saddle or not. - */ - public void setSaddle(boolean saddled); -} +public interface Pig extends Steerable, Vehicle { } diff --git a/paper-api/src/main/java/org/bukkit/entity/Steerable.java b/paper-api/src/main/java/org/bukkit/entity/Steerable.java new file mode 100644 index 0000000000..da77a7188b --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/Steerable.java @@ -0,0 +1,71 @@ +package org.bukkit.entity; + +import org.bukkit.Material; +import org.jetbrains.annotations.NotNull; + +/** + * Represents an entity which may be saddled, ridden and steered using an item. + */ +public interface Steerable extends Animals { + + /** + * Check if the pig has a saddle. + * + * @return if the pig has been saddled. + */ + public boolean hasSaddle(); + + /** + * Sets if the pig has a saddle or not + * + * @param saddled set if the pig has a saddle or not. + */ + public void setSaddle(boolean saddled); + + /** + * Get the time in ticks this entity's movement is being increased. + * + * Movement speed is often increased as a result of using the + * {@link #getSteerMaterial()}. + * + * @return the current boost ticks + */ + public int getBoostTicks(); + + /** + * Set the time in ticks this entity's movement will be increased. + * + * This will reset the current boost ticks to 0 + * ({@link #getCurrentBoostTicks()}). + * + * @param ticks the boost time + */ + public void setBoostTicks(int ticks); + + /** + * Get the time in ticks this entity's movement has been increased as of the + * most recent boost. + * + * Current boost ticks will never be {@literal >} {@link #getBoostTicks()}. + * + * @return the current boost ticks + */ + public int getCurrentBoostTicks(); + + /** + * Set the time in ticks this entity's movement has been increased relative + * to the most recent boost. + * + * @param ticks the current boost ticks. Must be {@literal >=} 0 and {@literal <=} + * {@link #getBoostTicks()} + */ + public void setCurrentBoostTicks(int ticks); + + /** + * Get the material used to steer this entity when ridden by a player. + * + * @return the lure material + */ + @NotNull + public Material getSteerMaterial(); +} diff --git a/paper-api/src/main/java/org/bukkit/entity/Strider.java b/paper-api/src/main/java/org/bukkit/entity/Strider.java index 4d2dbeaddc..e84baaf95e 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Strider.java +++ b/paper-api/src/main/java/org/bukkit/entity/Strider.java @@ -3,4 +3,23 @@ package org.bukkit.entity; /** * Represents a Strider. */ -public interface Strider extends Animals, Vehicle { } +public interface Strider extends Steerable, Vehicle { + + /** + * Check whether or not this strider is out of warm blocks and shivering. + * + * @return true if shivering, false otherwise + */ + public boolean isShivering(); + + /** + * Set whether or not this strider is shivering. + * + * Note that the shivering state is updated frequently on the server, + * therefore this method may not affect the entity for long enough to have a + * noticeable difference. + * + * @param shivering its new shivering state + */ + public void setShivering(boolean shivering); +} diff --git a/paper-api/src/main/java/org/bukkit/event/entity/StriderTemperatureChangeEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/StriderTemperatureChangeEvent.java new file mode 100644 index 0000000000..8715bfa369 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/entity/StriderTemperatureChangeEvent.java @@ -0,0 +1,46 @@ +package org.bukkit.event.entity; + +import org.bukkit.entity.Strider; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; + +/** + * Called when a {@link Strider}'s temperature has changed as a result of + * entering or existing blocks it considers warm. + */ +public class StriderTemperatureChangeEvent extends EntityEvent { + + private static final HandlerList handlers = new HandlerList(); + private final boolean shivering; + + public StriderTemperatureChangeEvent(@NotNull Strider what, boolean shivering) { + super(what); + this.shivering = shivering; + } + + @NotNull + @Override + public Strider getEntity() { + return (Strider) entity; + } + + /** + * Get the Strider's new shivering state. + * + * @return the new shivering state + */ + public boolean isShivering() { + return shivering; + } + + @Override + @NotNull + public HandlerList getHandlers() { + return handlers; + } + + @NotNull + public static HandlerList getHandlerList() { + return handlers; + } +}