Item frame interaction

Discussion in 'Plugin Development' started by pie_flavor, Jul 22, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    pie_flavor

    I am making a plugin that involves custom item frame interaction. I want to be able to tell when a player tries to pop the item out of the frame. How is this done?
     
  2. Offline

    AcePilot10

    Try onInteract, get what the player clicked, check if it was an item frame, then cancel it
     
    DoggyCodeâ„¢ likes this.
  3. Offline

    pie_flavor

    @AcePilot10 Interact is when a player rightclicks an entity. One tries to pop the item out of the frame by left clicking, leaving it empty. The second left click is what breaks it.
     
  4. Offline

    AcePilot10

    @pie_flavor I believe your thinking of PlayerInteractEntityEvent, PlayerInteractEvent is when the player right/left clicks. You can specify it by checking the action.
    Code:
    if(event.getAction() == Action.LEFT_CLICK_BLOCK)) {
    What Is listen for when a item frame is broken and cancel it, AND cancel the event when they interact with it.
     
  5. Offline

    Konato_K

    @pie_flavor A player left clicking an itemframe triggers an EntityDamageByEntityEvent
     
  6. Offline

    pie_flavor

    @Konato_K Thank you. @AcePilot10 An item frame is an entity, not a block. PlayerInteractEvent covers blocks only.
     
Thread Status:
Not open for further replies.

Share This Page