Solved Specifying Block and Data (byte) on PlayerInteractEvent

Discussion in 'Plugin Development' started by FabeGabeMC, Jan 24, 2014.

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

    FabeGabeMC

    Hi.

    I have been trying to find out how to specify the byte/data of the block I want the player to interact with and I would like to know how. If anyone can post the code, it would be grateful.

    I would like something like this looking like a template to fill with the block I want to add a byte to.
    Byte: (byte) <yourbyte>
    Block: Material.<yourblock>

    Here's what I have so far:

    Code:java
    1. int crate = 33;
    2.  
    3. //====Skipping to event====//
    4.  
    5. @SuppressWarnings("deprecation")
    6. @EventHandler
    7.  
    8. public void onPlayerInteract(PlayerInteractEvent e) {
    9. if(e.getAction() == Action.RIGHT_CLICK_BLOCK && ?????) {
    10.  
    11. }
    12.  
    13. Block c = e.getClickedBlock();
    14. c.setTypeId(crate);
    15. c.setData((byte) 6);
    16. }


    Is it something like that? Or something else?
    By the way, ???? is the one I can't fill out/resolve.

    I might be wrong in every single line of the code.


    ~Gabe
     
  2. Offline

    FabeGabeMC

  3. FabeGabeMC
    I might be just tired, but I have no clue what your problem is. What is supposed replace "?????"?
     
  4. Offline

    FabeGabeMC

    Assist It's supposed to replace the arg {if(??? = what)}.
    Nevermind the post cuz I fixed it.
     
Thread Status:
Not open for further replies.

Share This Page