Jump to content

Forge doesn't find my texture???


Big_Bad_E

Recommended Posts

I have a TileEntity and a GUIContainer and a Container. WHen I right click on the Block, the GUI opens, and there is no background.

Code:

public class BWGui extends GuiContainer {

    private final int BUTTON_X = 20;
    private final int BUTTON_Y = 20;
    private static final ResourceLocation GUI_BACKGROUND = new ResourceLocation("enhancedbows", "textures/gui/workbench_gui.png");
    private static final ResourceLocation GUI_WIDGETS = new ResourceLocation("enhancedbows", "textures/gui/workbench_widgets.png");
    BWContainer container;

    public BWGui(Container inventorySlotsIn) {
        super(inventorySlotsIn);
        container = (BWContainer) inventorySlotsIn;
    }

    @Override
    public void initGui() {
        super.initGui();
        buttonList.clear();
        int id = 1;
        for(int i = 0; i > 1; i++) {
            buttonList.add(new GuiButtonImage(id, BUTTON_X*((id-1)/8), BUTTON_Y*((id-1)%8), 64, 64, 64*((id-1)/8), 64*((id-1)%8), 0, GUI_WIDGETS));
            id += 1;
        }
        container.updateType();
    }

    @Override
    protected void actionPerformed(GuiButton button) {
        BowTypes type = null;
        for(BowTypes type1 : BowTypes.values())
            if(type1.ordinal() == button.id)
                type = type1;
        container.type = type;
    }

    @Override
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
        drawDefaultBackground();
        Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_BACKGROUND);
        this.drawTexturedModalRect(Minecraft.getMinecraft().displayWidth-256, 0f,0, 0, 256, 256);
    }

    @Override
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

    }
}

The background is grayed out, the inventory works, but apparently it can't find my background texture.

Never mind, found my problem. Thanks for the help everyone. (It was the pack.mcmeta I think)

File layout:

src\main\resources\assets\enhancedbows\textures\gui\workbench_gui.png

Also the button (A GuiButtonImage) doesn't draw, I have no idea why.

Edited by Big_Bad_E
Link to comment
Share on other sites

16 minutes ago, Big_Bad_E said:

The background is grayed out, the inventory works, but apparently it can't find my background texture.

File layout:

Did it say anything in the console about a missing texture? Also are you sure that your draw method is being called?

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

8 minutes ago, Animefan8888 said:

Did it say anything in the console about a missing texture? Also are you sure that your draw method is being called?

Yes, I said it can't find the texture. The method is being called bc the drawDefaultBackground() method is being called

Spoiler

[09:54:24] [main/WARN] [net.minecraft.client.renderer.texture.TextureManager]: Failed to load texture: enhancedbows:textures\gui\workbench_gui.png
java.io.FileNotFoundException: enhancedbows:textures\gui\workbench_gui.png
    at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:34) ~[SimpleTexture.class:?]
    at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:69) [TextureManager.class:?]
    at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:44) [TextureManager.class:?]
    at bigbade.enhancedbows.guis.bowworkbench.BWGui.drawGuiContainerBackgroundLayer(BWGui.java:47) [BWGui.class:?]
    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93) [GuiContainer.class:?]
    at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:368) [ForgeHooksClient.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1177) [EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1207) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]

 

Link to comment
Share on other sites

7 minutes ago, Big_Bad_E said:

Yes, I said it can't find the texture.

Is that the whole error or is there a part that says caused by below that part.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

13 minutes ago, Big_Bad_E said:

What do you mean a caused by part? Its a FileNotFoundException, look in the spoiler.

Sometimes there is an extra "clause" that gives more information. I was mainly looking for the exact file path it was looking in. But my next logical check would be, did you refresh eclipses/ideas files.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, Animefan8888 said:

Sometimes there is an extra "clause" that gives more information. I was mainly looking for the exact file path it was looking in. But my next logical check would be, did you refresh eclipses/ideas files.

I forgot to refresh, but still didn't change anything.

Nothing else, but I think I know what the problem is. Thanks for the help.

Link to comment
Share on other sites

Ahem.

1 hour ago, Big_Bad_E said:

this.drawTexturedModalRect(0f, 0f,0, 0, 0, 0);

"Please bind my texture and then draw it at position [0,0] with a size of [0,0]"

I don't think that this is the behaviour you wanted.

 

Also you do not need to do this

1 hour ago, Big_Bad_E said:

for(GuiButton button : buttonList) { button.drawButton(Minecraft.getMinecraft(), mouseX, mouseY, partialTicks); }

The game already does that for you.

Link to comment
Share on other sites

4 minutes ago, V0idWa1k3r said:

Ahem.

"Please bind my texture and then draw it at position [0,0] with a size of [0,0]"

I don't think that this is the behaviour you wanted.

 

Also you do not need to do this

The game already does that for you.

I just had a placeholder for the draw to see if the gui actually opened, saw the error, and didn't fix the placeholder.

Thanks for telling me the buttons draw themself, didn't know.

Link to comment
Share on other sites

On 9/28/2018 at 10:00 AM, Big_Bad_E said:

Now the texture is still blank, but I don't get a file not found error.

Post your new logs please, are you sure your drawing your texture with the correct size at the correct coordinates?

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

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.