How do I prevent an item frame's item from being rotated?

Discussion in 'Plugin Development' started by tylersyme, May 25, 2013.

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

    tylersyme

    So I'm wanting to stop items inside item frames from being rotated. And I've tried a few things that haven't worked

    Code:
    @EventHandler
        public void entityInteractItem_Frame(PlayerInteractEntityEvent event)
        {
            if (event.getRightClicked().equals(EntityType.ITEM_FRAME))
            {
                if (event.getPlayer().getGameMode().equals(GameMode.SURVIVAL))
                {
                    event.setCancelled(true);
                }
            }
        }
    That didn't do anything

    And since there isn't a PlayerInteractHangingEvent, I'm not sure what to do
     
  2. Offline

    chris4315

    Try:
    Code:java
    1.  
    2. public void disableFrameRotate(PlayerInteractEvent event){
    3. if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && event.getClickedBlock().equals(Material.ITEM_FRAME)){
    4.  


    from there you can add any other conditions and then cancel the event
     
  3. chris4315
    Item frames are not blocks, they're entities.

    tylersyme
    First make sure it triggers, print a message right at the begining of the event with the type of the entity interacted.
     
    hintss likes this.
  4. Offline

    LazyLemons

    tylersyme
    Code:
    if (event.getRightClicked().getType().equals(EntityType.ITEM_FRAME))
    
     
Thread Status:
Not open for further replies.

Share This Page