Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] [1.11.2] Potion icon not rendering


PegBeard
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.