Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have been spending a good portion and still am of my mc development hobby developing server plugins. However, I thought I'd pursue another new and interesting project to start understanding how to take my experience and begin working on modifying the client itself. However, I want this mod to strictly work as a utility, therefore I would like it to work on public dedi servers and not just singleplayer. Since I am very new to the forge API, I thought I would start off reasonably basic. I want to see how I can mimic a few functions of key presses that occur automatically when a player joins a server. For example, I have been trying to get the client to automatically move the item stack in the 1st slot into the 2nd slot automatically when the 1st slot is highlighted/selected in the hotbar (via scroll). Unfortunately, I can not tell if when I do have the item moved to the second slot by first copying it to the second slot and then removing the original contents in the 1st slot, that the server is either out of sync, or if it is aware of this change but doesn't see it as a valid action and therefore cancels it. I am 90% sure I am missing a packet here, but due to my limited experience with client modifications, I am not sure what packets I am looking for. So far I have simply tried forcing a synchronization of my inventory contents with the server after I have done the action with the player.inventoryContainer#detectAndSendChanges(), but the server still appears to cancel the activity. So either I am doing it wrong, or the server is cancelling the activity since I am doing the action of moving the item to the other slot very differently then what is expected. I would like to actually analyze the classes that handle these sorts of activities in the inventory, such as in my case, mimicking the pressing of the number 2 on the keyboard to move the item in the slot selected into the second slot, but I haven't had any luck finding any such class since I do not know where to look.

Any help here would be most appreciated.

Edited by geekles
A title with more useful information

  • Author
15 hours ago, diesieben07 said:

detectAndSendChanges is used by the server to detect changes in the inventory and send them to the client.

Most of the slot interaction happens through GuiContainer#handleMouseClick, which calls PlayerControllerMP#windowClick.

I looked into the PlayerControllerMP class and tried out the method you mentioned (#windowClick). Although took me quite a bit of testing to get it to work and understand what was happening, I finally have it so that I can move any item in my inventory to a particular slot without the server falling out of sync of such movements. 

 

Edited by geekles

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.