SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-06-17 14:31:36 +10:00
parent 6b90c83282
commit 8f69d9dde3
2 changed files with 33 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package org.bukkit.block;
import org.bukkit.inventory.BlockInventoryHolder;
import org.bukkit.inventory.ChiseledBookshelfInventory;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
/**
@@ -37,4 +38,16 @@ public interface ChiseledBookshelf extends TileState, BlockInventoryHolder {
*/
@NotNull
ChiseledBookshelfInventory getSnapshotInventory();
/**
* Gets the appropriate slot based on a vector relative to this block.<br>
* Will return -1 if the given vector is not within the bounds of any slot.
* <p>
* The supplied vector should only contain components with values between 0.0
* and 1.0, inclusive.
*
* @param position a vector relative to this block
* @return the slot under the given vector or -1
*/
int getSlot(@NotNull Vector position);
}