Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Click item in inventory
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 2
Mannyyy

Click item in inventory

By Mannyyy, October 21, 2017 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Mannyyy    0

Mannyyy

Mannyyy    0

  • Tree Puncher
  • Mannyyy
  • Members
  • 0
  • 11 posts
Posted October 21, 2017

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.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7591

diesieben07

diesieben07    7591

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7591
  • 55014 posts
Posted October 23, 2017

How are you opening the inventory? windowClick looks like it should work, it sends packets to the server.

  • Quote

Share this post


Link to post
Share on other sites

Mannyyy    0

Mannyyy

Mannyyy    0

  • Tree Puncher
  • Mannyyy
  • Members
  • 0
  • 11 posts
Posted October 27, 2017

Opening the inventory is server sided with a command (/rewards)

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7591

diesieben07

diesieben07    7591

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7591
  • 55014 posts
Posted October 27, 2017

You already said that. I ask how you do it, as in, post your code.

  • Quote

Share this post


Link to post
Share on other sites

Mannyyy    0

Mannyyy

Mannyyy    0

  • Tree Puncher
  • Mannyyy
  • Members
  • 0
  • 11 posts
Posted October 28, 2017

Then you're not making sense. If I open the inventory with an ingame command, why would I open an inventory with code?

  • Quote

Share this post


Link to post
Share on other sites

Cloudy    14

Cloudy

Cloudy    14

  • Stone Miner
  • Cloudy
  • Members
  • 14
  • 98 posts
Posted October 28, 2017 (edited)

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 October 28, 2017 by Cloudy
  • Quote

Share this post


Link to post
Share on other sites

Mannyyy    0

Mannyyy

Mannyyy    0

  • Tree Puncher
  • Mannyyy
  • Members
  • 0
  • 11 posts
Posted October 28, 2017

Okay,

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 *

  • Quote

Share this post


Link to post
Share on other sites

Cloudy    14

Cloudy

Cloudy    14

  • Stone Miner
  • Cloudy
  • Members
  • 14
  • 98 posts
Posted October 28, 2017

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

  • Quote

Share this post


Link to post
Share on other sites

IceMetalPunk    22

IceMetalPunk

IceMetalPunk    22

  • Diamond Finder
  • IceMetalPunk
  • Members
  • 22
  • 387 posts
Posted October 28, 2017

So you're trying to create a mod that automates a rewards system implemented by another person on a server? That sounds... like you should probably be very careful about whether this is actually a good idea, ethically speaking.

  • Quote

Whatever Minecraft needs, it is most likely not yet another tool tier.

Share this post


Link to post
Share on other sites

Kokkie    55

Kokkie

Kokkie    55

  • Dragon Slayer
  • Kokkie
  • Forge Modder
  • 55
  • 796 posts
Posted October 28, 2017
2 hours ago, Cloudy said:

1. Opens the gui

I think he was trying to say that there is a plugin which has the command /rewards that opens a gui which he calls by doing mc.thePlayer.sendChatMessage("/rewards");

  • Quote

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Share this post


Link to post
Share on other sites

Cloudy    14

Cloudy

Cloudy    14

  • Stone Miner
  • Cloudy
  • Members
  • 14
  • 98 posts
Posted October 28, 2017

Well yes, that much is established, but the code in context is important. 

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 2
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Klarks
      [1.16.4] My structure doesnt work

      By Klarks · Posted just now

      Help plz
    • Klarks
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks · Posted 7 minutes ago

      I get it but my container have a data parametr now   protected MyModContainer(int id, PlayerInventory playerInventory,World world,PacketBuffer data) { super(RegObj.MOD_CONTAINER.get(), id); this.playerInventory = new InvWrapper(playerInventory); world.getEntityByID( data.readInt()).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { addSlot(new SlotItemHandler(h,0,79,18)); }); layoutPlayerInventory(7,54); }   and my anonymous inner class asks for data parametr  too. if i'll leave it null container wont work INamedContainerProvider iNamedContainerProvider = new INamedContainerProvider() { @Override public ITextComponent getDisplayName() { return new StringTextComponent("loh"); } @Nullable @Override public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new MyModContainer(id,playerInventory, world,extraDataWriter); } };
    • diesieben07
      Use ${} in mods.toml

      By diesieben07 · Posted 15 minutes ago

      Correct.
    • diesieben07
      [1.16.*] Run Client/Server error

      By diesieben07 · Posted 16 minutes ago

      If you get that error you are using Java 15 still. However Forge has a recent update that should fix this.
    • diesieben07
      Party System

      By diesieben07 · Posted 17 minutes ago

      1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

    • Klarks
      1
      [1.16.4] My structure doesnt work

      By Klarks
      Started 7 hours ago

    • Klarks
      36
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks
      Started Saturday at 09:56 PM

    • DoctorC
      7
      Use ${} in mods.toml

      By DoctorC
      Started 2 hours ago

    • Luis_ST
      1
      [1.16.*] Run Client/Server error

      By Luis_ST
      Started 1 hour ago

    • Discult
      1
      Party System

      By Discult
      Started 59 minutes ago

  • Who's Online (See full list)

    • Klarks
    • Choonster
    • Heinzchen
    • diesieben07
    • _HungTeen_
    • Luis_ST
    • Thorius
    • Pl00py_R
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Click item in inventory
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community