Jump to content

Recommended Posts

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

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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

×   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



×
×
  • Create New...

Important Information

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