Left_click_block action and Break block - possible issues ?

Discussion in 'Plugin Development' started by Webster56, Apr 24, 2013.

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

    Webster56

    Hello world,

    I am currently doing a plugin that requires a Player to left click on an enchantment table, which would do something without any confirmation from the player, and I was wondering if that action would be carried out if the player left clicks to break the block.

    Thanks for reading :)
     
  2. Offline

    Rprrr

    PlayerInteractEvent.
     
  3. Offline

    Webster56

    Yep, that's what i'm using

    Code:
    public void onPlayerInteractEvent(PlayerInteractEvent e)
        {   
            //if the player clicked on an enchantment table, we handle it
            if(e.getAction()==Action.LEFT_CLICK_BLOCK && e.getClickedBlock().getTypeId()==116)
            {
                handler.PlayerInteractEventHandler(e);
            }
        }
    So, will it be handled if the player tries to break block id 116 ?
     
  4. Offline

    Webster56

    The probleme I expected happens, when people try to break an enchantment table it pops back and nothing loots.

    So how to fix this, just so when people try to break the enchantment table (with any tool or at least pickaxes) it actually breaks ?
     
  5. Webster56
    Interact is a single click, BlockBreakEvent is when you break a block and BlockDamageEvent is when you click a block to damage it which leads to breaking.

    I'm not really sure I understand your problem... what pops back ?
    It should break properly, unless you're actually canceling break... or breaking the block manually by setting it to air...
     
  6. Offline

    Webster56

    Well, it's like when you don't have permission to build on a certain place, when you try to break a block, it appears half a second later and it's like nothing happened.

    The thing is, no special thing should happen on a BlockDamageEvent.
     
  7. Offline

    blablubbabc

    i /think/ I have the same problem: I want to do something when a player interacts via left click on a block. But I do NOT want to run this action if the block breaks through this interaction just a moment later. The problem is there is no way to determine if the block will break. What I can think of is: Run a task with 1 tick delay, that checks at beginning if the block is still there..
     
  8. Why don't you use right-click as interaction ? It's a game default mechanic and it would spare needless complications to detect breaking and stuff like that...
     
  9. Offline

    Webster56

    It's an enchantment table, and I wish to keep the interact on that block, that's why no right-click.

    Or you have an idea of a block that might suit well to convey XP points from the player's body to a glass bottle in a role-play way ?
     
  10. Offline

    blablubbabc

    Another solution for this would be: on right click do nothing (let the default enchantment-table stuff happen), but on right-click while crouching do your special action and cancle the default enchantment-table action.
     
  11. Webster56
    Recipes :p

    But if your interaction needs an exp bottle then you could only do your thing if the player is holding an exp bottle, otherwise let it do its original thing.

    blablubbabc
    Crouch+interact is so overrated, used by alot of other plugins... and now used by the game too, so it's conflict-prone.
     
  12. Offline

    Webster56

    Digi

    That's what it should do, the PlayerInteractEvent only looks that, but it doesn't work :/

    If you have time, would you look at my Github repository ? Maybe you'll see what's wrong.
     
  13. Offline

    EvilPeanut

    Ok, when the following code is ran it downloads a corrupt texture pack and on the minecraft client shows "Downloading texture pack (-0.0%) -1324124MB" or something wierd for a split second.

    My code which isnt working:
    Code:
    ((Player)sender).setTexturePack("http://fs02n2.sendspace.com/dl/2eb83e98a263e3db1cbbf55e3164c3dc/51865e8e51bf32fc/0xdcym/ZombiesTexture.zip");
    I am sure the download link works and i have tried dropbox, none work.

    The texture sizes per block are 128x128
     
    blablubbabc likes this.
  14. Offline

    Webster56

    EvilPeanut I think you're in the wrong thread man :)
     
  15. Offline

    cgpice

    why not forcible break the block in on block break event?
    so set tit o air if block break event and if it is enchantment table

    on another note: check your handle, you might have an event.setcanceled(true) somewhere
     
    Webster56 likes this.
  16. Offline

    Webster56

    Oh well, there was the setCancelled, thanks :p
     
Thread Status:
Not open for further replies.

Share This Page