Creating a Wall Sign

Discussion in 'Plugin Development' started by Naxum, Apr 6, 2011.

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

    Naxum

    I am absolutely lost with creating wall signs.

    Right now I'm checking a 3x3 square on the ground, and attempting to attach wall signs to the outer edge or each block on the square. No matter what I do I can't figure it out, and Google isn't helping.

    I'm not sure if I should be setting the material of a block to Material.SIGN or Material.SIGN_POST, and I have no idea how to do the data, because I can't even see a possible way of converting BlockFace to the actual byte data needed. :(

    halp
     
  2. Offline

    ssell

    @Naxum

    Never did this with signs myself, but it seems like you would do the following:
    1. The block that you want to make the 'wall sign', set it's material to Material.WALL_SIGN (or ID 68).
    2. Next, determine what block you want the sign to be attached to.
    3. Find the direction of the block from the sign, and set the sign's data to the appropriate direction. Example:
    Wall Sign facing East
    Code:
    signBlock.setData( 0x2 );
    
    or you can set the Material and direction all in one go:
    Code:
    signBlock.setTypeIdAndData( 68, 0x2, true );
    
    Whatever you do, do not set it to SIGN or SIGN_POST. This is for the normal standing signs. Remember that these seem like only 1 'object', but are actually 2 blocks working in tandem. They are not the same as the WALL_SIGN.

    http://www.minecraftwiki.net/wiki/Data_values#Wall_Signs

    edit: Or maybe SIGN is the actual item that players keep in their inventory. Either way, I would imagine that it should not be used for this.
     
  3. Offline

    Naxum

    Thanks for the reply. I actually checked out the Worlhole-X-Treme plugin for how they do wall signs, and figured it out from their glorious code.

    Block signBlock
    BlockFace facing



    signBlock.setType(Material.WALL_SIGN);
    switch ( facing )
    {
    case NORTH:
    signBlock.setData((byte)0x04);
    break;
    case SOUTH:
    signBlock.setData((byte)0x05);
    break;
    case EAST:
    signBlock.setData((byte)0x02);
    break;
    case WEST:
    signBlock.setData((byte)0x03);
    break;
    default:
    break;
    }
    signBlock.getState().setData(new MaterialData(Material.WALL_SIGN));
    Sign sign = (Sign)nameSign.getState();
    sign.setLine(0, "sup");

    hopefully that helps others in the future.
     
    TheFusion998 likes this.
Thread Status:
Not open for further replies.

Share This Page