playerController

A representation of the PlayerController class.

syncCurrentPlayItem()

Synchronizes the currently held item with the server. This method ensures that the server is aware of the item currently being used by the player.

onStoppedUsingItem()

Notifies the server when the player stops using an item. This is typically used for items that have a use duration, like bows or food.

sendUseItem()

Sends a packet to the server indicating that the player is using the currently held item. This can be used for any item that has an action when right-clicked.

placeBlock(BlockPos pos, String facing, ItemStack stack, Vec3 placeVec)

Places a block and sends a packet to the server. pos is the BlockPos you are placing on, stack is the ItemStack that is being used to place and placeVec is the exact position the block was clicked at.

clickBlock(BlockPos pos, String facing)

Simulates a block click action to the server. pos is the BlockPos object representing the position of the block, and facing is a string representing the EnumFacing value of the block face that was clicked.

interactWithEntity(Entity entity)

Sends a packet to interact with a specified entity. entity is the Entity object that the player is interacting with.

attackEntity(Entity entity)

Sends a packet to attack a specified entity. entity is the Entity object representing the entity being attacked.

sendEnchantPacket(int windowId, int button)

Sends a packet to perform an enchantment action. windowId is the ID of the enchantment window, and button is the ID of the button being pressed in the enchantment window.

windowClick(int windowId, int slotId, int button, int mode)

Sends a packet to simulate a window click. windowId is the ID of the window being clicked, slotId is the ID of the slot in the window, button is the mouse button used, and mode is the type of click being performed.

sendPacketDropItem(ItemStack itemStack)

Sends a packet to drop an item. itemStack is the ItemStack object representing the item being dropped.

Last updated