Placing a ladder block on a given block

Discussion in 'Plugin Development' started by kag359six, Jun 29, 2012.

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

    kag359six

    How would one go about placing a ladder on a block through code? I can only seem to replace the block with the ladder instead of actually putting the ladder on the block. Is there a way to get an individual face of a block and place in there? Any pointers would be nice.
     
  2. Offline

    EnvisionRed

    Just subtract/add 1 from the x or y.
     
  3. Offline

    kag359six

    all that does is drop/break the ladder. It doesnt place the ladder against the block.
     
  4. Try casting the block to a ladder and seeing if you can set the rotation or something. I'm not at my PC right now so I can't check.
     
  5. Offline

    kag359six

    I'm not sure if i understand what your saying. What do you mean casting a block to ladder?
     
  6. Casting means doing something like this
    Code:
    if (block.getType() == Material.LADDER){
    Ladder ladder = (Ladder) block;
    }
    and then you can do
    Code:
    ladder.setFacingDirection()
    You can look here for more information on Ladders.

    Hope this helps!
     
  7. Offline

    kag359six

    how would i define a face in the method setFacingDirection() ?

    New
    how would i define a face in the method setFacingDirection() ?

    heres the code I have for placing a ladder:
    Code:
          for(int y = posY + 1; y < widthY - 1; y++) {
                       
                        Block blockToChange = world.getBlockAt(posX + 1,y,posZ + (width/2));
                        blockToChange.setTypeId(65);
                       
                    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  8. Try type Face and then a dot, your IDE should come up with suggestions. If that doesn't work try BlockFace and then a dot, just guessing.
     
Thread Status:
Not open for further replies.

Share This Page