PacketInteractionEntity

Interface for packet-only Interaction entities that can receive player clicks. These entities exist only in packets sent to clients - they are not added to the server world. When players click on them, callbacks are fired.

Functions

Link copied to clipboard
public abstract float getHeight()
Gets the height of the interaction hitbox.
Link copied to clipboard
public abstract float getWidth()
Gets the width of the interaction hitbox.
Link copied to clipboard
public abstract void setLeftClickCallback(BiConsumer<Player, PacketEntityInterface> callback)
Sets a callback to be invoked when a player left-clicks (attacks) this interaction entity.
Link copied to clipboard
public abstract void setRightClickCallback(BiConsumer<Player, PacketEntityInterface> callback)
Sets a callback to be invoked when a player right-clicks this interaction entity.
Link copied to clipboard
public abstract void setSize(float width, float height)
Sets the size of the interaction hitbox.

Inherited functions

Link copied to clipboard
public abstract void addRemoveCallback(Runnable callback)
Link copied to clipboard
public abstract void addViewer(UUID uuid)
Link copied to clipboard
Link copied to clipboard
public void dismount()
Dismounts this packet entity from any vehicle.
Link copied to clipboard
public abstract void displayTo(UUID uuid)
Link copied to clipboard
public B getBukkitEntity<B extends Entity>()
Gets the underlying Bukkit entity for direct modification.
Link copied to clipboard
public int getEntityId()
Gets the entity ID of this packet entity.
Link copied to clipboard
public abstract Location getLocation()
Link copied to clipboard
public abstract UUID getUniqueId()
Link copied to clipboard
public void handleInteraction(Player player, boolean isAttack)
Called internally when a player interacts with this packet entity.
public void handleInteraction(Player player, PacketInteractionContext context)
Called internally with the exact decoded packet action and hand.
Link copied to clipboard
public abstract boolean hasViewers()
Link copied to clipboard
public abstract void hideFrom(UUID uuid)
Link copied to clipboard
public void mountTo(int vehicleEntityId)
Makes this packet entity ride another entity (the vehicle).
Link copied to clipboard
public abstract void remove()
Link copied to clipboard
public abstract void removeViewer(UUID uuid)
Link copied to clipboard
Sets a left-click callback that receives the decoded interaction context.
Link copied to clipboard
Sets a right-click callback that receives the decoded action and hand.
Link copied to clipboard
public abstract void setVisible(boolean visible)
Link copied to clipboard
public void syncMetadata()
Syncs entity metadata to all viewers.
Link copied to clipboard
public abstract void teleport(Location location)

public void teleport(Location location, AbstractPacketBundle bundle)
Bundled teleport: adds this entity's position update to the given packet bundle instead of sending it directly, so per-tick movers (e.g.