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

For some reason it will not draw my GUI (GuiWarning) (200x100) in full it kind of just cuts off.

 

I did it the exact same way as the other GUI in my mod (GuiSkills).

 

The only difference is that it also draws two buttons.

 

If someone could help me that would be greatly appreciated.

 

Now for some reason my buttons I added to the buttonList in #initGui do not get drawn

 

Again the problem is in the GuiWarning class

 

Here is the source code: https://github.com/gapizzacalla/RPGSkills/blob/master/src/main/java/rpgs

http://www.minecraftforge.net/forum/index.php/topic,31297.0.html

 

Might be of help.

 

Also - you know you SHOULD not have stuff like "ContainerEmpty"? You use GuiContainer only if you have a Container for it. Having an "Empty" container means that you don't need it, therefore yo ushould use GuiScreen.

Only case I can think of where you might actually have such setup and say it's not stupid is when you want to open client gui from player.openGui on server. Other option - you can utilize canInteractWith, other than that - it's a bad coding (modding) practice.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

You have to set xSize and ySize to the size of your texture in the constructor.

 

Actually it did not work I pushed the latest changes to my GitHub

  • Author

http://www.minecraftforge.net/forum/index.php/topic,31297.0.html

 

Might be of help.

 

Also - you know you SHOULD not have stuff like "ContainerEmpty"? You use GuiContainer only if you have a Container for it. Having an "Empty" container means that you don't need it, therefore yo ushould use GuiScreen.

Only case I can think of where you might actually have such setup and say it's not stupid is when you want to open client gui's from player.openGui on server. Other option - you can utilize canInteractWith, other than that - it's a bad coding (modding) practice.

 

I realized this before hand but it did not draw the texture correctly at all. All I got was my text being rendered, the buttons but in the background was a bunch of weird symbols almost as if it was drawing the minecraft hieroglyphs

the background was a bunch of weird symbols almost as if it was drawing the minecraft hieroglyphs

 

After using fontRendererObj.drawString(...) you need to re-set texture to widgets (or icons, whatever their name) with mc.getTextureManager().bindTexture(...).

 

1.7.10 is no longer supported by forge, you are on your own.

  • Author

the background was a bunch of weird symbols almost as if it was drawing the minecraft hieroglyphs

 

After using fontRendererObj.drawString(...) you need to re-set texture to widgets (or icons, whatever their name) with mc.getTextureManager().bindTexture(...).

 

Oh thank you so much.

 

Also if you can answer one more question it would prove helpful.

 

So you said there is no need for GuiContainer, but what would you give the GuiHandler as a Server Element?

 

EDIT: I figured it out

One thing tho:

player.openGui, when called on: (logical side)

* Client = will ONLY call #getClientGuiElement

* Server = will call #getServerGuiElement and send packet to client that will call #getClientGuiElement, but ONLY if you return Container on server (not null).

Thus I stated:

Only case I can think of where you might actually have such setup and say it's not stupid is when you want to open client gui from player.openGui on server.

 

If you won't have Container on server, you can (should) send custom packet.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

One thing tho:

player.openGui, when called on: (logical side)

* Client = will ONLY call #getClientGuiElement

* Server = will call #getServerGuiElement and send packet to client that will call #getClientGuiElement, but ONLY if you return Container on server (not null).

Thus I stated:

Only case I can think of where you might actually have such setup and say it's not stupid is when you want to open client gui from player.openGui on server.

 

If you won't have Container on server, you can (should) send custom packet.

 

Thanks for all your help but I have one last problem.

 

for some reason my buttons won't get drawn anymore.

 

I updated the github (link in op) the class in question is (GuiWarning)

 

I add them to the button list in #initGui and the super of #drawScrenn is called but the button is still not drawn

 

If you have any insight that would be extremely helpful

this.buttonList.clear();

This is NOT needed inside initGui(), UNLESS you are calling initGui() on your own somewhere.

The only place initGui() is called is by vanilla, and vanilla clears buttons on its own.

 

As to problem:

this.mc.renderEngine.bindTexture(new ResourceLocation(RPGSkills.MOD_ID, "/textures/gui/container.png"));

 

Minecraft can only have one "currently" bound texture. In most cases it will be widgets or icons.

After changing it, you need to revert it back to original state.

* bindTexture which holds widgets (button icons).

1.7.10 is no longer supported by forge, you are on your own.

  • Author

this.buttonList.clear();

This is NOT needed inside initGui(), UNLESS you are calling initGui() on your own somewhere.

The only place initGui() is called is by vanilla, and vanilla clears buttons on its own.

 

As to problem:

this.mc.renderEngine.bindTexture(new ResourceLocation(RPGSkills.MOD_ID, "/textures/gui/container.png"));

 

Minecraft can only have one "currently" bound texture. In most cases it will be widgets or icons.

After changing it, you need to revert it back to original state.

* bindTexture which holds widgets (button icons).

 

Okay duly noted, but that was not the problem it turns out my calculation for guiLeft and guiTop did not give a nice number and son the buttons were being drawn off screen.

 

I do appreciate however your quick replies and wisdom

 

Thank you

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.