Jump to content

Recommended Posts

Posted

Hi. I need your help. I want to send a packet to the server which makes mi click item in the chosen slot. I already have gui, Container and Slot but don't know how to send packets. I created channel and Network but there are no tutorials how to send packet to do something in gui. Can somebody help me or send a tutorial where someone tells how to perform actions in gui. Like putting or taking items.

Posted

you can get the current AbstractContainerMenu from the player it's a public field,
make sure before you interacte with the Menu your are on Server and ServerPlayer#containerCounter match with the
containerId of the Menu. Then you can get the Slot via AbstractContainerMenu#getSlot

Posted

But I don't think you understand what I mean. I already have gui and a Slot. I need to create mod only for client because I want to use it not on my server. And I want to take an item or click the chosen Slot in the gui. I just need to make server register this action.

Posted (edited)

This will not work client only, it also sounds like cheating...
If this is your server, why did you not create a Mod for both server and client

Edited by Luis_ST
spelling mistake
Posted
  On 3/28/2022 at 7:04 PM, Luis_ST said:

This will not work client only, it also sounds like cheating...
If this is your server, why did you not create a Mob for both server and client

Expand  

???. I said it isn't my server and what do you mean by creating a Mob? I don't need any mobs.

Posted (edited)
  On 3/28/2022 at 7:13 PM, Luis_ST said:

it was a spelling mistake😅, i already fixed it
What exactly did you try to achieve?

Expand  

I'm trying to click in the chosen slot when player opens a gui. I already made a event which checks if gui is correct and I already have chosen slot. Now I only need to click this slot from client side but I have to make it register on the server. So if I click item in chest it makes it click on the server too. Just like the player normally clicked it. I could create a list of coordinates for every slot and then move it to chosen coords and make mouse click in program but I know that there has to be a better way to do it.

Edited by Skw972
Posted
  On 3/30/2022 at 2:21 PM, Skw972 said:

I'm trying to click in the chosen slot when player opens a gui. I already made a event which checks if gui is correct and I already have chosen slot. Now I only need to click this slot from client side but I have to make it register on the server. So if I click item in chest it makes it click on the server too. Just like the player normally clicked it.

Expand  

this is not the reason for why you do this from client

  On 3/30/2022 at 2:21 PM, Skw972 said:

I know that there has to be a better way to do it.

Expand  

yeah do it from server

  • 1 year later...
Posted
  On 2/10/2024 at 3:35 PM, LZDQ said:

Bro I wrote a python script to sort my slots. I send http request from java to python and sort my slots within 1s.

Expand  

Hi there. Today I figured out how to send a packet of swapping two items in inventory by hovering on one and press the hotbar button of another. Clicking one is similar.

First I intercept all the outgoing packets and found one called `net.minecraft.network.protocol.game.ServerboundContainerClickPacket` which does the exactly thing you wished for.

Then search the source code (I get it in intellij idea's cache) and use grep to find all occurences (or you can use intellij or other IDE to grab all references but my IDEs all failed to do that) and read the code. Finally the wrapper for doing modification client-side and sending packet is `Minecraft.getInstance().gameMode.handleInventoryMouseClick`.

My code here:
 

    private static void swapSlot(int slot_from, int slot_to){
        // slot_from is the inventory id (for hotbar, it is [36, 45) )
        // slot_to is the hotbar id [0, 9)
        Minecraft mc = Minecraft.getInstance();
        //mc.player.sendOpenInventory();   We don't even need to open the inventory. Actually there is not a packet telling server to open inventory, only a packet of telling server to close it but we don't need it either.
        //Inventory inventory = mc.player.getInventory();
        InventoryMenu inv_menu = mc.player.inventoryMenu;
        mc.gameMode.handleInventoryMouseClick(
                inv_menu.containerId,
                slot_from,
                slot_to,
                ClickType.SWAP,
                mc.player
        );
    }

 

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.

Guest
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Looking for the best way to save big on your Temu purchases? Look no further than the Temu coupon code $100 off, which brings you massive savings with just a few clicks. One of the most powerful coupon codes right now is acs670886. This Temu coupon code will give maximum benefits for people residing in the USA, Canada, and European nations. With the Temu coupon $100 off and Temu 100 off coupon code, you can unlock exclusive deals and discounts that make shopping on Temu even more rewarding. What Is The Coupon Code For Temu $100 Off? Whether you're a new or returning customer, this exclusive code opens the door to amazing savings on the Temu app and website. Just apply the Temu coupon $100 off or $100 off Temu coupon and enjoy discounts you can't find anywhere else. acs670886 – Flat $100 off instantly on eligible purchases.   acs670886 – Enjoy a $100 coupon pack for multiple uses.   acs670886 – Get $100 flat discount as a welcome gift for new customers.   acs670886 – Extra $100 promo code tailored especially for existing customers.   acs670886 – $100 coupon specially designed for users in the USA and Canada.   Temu Coupon Code $100 Off For New Users In 2025 If you're signing up for the first time, you're in for the best deal Temu has to offer. New users can enjoy huge discounts simply by using our verified coupon. With the Temu coupon $100 off and Temu coupon code $100 off, your first-time shopping experience is guaranteed to be budget-friendly. acs670886 – Unlock a flat $100 discount for new users.   acs670886 – Get a $100 coupon bundle on your first order.   acs670886 – Use up to $100 in coupon benefits across multiple purchases.   acs670886 – Get free shipping to 68 countries including the USA and Canada.   acs670886 – First-time users also get an extra 30% off on any purchase.   How To Redeem The Temu Coupon $100 Off For New Customers? To redeem the Temu $100 coupon or the Temu $100 off coupon code for new users, simply follow these steps: Download the Temu app or visit the official website.   Sign up with a valid email address.   Add your favorite products to the cart.   Go to checkout and apply the coupon code acs670886.   See your total drop instantly as the coupon is applied.   Temu Coupon $100 Off For Existing Customers Already a Temu shopper? Don't worry – there’s still something special for you. By using our exclusive code, loyal users also get access to massive savings. With Temu $100 coupon codes for existing users and Temu coupon $100 off for existing customers free shipping, everyone gets a reason to smile while shopping. acs670886 – Get a $100 extra discount for existing Temu users.   acs670886 – Receive a $100 coupon bundle to use across multiple purchases.   acs670886 – Enjoy a free gift with express shipping throughout the USA and Canada.   acs670886 – Add an extra 30% discount on top of your current promotions.   acs670886 – Free shipping available to 68 countries worldwide.   How To Use The Temu Coupon Code $100 Off For Existing Customers? To redeem the Temu coupon code $100 off or Temu coupon $100 off code as an existing user, follow these easy steps: Open your Temu app or go to the official site.   Log in using your existing account credentials.   Shop as usual and add items to your cart.   Proceed to checkout and input acs670886 in the promo code section.   Enjoy the instant discount and perks that come with it.   Latest Temu Coupon $100 Off First Order If you're planning to place your first order on Temu, you're in luck. Use our code and unlock the biggest deal on your first-time purchase. With Temu coupon code $100 off first order, Temu coupon code first order, and Temu coupon code $100 off first time user, you're starting your shopping journey the right way. acs670886 – Get a flat $100 discount on your first order.   acs670886 – Apply the $100 Temu coupon code at checkout for instant savings.   acs670886 – Receive up to $100 in coupons usable over multiple orders.   acs670886 – Benefit from free shipping to over 68 countries.   acs670886 – Score an extra 30% discount on your entire first order.   How To Find The Temu Coupon Code $100 Off? Wondering how to discover verified deals? It's easier than you think. To find the best and latest Temu coupon $100 off or Temu coupon $100 off Reddit shared deals, follow these tips: Sign up for the Temu newsletter and get access to exclusive promo codes.   Follow Temu on social media platforms like Facebook, Instagram, and Twitter for real-time coupon announcements.   Visit reputable coupon-sharing websites (like ours!) to access the most up-to-date and verified codes like acs670886.   Is Temu $100 Off Coupon Legit? Yes, it absolutely is! If you're wondering whether the Temu $100 Off Coupon Legit or Temu 100 off coupon legit, we're here to clear the air. Our verified code acs670886 has been tested and confirmed to work by thousands of happy shoppers across the USA, Canada, and Europe. So, when you use this code, you're not just saving money—you're also using a 100% legit and verified deal that’s designed to help you shop smarter. Happy shopping and big savings await when you use acs670886!  
    • I have already tried other versions of MCP, from 2841 to 2860.
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • The official documentation says next to nothing and I have had no success finding reference snippets (e.g. minimap mods and other stuff that involves directly drawing to the screen). Google searches and GPT outputs reference deprecated and/or removed content from older versions. Legends speak of a layered rendering system that also has next to no documentation. Any help is appreciated. Even drawing just a single pixel is enough.
    • Записывает в консоль INTELIJ IDEA Failed to resolve all files for the configuration. ':forgeGradleUserDevPackage'. > Failed to find forge.-userdev.jar (net.minecraftforge:forge:1.12.2-14.23.5.2860). The search was conducted in the following locations.: https://maven.minecraftforge.net/net/minecraftforge/forge/1.12.2-14.23.5.2860/forge-1.12.2-14.23.5.2860-userdev.jar Possible solution: - Declare the repository that provides the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html Can anyone send me forge-1.12.2-14.23.5.2860-userdev.jar? I have already tried other versions of MCP, from 2841 to 2860.
  • Topics

×
×
  • Create New...

Important Information

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