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

The code I have worked in 1.10.2, so I know everything is labelled properly and the texture is in the right place, but in 1.11.2 the potion icon in the player's inventory and on the HUD renders the missing texture.
I have looked for any changes, but everything I have found just confirms what I already have.

This is my current code (nothing flash, just what I got from a tutorial):
 

Spoiler

public class DTEffectGeneric extends Potion
{
	private final ResourceLocation iconTexture;
	
	public DTEffectGeneric(boolean isBadEffect, int liquidColor, String name)
	{
		super(isBadEffect, liquidColor);
		this.setPotionName(this, name);
		iconTexture = new ResourceLocation(Reference.MOD_ID, "/textures/misc/" + name + ".png");
	}

	public static void setPotionName(Potion potion, String potionName)
	{
		potion.setPotionName("effect." + Reference.MOD_ID + ":" + potionName);
	}

	@SideOnly(Side.CLIENT)
	@Override
	public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc)
	{
		if (mc.currentScreen != null)
		{
			mc.getTextureManager().bindTexture(iconTexture);
			Gui.drawModalRectWithCustomSizedTexture(x + 6, y + 7, 0, 0, 18, 18, 18, 18);
		}
	}

	@SideOnly(Side.CLIENT)
	@Override
	public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha)
	{
		mc.getTextureManager().bindTexture(iconTexture);
		Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 18, 18);
	}
}

 

My potion effects are being registered in the PreInit and the effects work properly, and the localised names are correct, so I assume there is something wrong with the resource path, but it worked as it is in 1.10 and I am not sure what changed.
Any help would be appreciated.

Edited by PegBeard
Issue solved

Are there errors in the console?

 

Do your potion names contain capital letters? In 1.11+, all resource paths have to be entirely lowercase.

  • Author

I am getting this in the console, on load:


 

Spoiler

[Client thread/WARN]: Failed to load texture: dungeontactics:/textures/misc/cryo_effect.png
java.io.FileNotFoundException: dungeontactics:/textures/misc/cryo_effect.png
    at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[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:67) [TextureManager.class:?]
    at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:42) [TextureManager.class:?]
    at PegBeard.DungeonTactics.Effects.DTCryoEffect.renderHUDEffect(DTCryoEffect.java:57) [DTCryoEffect.class:?]
    at net.minecraft.client.gui.GuiIngame.renderPotionEffects(GuiIngame.java:500) [GuiIngame.class:?]
    at net.minecraftforge.client.GuiIngameForge.renderPotionIcons(GuiIngameForge.java:225) [GuiIngameForge.class:?]
    at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:173) [GuiIngameForge.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1142) [EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
    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_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]


Everything is lowercase and the textures are in the specified location - as I mentioned, everything was working in 1.10, my code hasn't changed and the textures haven't been moved/renamed either

  • Author

Just fixed it - I had an extra '/' in the resource path.
Don't know how it got there, but it's weird that it worked in 1.10 but not 1.11

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.