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 a gui that needs to have an EntityPlayer and an ItemStack passed into its constructor to work properly. The problem is that I don't know how to do this in a GuiHandler. I'm having trouble describing it, but I cannot get this value from any of the parameters passed into getClientGuiElement. Feel free to ask for code, I just don't really know what to show you currently.

1 minute ago, That_Martin_Guy said:

I have a gui that needs to have an EntityPlayer and an ItemStack passed into its constructor to work properly. The problem is that I don't know how to do this in a GuiHandler. I'm having trouble describing it, but I cannot get this value from any of the parameters passed into getClientGuiElement. Feel free to ask for code, I just don't really know what to show you currently.

Where is the ItemStack stored?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
Just now, Animefan8888 said:

Where is the ItemStack stored?

In a list stored in a tile entity. The way I want to do this is to call the method getRandomCard, but if I called it every time I opened the gui it would get a different card. This is not what I want since I have a list of players that are supposed to get the same card, and if I got a random card every time I opened the gui they would get different ones.

Just now, That_Martin_Guy said:

In a list stored in a tile entity. The way I want to do this is to call the method getRandomCard, but if I called it every time I opened the gui it would get a different card. This is not what I want since I have a list of players that are supposed to get the same card, and if I got a random card every time I opened the gui they would get different ones.

You will need to use a Capabilty and attach it to the player to store the card they are supposed to get. And how is the player opening the gui, right clicking on a block? If so you can get the TileEntity from there and get the initial card.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
1 minute ago, Animefan8888 said:

You will need to use a Capabilty and attach it to the player to store the card they are supposed to get

Seems like the best solution. Really the last thing I would think of, but probably the best one for my situation. Thanks!

Just now, That_Martin_Guy said:

Seems like the best solution. Really the last thing I would think of, but probably the best one for my situation. Thanks!

This is also very vital.

2 minutes ago, diesieben07 said:

Use a custom packet to send the info to the client.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
4 minutes ago, diesieben07 said:

If you are using a custom packet already there is no point in using an IGuiHandler, just open the GUI directly from the packet. And then you can also just include the ItemStack directly with the packet.

Ah, thank you for the heads up! That's much simpler than setting up an entire capability system. Thanks!

  • Author
1 minute ago, diesieben07 said:

You will still need the capability to actually store the stack. I mean, it has to go somewhere, right?

Very true, didn't think about that. Thanks again!

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.