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

Hi,

 

I currently have a set of commands executed on server side. I made a GUI to allow users an easy access to the features and perform the same actions as commands but the problem is my Gui is on client. So I need a way to execute code on server side when an action is performed on the GUI and to be able to find the player who did it.

 

Is there a way to emulate the use of commands such that i can send these to the server when a player click on the buttons ?

 

I tried addChatMessage but this does not check if it's a command and simply display it in the chat.

I also found a way to send commands like if it was typed in the server terminal using MinecraftServer getters but i think it does not allow to recover which player issued the command.

 

Can somebody help ?

Thanks a lot.

 

You need to use packets. There are tutorials on how to utilize packets in Forge all over the internet.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

Ok, i suppose it's a better way to do it. But i could not find how to insert the player reference in the packets ...

 

As i had already commands allowing to do the action, i found a way to force a client to send a command. Here the code line if someone have the same problem :

 

((EntityClientPlayerMP) entityPlayer).sendChatMessage("/[command]");

 

Unfortunately it's not very OOP but it works.

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.