Skip to content

Send item pickup animation #933

Description

@iGabyTM

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
I want do play the item pickup animation to the player. I have checked the minecraft code (net.minecraft.network.protocol.game.ServerboundPickItemPacket) and there's only one field for the slot where the item will go but on wiki there are 3 fields which makes sense because you would have to specify all these information, right?
https://wiki.vg/Protocol#Collect_Item

API method(s) used
List what API method(s) you're using

Expected behavior
Send the animation with the given item and amount.

Code

            final PacketContainer packet = new PacketContainer(PacketType.Play.Client.PICK_ITEM);
            packet.getIntegers()
                    .write(0, itemToPickup.getEntityId())
                    .write(1, player.getEntityId())
                    .write(2, amountLeft);

Additional context
com.comphenix.protocol.reflect.FieldAccessException: Field index out of bounds. (Index: 1, Size: 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions