Setblock

Discussion in 'Plugin Development' started by Ban4ik1, Mar 27, 2023.

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

    Ban4ik1

    Hello everyone, for the plugin I need to install 1-2 blocks using for example a dye. Example: I right-clicked on a stone with a dye in my hand and blocks 1 were placed on top of another in that place. How to do it?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Ban4ik1 What part do you need help with? And what do you have so far?
     
  3. Offline

    Ban4ik1

    Hello, just an idea. I need to say I can get the coordinates of the place on which I clicked the dye and on which blocks, if the block is a stone, then set a block of dirt there for example and a torch above it.
     

    Attached Files:

    Last edited by a moderator: Mar 27, 2023
  4. Offline

    timtower Administrator Administrator Moderator

    Listen to PlayerInteractEvent, do the checks for the item in hand and the block being clicked.
     
  5. Offline

    Ban4ik1

    And how to install the blocks themselves? To the point of pressure?
     
  6. Offline

    timtower Administrator Administrator Moderator

    World#setBlockAt
     
  7. Offline

    Ban4ik1

    Thank you
    Sorry, I understand that stupid questions, but how to check which mouse button a person pressed?

    And forgive me, I don’t know how to use it :( could you please send me a resource where they explain in detail?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Mar 27, 2023
  8. Offline

    timtower Administrator Administrator Moderator

    Think you need to start with a plugin tutorial. They explain what you need.
     
    Last edited: Mar 27, 2023
  9. Offline

    Ban4ik1

    Hi I need help with block detection, I'll show you right now:

    @EventHandler
    public void PlayerSetBake(PlayerInteractEvent e) {

    int id = e.getBlock().getType().getId();
    int blockdata = e.getBlock().getData();

    And so .. With this event, it is not possible to detect a block. But I need to get id and blockdata to use in my code. How can I do this?
     
  10. Offline

    timtower Administrator Administrator Moderator

    @Ban4ik1 Just use e.getBlock().getType()
    After making sure there is a block.
     
Thread Status:
Not open for further replies.

Share This Page