Multiple blocks placed from 1 block being placed

Discussion in 'Plugin Development' started by sockmonkey1, Aug 20, 2013.

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

    sockmonkey1

    I'm working on a plugin that will require a few blocks being places from one block.
    So for example the player will place one wool block and 3 wool blocks will appear right on top of the one wool block.
    I tried to look around a little and I couldn't find anything. I'm still looking and just thought maybe someone here has already done this and could help.

    Thanks in advance.
     
  2. Offline

    Datdenkikniet

    Get the x,y,z of the block, and then edit the create three locations that are at the position you want, so that you have the three block on top of the block, and set them to what you want
     
  3. Offline

    sockmonkey1

    I was kind of looking for more of a coded example. I just don't understand what you mean. I'm sorry, I am still learning.
     
  4. Offline

    sockmonkey1

    Little early on the bump. Don't hate me! >.<
     
  5. Offline

    Datdenkikniet

    I'll do it tomorrow, first I'm going to sleep.
     
  6. Offline

    sockmonkey1

    I'd like that. Thanks,
     
  7. Offline

    NoChanceSD

    sockmonkey1
    I never made anything that changes blocks before, but i think something like this would work:
    Code:java
    1. @EventHandler
    2. public void onBlockPlace(BlockPlaceEvent event){
    3. if(event.getBlock().getType().equals(Material.WOOL)){
    4. Location loc = event.getBlock().getLocation();
    5. for(int i = 0; i < 3; i++){
    6. loc.setY(loc.getY() + i);
    7. loc.getBlock().setType(Material.WOOL);
    8. loc = event.getBlock().getLocation();
    9. }
    10. }
    11. }
     
  8. Offline

    sockmonkey1

    Aw sweet, I'll try this out and let you know. Thanks so much NoChance20
     
Thread Status:
Not open for further replies.

Share This Page