Changing blocks

Discussion in 'Plugin Development' started by 1337, Apr 3, 2011.

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

    1337

    This Code "should" make 2 square rings one outside the other with an obsidian block in the middle, then a wool block on top of that,but it just makes a bit of a mess.the wool,and obsidion in the center work but then it goes wrong, Does anyone know why?
    Code:
    public void makecenterstand(Player player,Location location){
        Material newblock = Material.OBSIDIAN;
        Block oldblock = player.getLocation().getBlock().getFace(BlockFace.DOWN);
        oldblock.setType(newblock);
        Material newflagblock = Material.WOOL;
        Block oldflagblock = player.getLocation().getBlock();
        oldflagblock.setType(newflagblock);
        makefirstring(player,location);
    
    }
    public void makefirstring(Player player,Location location){
        Material newblock = Material.STONE;
        Block blockunderplayer = player.getLocation().getBlock().getFace(BlockFace.DOWN);
        Block one = blockunderplayer.getFace(BlockFace.EAST);
        one.setType(newblock);
        Block two = one.getFace(BlockFace.NORTH);
        two.setType(newblock);
        Block three = two.getFace(BlockFace.WEST);
        three.setType(newblock);
        Block four = three.getFace(BlockFace.WEST);
        four.setType(newblock);
        Block five = four.getFace(BlockFace.SOUTH);
        five.setType(newblock);
        Block six = five.getFace(BlockFace.SOUTH);
        six.setType(newblock);
        Block seven = six.getFace(BlockFace.EAST);
        six.setType(newblock);
        Block eight = six.getFace(BlockFace.EAST);
        seven.setType(newblock);
        makesecondring(player,location);
    }
    public void makesecondring(Player player,Location location){
        Material newblock = Material.MOSSY_COBBLESTONE;
        Block blockunderplayer = player.getLocation().getBlock().getFace(BlockFace.DOWN);
        Block blockleftunderplayer = blockunderplayer.getFace(BlockFace.EAST);
        Block one = blockleftunderplayer.getFace(BlockFace.EAST);
        one.setType(newblock);
        Block two = one.getFace(BlockFace.NORTH);
        two.setType(newblock);
        Block three = two.getFace(BlockFace.WEST);
        three.setType(newblock);
        Block four = three.getFace(BlockFace.WEST);
        four.setType(newblock);
        Block five = four.getFace(BlockFace.SOUTH);
        five.setType(newblock);
        Block six = five.getFace(BlockFace.SOUTH);
        six.setType(newblock);
        Block seven = six.getFace(BlockFace.EAST);
        six.setType(newblock);
        Block eight = six.getFace(BlockFace.EAST);
        seven.setType(newblock);
    }
    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  2. Offline

    1337

    bump
     
  3. Offline

    Tempelchat

    I haven't never used block faces and don't know what uses does it have. In my plugin, I change the mateial of the target block. If I understand your description of the problem right, you want something similar.
    Why do you read/set the material on a face and not the whole block?
    Hmmm. And when you add/subtract x/y/z from the start-block and set the material for each block?

    PS: Maybe, you can draw a little picture (or use smileys) to express the starting- and endingpoint.
     
  4. Offline

    1337

Thread Status:
Not open for further replies.

Share This Page