diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java index 7069de30..d1b37530 100644 --- a/src/main/java/org/bukkit/entity/FishHook.java +++ b/src/main/java/org/bukkit/entity/FishHook.java @@ -1,5 +1,8 @@ package org.bukkit.entity; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + /** * Represents a fishing hook. */ @@ -98,4 +101,65 @@ public interface FishHook extends Projectile { */ @Deprecated public void setBiteChance(double chance) throws IllegalArgumentException; + + /** + * Check whether or not this fish hook is in open water. + *
+ * Open water is defined by a 5x4x5 area of water, air and lily pads. If in + * open water, treasure items may be caught. + * + * @return true if in open water, false otherwise + */ + public boolean isInOpenWater(); + + /** + * Get the entity hooked by this fish hook. + * + * @return the hooked entity. null if none + */ + @Nullable + public Entity getHookedEntity(); + + /** + * Set the entity hooked by this fish hook. + * + * @param entity the entity to set, or null to unhook + */ + public void setHookedEntity(@Nullable Entity entity); + + /** + * Pull the hooked entity to the caster of this fish hook. If no entity is + * hooked, this method has no effect. + * + * @return true if pulled, false if no entity is hooked + */ + public boolean pullHookedEntity(); + + /** + * Get the current state of this fish hook. + * + * @return the fish hook state + */ + @NotNull + public HookState getState(); + + /** + * Represents a state in which a fishing hook may be. + */ + public enum HookState { + + /** + * The fishing hook has been cast and is either in the air or resting + * against a block on the ground. + */ + UNHOOKED, + /** + * The fishing hook has hooked an entity. + */ + HOOKED_ENTITY, + /** + * The fishing hook is bobbing in the water, waiting for a bite. + */ + BOBBING; + } }