[REQ] Link a chest to a sign???

Discussion in 'Archived: Plugin Requests' started by grinch843, Apr 14, 2011.

  1. Offline

    grinch843

    Hi,​
    I saw a plugin called RemoteChests which gave me an idea of linking a chest to a sign, I also posted this in the remotechests thread to see if this would be an option for that plugin. If this can be added to remotechest that would be great, but a separate plugin with just this feature would be preferred because I don't really need all the options that remotechests has.

    I've got a room where all of our storage chests are but we've run out of space to add more chests, can't expand due to other structures around the room. What I would like to do is make a another room somewhere off the beaten path that I can put all our chests in, then attach a sign to a chest, then go to our main storage area, place another sign on the wall and have it linked to a chest in the other storage area, then when we hit the sign it would open the chest linked to that sign. This would also make organizing a storage room easier, if you want to move or re-order anything just break a sign and move it, a lot less hassle then moving the contents of one chest to another. Also, you don't have to worry about what the room with the actual chests looks like, just dig out a cave somewhere and start dumping chests, if ya run out of room, expand the cave.

    Would something like this be possible?

    Thanks,
    Grinch843....​
     
  2. Offline

    grinch843

    No Takers :(....
     
  3. Offline

    matter123

    i could try to do this,it would use the xyz values of a chest to link it to that chest and it would look for a nearby chest to display the contents
    the sign format would be
    [sign chest]
    name
    <x,y,z> of remote chest
    <radius to search for>
     
  4. Offline

    grinch843

    Any way to avoid using 2 chests? My goal is to have 1 chest and 2 signs. The first sign would be next to the chest with a chest id on the first line of the sign, [CID 123] for example, then lets say I'am at my house which is about 200 blocks away from our storage room, I place a sign on the wall that has [CID 123] as the first line. Then, whenever I right click on the sign, it lets me access what's in the chest.

    Thanks,
    Grinch843....
     
  5. Offline

    matter123

    no but 5 different signs can be linked to the same result chest
    so you just put one chest in a room with 20 different signs
     
  6. Offline

    beastsniper

    what if you try linking them via command. for example /chestsign(cs) link [name] then you put a sign down somewhere saying [chestsign] on the first line and the name of the chest on the second.
    Code:
    /chestsign link chest1
    or /cs link chest1
    
    sign:
    [chestsign]
    chest1
    maybe you could add a lock to using the sign by adding [private] to the last line but thats up to who ever will make this.

    But any way this sounds like it would be a great plugin I would put this on my server the second someone makes this. great idea.
     
  7. Offline

    matter123

    yes but you still need a chest to display the chests inventory in
     
  8. Offline

    beastsniper

    yes I know you target the chest when you type the command sorry I should have been more specific with it.
    heres a bit more detail in what I am thinking
    Code:
    you target the chest
    type /chestsign link [name] OR /cs link [name]
    place a sign down that looks like this
    [chestsign]
    [name]
    (blank)
    (blank)
    now when you right click the sign its the same as opening the chest
    maybe get it to work with chestlock, LWC, and lockette so if the chest is locked
    you can't open it via sign
     
  9. Offline

    matter123

    what is wrong with my method
     
  10. Offline

    beastsniper

    nothing is wrong with it but you need to get the cords which is not always so easy and if you have more then 1 chest in that area it will probably get all messed up with my idea its mainly just making in a bit easier to set up with less chance of errors like there are 4 chests in the specified area. Now I know i'm not the one making this therefor I can not tell you how to make it BUT what I can do is help you make it in a way that people would like doing it on there server. if you make this plugin I will get it no matter which way you do it but i'm not asking for credit of the idea just trying to help. I hope you take my idea into consideration.
     
  11. Offline

    matter123

  12. Offline

    jamescosten

    Submission, bow before the master
     
  13. Offline

    matter123

    ok...
     
  14. Offline

    grinch843

    @matter123 - I like beastsniper's idea. This would require 1 less sign then my idea and he's got a point about using the coordinates, I would think it could get messy when you have a room full of chests & signs all bunched up. Also wouldn't this eliminate the need to have 2 chests since you are linking the sign directly to the chest itself? If so this is exactly what I was looking for.

    Thanks,
     
  15. Offline

    matter123

    @grinch843 i can do that but you still need a chest to display the inventory in where else I'm supposed to put the inventory
     
  16. Offline

    grinch843

    Sorry, didn't word that right. It would eliminate 1 chest so you would end up with just 1 sign and 1 chest right? Or am I just totally off the mark with the way this would have to work?

    I guess the simple question is can this be done using 1 chest and 1 sign?

    Sorry for all the confusion, I know what I would like to accomplish but I don't know the mechanics behind minecraft so I'am not sure if it can even be done like this.

    Thanks,
    Girnch843....
     
  17. Offline

    matter123

    @grinch843
    you can have X chest linked to one remote sign
    so twenty chest would have 20 signs next to one chest
     
  18. Offline

    beastsniper

    his idea is a search radius so if theres more then 1 chest in that area it wont work my idea is saying (very simply) use /chestsign link [name] on a chest put a sign down with [chestsign] on line 1 and the name on line 2 and when you right click the sign the chest that you linked with that name opens
     
  19. Offline

    matter123

    @beastsniper if you right click on a sign where would i put the chest contents with your method

    if you had x chest you would need x+1 chest in total and x signs
    so ina room you would have 20 chest
    in another room you would have 20signs and one chest

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

    beastsniper

    wait why another chest in the room with the signs?
     
  21. Offline

    Celtic Minstrel

    As one of the people who has been working on getting inventory hooks into Bukkit, I can say that several people in this thread are making it more complicated than it needs to be.

    First of all, suppose you just have a room full of signs, each of which somehow links to a remote chest. The most straightforward way of doing it would be to simply tell the client to open an inventory window for the remote chest. This is possible, and will work, except there's a catch. The chest has a function which the game uses to determine whether it is "reachable" by the player, and in this situation it will always return false, causing the server to immediately tell the client to close the window. But this can be worked around with a bit of work.

    The other method mentioned in the thread involved using a physical chest, and (I'm guessing) setting that chest's inventory to be a reference to the remote chest's inventory. This is in my opinion an uglier way to do it, but does have the advantage of not needing to dig into the obfuscated Minecraft code (which in this case would amount to implementing an obfuscated interface and calling one method in EntityPlayer).

    As much as I dislike "magic signs", it is in my opinion much preferably to using a command to handle this. My suggestion would be to have a "magic item" which is configurable; when holding that item in your hand, you can right-click a chest and, instead of opening the chest, it will ask you to name it. Then you can make a sign with some "magic word" on it and the name of the chest. Also, forcing the use of coordinates instead of a nice name would in my opinion be a bad design decision, though allowing it as an option would be fine.

    It is possible to make a chest open when you right-click a sign. I'm sure several people here were under the impression that you can only get the chest window by right-clicking a chest, but that simply isn't the case.
     
  22. Offline

    matter123

    ah what does that mean

    could you explain this some more please
     
  23. Offline

    beastsniper

    there is a plugin called suppysign which opens an inventory (basically a chest) so you would have to use something like that so opening a chest im sure is possible and cant be to hard
     
  24. Offline

    Celtic Minstrel

    Well, I assume you know what an interface is. In order to display a chest window without actually having a chest in front of you, you would need a class that implements net.minecraft.server.IInventory; its constructor would an IInventory parameter, and all methods except for one would be deferred to that IInventory. Then you would need to cast the Player to CraftPlayer and call getHandle().a() or something like that.

    I'm going to assume you mean to explain what my suggestion was. I'll put it in point form for you, from a user's perspective.
    1. Holds an iron ingot in your hand.
    2. Right-click the chest you want to be able to access remotely.
    3. Bring up chat and type in a name for the chest. No command, just the name. Example: "myremotechest"
    4. Go somewhere else and place a sign. Put "[chestsign]" on the first line and "myremotechest" (or whatever you called it) on the second.
    5. Right-click the sign.
    6. Voila, you're viewing your chest remotely.
     
  25. Offline

    beastsniper

    I didnt read this before sorry but my idea you dont need a chest you need a sign kinda like supplysign how it opens an inventory screen but maybe if you make it like all commands insted of hitting a sign? maybe like the chestsign command thing i was thinking of maybe make it /portablechest link [name] and /portablechest open [name]
     
  26. Offline

    matter123

  27. Offline

    beastsniper

  28. Offline

    Celtic Minstrel

    Unfortunately, SupplySign does not appear to have source code released. It does presumably do what I mentioned with implementing IInventory. If you want sample code that does a similar thing, I suggest you check out some of Afforess's plugins (Simple Barter for example).
     
  29. Offline

    matter123

    couldent i just decompile supply sign?
     
  30. Offline

    Celtic Minstrel

    Yes, yes you could. It turns out that that's not necessary though; the source is included in the jar.

    I just looked, and it seems SupplySign has found a different way of doing it; instead of implementing IInventory, they made a player inventory linked to the person viewing the chest. That has some advantages over the idea of implementing IInventory, but it also has the disadvantage of copying the items from the chest to the new inventory. Personally I think it's better to implement IInventory, since that would require less code to do.
     

Share This Page