diff --git a/paper-api/src/main/java/io/papermc/paper/entity/Frictional.java b/paper-api/src/main/java/io/papermc/paper/entity/Frictional.java new file mode 100644 index 0000000000..315558d8a5 --- /dev/null +++ b/paper-api/src/main/java/io/papermc/paper/entity/Frictional.java @@ -0,0 +1,35 @@ +package io.papermc.paper.entity; + +import net.kyori.adventure.util.TriState; +import org.bukkit.entity.Entity; +import org.jspecify.annotations.NullMarked; + +/** + * Represents an {@link Entity} that can experience friction with the air and ground. + */ +@NullMarked +public interface Frictional { + + /** + * Gets the friction state of this entity. + * When set to {@link TriState#TRUE}, the entity will always experience friction. + * When set to {@link TriState#FALSE}, the entity will never experience friction. + * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. + * + * @return the entity's friction state + */ + TriState getFrictionState(); + + /** + * Sets the friction state of this entity. + * When set to {@link TriState#TRUE}, the entity will always experience friction. + * When set to {@link TriState#FALSE}, the entity will never experience friction. + * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. + *

+ * Please note that changing this value will do nothing for a player. + * + * @param state the new friction state to set for the entity + */ + void setFrictionState(TriState state); + +} diff --git a/paper-api/src/main/java/org/bukkit/entity/Item.java b/paper-api/src/main/java/org/bukkit/entity/Item.java index ced419f865..bcc6ba95bd 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Item.java +++ b/paper-api/src/main/java/org/bukkit/entity/Item.java @@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable; /** * Represents a dropped item. */ -public interface Item extends Entity { +public interface Item extends Entity, io.papermc.paper.entity.Frictional { // Paper /** * Gets the item stack associated with this item drop. diff --git a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java index fd4d74a637..8cc4ab8f56 100644 --- a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; /** * Represents a living entity, such as a monster or player */ -public interface LivingEntity extends Attributable, Damageable, ProjectileSource { +public interface LivingEntity extends Attributable, Damageable, ProjectileSource, io.papermc.paper.entity.Frictional { // Paper /** * Gets the height of the living entity's eyes above its Location. diff --git a/paper-api/src/main/java/org/bukkit/entity/Minecart.java b/paper-api/src/main/java/org/bukkit/entity/Minecart.java index c3c94a5694..0e4163c935 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Minecart.java +++ b/paper-api/src/main/java/org/bukkit/entity/Minecart.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; /** * Represents a minecart entity. */ -public interface Minecart extends Vehicle { +public interface Minecart extends Vehicle, io.papermc.paper.entity.Frictional { // Paper /** * Sets a minecart's damage.