Posted October 18, 201411 yr 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
October 18, 201411 yr Author 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
October 18, 201411 yr 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.
October 19, 201411 yr Author 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
October 19, 201411 yr 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/
October 19, 201411 yr Author 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. "I an atom in the universe, a universe of atoms"-- Richard P. Feynman
October 19, 201411 yr http://www.minecraftforge.net/forum/index.php/topic,23715.msg120412.html#msg120412 http://www.minecraftforge.net/forum/index.php/topic,24056.msg122226.html#msg122226
October 19, 201411 yr 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/
October 19, 201411 yr Author 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
October 19, 201411 yr Author Thank you so much again, now it works perfectly!!! "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.