Jump to content

Click item in inventory


Recommended Posts

I'm creating a mod where it will run a command (that open's an inventory) and then click a slot in that inventory.
I'm using 

mc.playerController.windowClick(mc.thePlayer.openContainer.windowId, 13, 0, 0, mc.thePlayer);


The problem with this is (I think due to the inventory being server sided), it clicks the item but the action that follows doesn't happen. I could click the inventory normal and I receive x amount of credits but when this runs, it just moves the item to my cursor, then puts it back in the inventory slot. Any help is appreciated.

Link to comment
Share on other sites

Uh... I think it is you that isn't making sense with that statement.


In order to open an inventory using a command, you'd need code to handle opening the inventory on the server. Please post full code so we can see what's wrong instead of wrongly claiming that people aren't making sense when all they are asking for is your code...


Of course, it could be the case that you don't have access to the server side code (as it isn't your server or mod) - in which case, please be clear about that. You haven't given much to go on, and one single line of code is difficult to diagnose any problems with.


Please post more code if you're able. 


Edited by Cloudy
Link to comment
Share on other sites


I have NO CODE to open an inventory since i open the inventory with a command ON THE SERVER. The server has a command /rewards WHICH OPENS AN INVENTORY GUI. I use mc.thePlayer.sendChatMessage("/rewards") TO OPEN THE INVENTORY. The server IS NOT A FORGE SERVER it is a BUKKIT SERVER and all I'm trying to do is CLICK A SLOT IN THAT INVENTORY. understand now?

* Important parts in caps *

Link to comment
Share on other sites

There is literally no need to be rude about it, when it was lack of explaining on your part which got into this situation. We unfortunately cannot read minds. 


If you want help, for free, from people on forums being nice about it and not an asshole is more likely to get results :)


Can you show the parts of your code which 1. Opens the gui and 2. Clicks on the slot? Ideally in context, so we can see the execution flow - it could be something such as a timing issue, and without full code it is difficult to see such issues. One line of code is not enough to go on, especially as it is such a niche thing which is unlikely to have been done much before :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.