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

Hey,

I want to create a custom GUI for a Block.

 

If I Click the Block it's shows a "Interface" but with Purple and Black Points (like: NoTextureFound)

 

My GUIClass:

public class GUIBasic extends GuiScreen {
public GUIBasic() {

}

@Override
public void drawScreen(int par1, int par2, float par3) {
	this.drawDefaultBackground();

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

	ResourceLocation res = new ResourceLocation(ModMain.MODID + ":" + "assets/textures/gui/GUI_Smasher.png");
	this.mc.getTextureManager().bindTexture(res);

	int xSize = 176;
	int ySize = 214;
	int w = this.width;
	int h = this.height;
	int x = ((w - xSize)  / 2);
	int y = ((h - ySize) / 2);

	drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
}
}

 

The GUI_Smasher.png file exist and can be found under:

resources/assets.usefull_extensions.textures.gui.GUI_Smasher.png

 

xSize and ySize describe the Scale of the Picture...

The Original Picture is scaled by 255 x 255.

 

The Exeption:

java.io.FileNotFoundException: usefull_extensions:assets/userfull_extensions/textures/gui/GUI_Smasher.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:35) ~[simpleTexture.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:45) [TextureManager.class:?]
at de.sakul6499.gui.GUIBasic.drawScreen(GUIBasic.java:25) [GUIBasic.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137) [EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]

 

I think it must be something with the path... but i try'ed something but nothing works :/

First, remove the "assets/" piece from your resource location.

Second, you want to use the ResourceLocation contructor that requires 2 Strings, the modid and the pth, like so:

new ResourceLocation(ModMain.MODID, "textures/gui/GUI_Smasher.png");

.

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/

Second, you want to use the ResourceLocation contructor that requires 2 Strings, the modid and the pth, like so:

new ResourceLocation(ModMain.MODID, "textures/gui/GUI_Smasher.png");

.

 

Both work.

 

You Also dont need to create your resource location every render tick just store it in the class.

I am the author of Draconic Evolution

  • Author

Thanks too all!

 

It works!

 

my Class:

package de.sakul6499.GUI;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.inventory.GuiFurnace;
import net.minecraft.util.ResourceLocation;
import de.sakul6499.ExoTech;
import de.sakul6499.Blocks.Blocks;
import de.sakul6499.Blocks.TestBlockTileEntity;

public class BasicGui extends GuiScreen {

private static final ResourceLocation texture = new ResourceLocation(ExoTech.MODID + ":" + "textures/gui/guismasher.png");

int xSize = 176;
int ySize = 214;

@Override
public void drawScreen(int mouseX, int mouseY, float renderParticleTicks) {
	mc.getTextureManager().bindTexture(texture);

	int x = ((this.width - this.xSize) / 2);
	int y = ((this.height - this.ySize) / 2);

	this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}

@Override
public boolean doesGuiPauseGame() {
	return false;
}
}

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.