Opening a workbench menu without spout?

Discussion in 'Plugin Development' started by damo1995, Mar 2, 2012.

Thread Status:
Not open for further replies.
  1. Hello all.

    I am wanting to make a portable workbench plugin for my server where you can type /workbench and it will open up the workbench interface and you can craft away. Now i've seen this done via spout where you push the C key but i've not seen it done via command and wondered if it would be even possible without spout. Im hopeing it is because i hate spout and its clientside requirements.

    if somebody could tell me if this is actuly possible and if so, how to open the crafting window.

    Thank you.
    Damo
     
  2. If I followed the commits correctly there was something going on with a better inventory api, but I'm not sure and I wouldn't have any idea how to use it and if it's capable of what you want to achieve.
     
  3. Offline

    nisovin

    I believe something like this should work:
    Code:
    player.openWorkbench(null, true);
    
    It should at least get you started.
     
  4. Awesome, Thanks i shall give that a ago.

    There dosent seem to be a openWorkbench() option.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  5. Yes there is in the latest recommended build.
     
  6. Hmm these are the following options i have: openBrewingStand, openContainer, openDispenser, openFurnace.

    and i am using EntityPlayer & RB6 if that makes a difference.

    Also i did manage it by using the sendpacket command but if there is a way of doing it without this it would be nice.
     
  7. Offline

    nisovin

    Why are you using EntityPlayer? That's not an API class. Use Player.
     
  8. Offline

    Dexeron

    Just a Quick Knowledge Question, If I were to type /wb - how can I show the sender a workbench, is it like .sender.openWorkbench(null, true);
     
  9. Offline

    nisovin

    You'll need to cast the sender to a Player first.
     
  10. Offline

    Dexeron

    nisovin I'm Sorry, How do I do that? (I'm kinda a Noob)
     
  11. Offline

    nisovin

    Code:
    if (sender instanceof Player) {
        ((Player)sender).openWorkbench(null, true);
    }
    
     
  12. the way i did it was like this:
    Code:
    if(sender instanceof CraftPlayer && sender.hasPermission("portableutils.workbench") || sender.isOp()){
                    Player p = sender.getServer().getPlayer(sender.getName());
                    p.openWorkbench(null, true);
                    return true;
                }
    
     
  13. You know, I wouldn't mind adding non-spout-requiring, command-based functionality to the PocketUtilities plugin (which currently supports workbench and has almost finished furnace support... (Be a bit of a pain since I use some spout api's currently, but nothing major or insurmountable). As for hating Spout, it's not Spout's fault the vanilla minecraft client doesn't support basic things like informing the server of key presses for plugins to be able to use them.

    Spout does what it does and requires the client for the things that it requires it for because that's currently the easiest way to provide the functionality Spout adds. If you don't want the functionality it adds then great for you, but hating it doesn't make sense.
     
  14. Offline

    nisovin

    Some corrections and improvements:
    Code:
    if(sender instanceof Player && (sender.hasPermission("portableutils.workbench") || sender.isOp())){
                    Player p = (Player)sender;
                    p.openWorkbench(null, true);
                    return true;
                }
    
     
  15. Offline

    Dexeron

    how do I open a container? p.openContainer doesn't work on latest RB

    nisovin
     
  16. Thanks alot!

    I thaught there would be a easer way. Now just to try and figure out the furnace menu and if it will work without the physical block.
     
  17. This is actually easier than the way skeletonofchaos and I did it in PocketCraft/PocketUtilities. Good to see Bukkit added an API for it, because up until this .openWorkbench() thing, we did have to use EntityPlayer, as well as a custom class inheriting from ContainerWorkbench.

    For the record, I have to use EntityPlayer still, as well as a custom class inheriting from, and overriding a lot of, TileEntityFurnace, in order to get a working portable furnace not tied to a block. It was a pain, and I have to watch the new Bukkit updates very carefully. Would love to see Bukkit's team add an API for that too, though, as it would greatly simplify the process.
     
  18. I just read that thread (I think right after I made those posts was when life got busy and I stopped being active here for a couple months) - if I recall correctly, while it helped simplify the Work Bench and Enchanting Table code, I don't think it had helped at all with the portable furnace efforts - I might be wrong and have missed something at the time though, so I'll take another look at it in the near future.
     
Thread Status:
Not open for further replies.

Share This Page