Jump to content

[1.6.4] Potion Effect Texture In Player's GUI


ItsTheRuski

Recommended Posts

I was able to get my custom potioneffect to render with my custom texture in the player's gui before I updated to the latest forge. Now there are methods like Minecraft.getMinecraft().renderEngine.bindTexture(par1ResourceLocation) and Minecraft.getMinecraft().renderEngine.getTexture(par1ResourceLocation) and Minecraft.getMinecraft().renderEngine.loadTexture(par1ResourceLocation, par2TextureObject).

 

Does anyone know how to use them?

Link to comment
Share on other sites

new ResourceLocation("modID:textures/gui/potion_icon.png")

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Here is my cutom potion file :

package eclipse.MoreApples.potion;


import java.util.Timer;
import java.util.TimerTask;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureObject;
import net.minecraft.client.resources.ReloadableResourceManager;
import net.minecraft.client.resources.Resource;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.src.ModLoader;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingFallEvent;

public class FlyingPotion extends Potion 
{


public FlyingPotion(int par1, boolean par2, int par3) 
	{
	super(par1, par2, par3);


	}


public Potion setIconIndex(int par1, int par2) 
	{

	//(3,2) is where I drew my texture in the "2D array" of textures in the inventory.png
	super.setIconIndex(3,2);
	return (Potion)this;
	}

@Override
public int getStatusIconIndex() 
	{
	ResourceLocation r = new ResourceLocation("More_Apples:textures/gui/inventory.png");

	TextureObject texture = Minecraft.getMinecraft().renderEngine.getTexture(r);
	Minecraft.getMinecraft().renderEngine.bindTexture(r);


	return super.getStatusIconIndex();

	}



}

 

And here is what's rendering:

 

 

 

 

I have also noticed something. If I give myself the potion effect, then quit the game before the potion effect runs out, it will render this:

 

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.