How to replace (destroy, create) a sign?

Discussion in 'Plugin Development' started by .$pIrit, Mar 23, 2011.

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


    i try to destroy (without a drop) and recreate a sign to bring up the sign dialog to the player.
    But i cant find any functions of this kind.

    So how to do that? :p

  2. Offline

    Edward Hand

    Destroying and recreating a sign is one thing. Making the sign dialogue appear is another thing entirely.
    The sign dialogue is 100% client side. There's nothing the server can do that will make the client open the box I'm afraid. Only the client placing a sign itself will trigger that.
  3. Offline


    Necrothread go.

    So virtualchest uses the following:
    public void openChest{
        EntityPlayer eh =((CraftPlayer) p).getHandle();
    Where lc is a InventoryLargeChest or whichever the singlechest class is.
    On the same note, using

    WorldServer worldServer = ((CraftWorld) player.getWorld()).getHandle();
    TileEntitySign tileEntitySign = (TileEntitySign) worldServer.getTileEntity(signBlock.getX(), signBlock.getY(), signBlock.getZ());
    EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    Does not pop the signedit menu.
    Is this GUI option still solely clientside, or am I missing something.
  4. Offline


    @daemitus The native server coding still contains some old singleplayer client-coding. For example, it still contains all effects played in the world (but nothing happens) and sounds. Common rule when making Bukkit plugins:
    - Does the Bukkit wrapper allow it?
    - Does the craftbukkit or net.minecraft.server allow it?
    - Possible to do from within the server? Stack-trace the calls
    - Not possible? Look through the list of Packets and see if something suitable is there for you

    All I know is that the client handles the GUI. The client right-clicks to place it assuming the server allows it. If after receiving the new block information (sendBlockChange) the previously block is now a sign, it assumes it is allowed.

    There is no way to make the client go into edit-mode, since the client activates this screen by right-clicking. You can, however, hide the sign the user places (sendBlockChange). The client still sees this screen even though the sign is gone. Using onSignChange you can then get the text and do whatever you want with it.

    I use this principle in SignLink for the sign-editing feature.

    Also, I expect Spoutdev to be here any minute saying you can use Spout to do it. :)
  5. Offline


    Well as I always recommend to cases like this. Spout MIGHT do it.
  6. Offline


    Spout does do it, infact theres already one that does.
  7. Offline


    Erm, you can make a client open up any GUI, be it a furnace, chest, sign WITHOUT Spout.
  8. How? :)
  9. Offline


    Send a Window Open Packet?
  10. Offline


    while MCP gives a little info on the contents of a Packet100OpenWindow.
        public int windowId;
        public int inventoryType;
        public String windowTitle;
        public int slotsCount;
    Its still a little vague on what exactly does what.

    And apparently sending one without preparing something beforehand results in an unexpected packet exception, crashing the client.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 13, 2016
  11. Yea, I found that out..
    Use EntityPlayer.a(IInventory inventory);

    In other news, @OP:
    EntityPlayer.a(TileEntitySign sign); should work :)
  12. Offline


    Thats the problem, .a(TileEntitySign) doesnt work :\

    Im currently calling it during a PlayerInteractEvent after changing the block in front of the clicked face into a wallsign.
  13. Oooh. So were back where we started. :D
    Sorry, I see that now.
  14. Offline



    Heres how to open a virtual chest using EntityPlayer.a(blah)

    First we need class extending TileEntityChest (Should make a TEC castable to the below class, I think? Otherwise, hacky workarounds will need to be used.)

    Notice the overide of a(). This is a method which checks if a players distance to the chest is less than 5 blocks or so.

    public class TileEntityVirtualChest extends TileEntityChest {
        public boolean a(EntityHuman entityhuman) {
            return true;
    Now, to use this, I assume we can just cast a TileEntityChest to TileEntityVirtualChest, then we can now use EntityPlayer.a(blah)

    This can be repeated for all other TileEntitys as well.... not just chests.

    It appears I'm retarded, and I got my casts mixed up, but thats how you'd do it.
  15. Oh, your right! Thats why it would fail.
    /me is stupid
    Thanks for the clearup, I'm sure to use it :)
  16. Offline


    Some clever ideas have already been posted here, but another solution is to use Celtic Minstrel's . Works pretty well.
  17. Offline


    The spout plugin takes care of the entire process...players don't even need spoutcraft! :p
    So i'm gonna do it like that, and if Sam really wants it, we'll make it without Spout...
  18. Offline


    Without spout, you can do colors and symbols. You still require spoutcraft to pop the gui for editing.

    So I did some more digging.
    This is mostly based on MCP, and the craftbukkit source.

    Packet100OpenWindow has no option for the sign edit gui.
    Packet130SignEdit UPDATES signs after the gui has been closed.

    As such, it really is impossible at the moment to open a sign edit gui for a player, from a server.

    I sent a tweet to jeb, maybe it'll get implemented in 1.9. Don't hold your breath.


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


    Oh,right,we're talking about signs! Yeah,i was kinda finishing an earlier conversation with tips...
    Yep, spout will be needed to open the gui...
Thread Status:
Not open for further replies.

Share This Page