Jump to content

[1.7.10]Crashing when opening custom Container Gui


Recommended Posts

Posted

Hello everyone,

 

as the title says, I made a block that's a TileEntity and a Container that has a custom Gui. I crash the moment I open the Gui. If I don't add the slot to the container I won't crash and open it will the gui smoothly.

 

Here's the crash report: http://pastebin.com/cmPEpJYL

 

Here are the used classes:

 

Gui: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/client/gui/inventory/CoreGui.java

GuiHandler: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/handler/GuiHandler.java

Block: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/BaseCore.java

Container: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/container/CoreContainer.java

TileEntity: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/te/BaseCoreTE.java

 

I am pretty new to Containers and TileEntities so I might have made some stupid errors. In that case, please explain how I should do it.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted

1) That was a stupid mistake of mine

2) Because those are the only coords I have. I looked at Pahimar's example here ( https://github.com/gjkf/Equivalent-Exchange-3/blob/master/src/main/java/com/pahimar/ee3/handler/GuiHandler.java#L87-L88 ) and he uses the given coords too. If that's wrong, which coords should I use?

 

Thanks for the reply.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted

The x,y,z are the coordinates you need to pass:

player.openGui(Main.instance, References.GUI_CORE_ID, world, x,y,z);

They are the coordinates of block you are clicking.

Posted

Thank you so much. I have now another problem. I want to use a custom background image that covers all the screen. I made one that's 512x256. For some reason when I add it to the gui using this:

 

@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.getTextureManager().bindTexture(new ResourceLocation("forecraft", "/textures/gui/coreBackground.png"));
	this.drawTexturedModalRect(0, 0, 0, 0, width, height);
}

 

I see this background:

 

https://www.dropbox.com/s/i4o7zwgji8jew7u/Schermata%2010-2456950%20alle%2016.07.39.png?dl=0

 

This is the actual image and how I want it to look.

 

https://www.dropbox.com/s/f3tgjy8xh0rjew7/coreBackground.png?dl=0

 

I also would love some explanation about the drawTexturedModalRect method. How does it work? what are 'u' and 'v'?

 

Thanks a lot.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted
drawTexturedModalRect

only supports 256x256 images. You need to create your own method for other image sizes.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

So what if I want to use a texture that covers the whole screen? How can I do it? Why is it restricted to 256x256?

 

Thanks and sorry if I ask too many questions, I'm curious. :P

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted

It is limited to 256x256 because of this value:

0.00390625F

(found in the

drawTexturedModalRect

method). To make your own method, simply copy that method, rename the parameters to something meaninful, and change the

f

and

f1

to

1/yourImageSize

. Then call that method instead of the vanilla method.

 

Or use the method MultiMote linked if you intend to use that for multiple sizes.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Thanks to everybody for your explanation, I'll try both methods. Thanks again.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

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.