Jump to content

[1.7.2] Need help with multilayered texture for custom item model


sigurd4

Recommended Posts

im making an item that is supposed to have a two layered texture, where the second one is transparent and also glow in the dark (only if shouldGlow is true). i have managed to do this with an entity, but i cant figure out how to do it with an item model. please help! this is the renderer code:

public class RenderPlasmidHand implements IItemRenderer
{
private final ResourceLocation steveTextures = new ResourceLocation("textures/entity/steve.png");
private boolean hasEve;
private int cooldown;
private String plasmid;
private boolean hasPlasmid;
public boolean shouldGlow;
private String texture;
protected ModelPlasmidHand model;

public RenderPlasmidHand(boolean shouldGlow)
{
	this.model = new ModelPlasmidHand();
	this.shouldGlow = shouldGlow;
}

@Override
public boolean handleRenderType(ItemStack itemstack, ItemRenderType itemrendertype)
{
	if(itemrendertype == ItemRenderType.EQUIPPED_FIRST_PERSON)
	{
		return /*itemstack.stackTagCompound.getBoolean("PlayerHasPlasmid") || */true;
	}
	else
	{
		return false;
	}
}

@Override
public void renderItem(ItemRenderType itemrendertype, ItemStack itemstack, Object... data)
{
	this.cooldown = itemstack.stackTagCompound.getInteger("Cooldown");
	this.hasEve = itemstack.stackTagCompound.getInteger("PlayerEve") > 0;
	this.hasPlasmid = itemstack.stackTagCompound.getBoolean("PlayerHasPlasmid");
	this.texture = itemstack.stackTagCompound.getString("PlayerTextre");
	this.plasmid = itemstack.stackTagCompound.getString("Plasmid");

	if(/*this.hasPlasmid || */true)
	{

		GL11.glPushMatrix();

		Minecraft.getMinecraft().renderEngine.bindTexture(this.steveTextures);

		GL11.glTranslatef(0.3F, 0.2F, -1.7F);

		GL11.glRotatef(180F, 0F, 0F, 1F);
		GL11.glRotatef(-90F, 0F, 1F, 0F);
		GL11.glRotatef(0F, 1F, 0F, 0F);

		this.model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, hasEve && cooldown <= 0);

		GL11.glPopMatrix();

		GL11.glPushMatrix();

		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("bioshock:textures/entity/plasmids/plasmid_" + this.plasmid + ".png"));

		GL11.glEnable(GL11.GL_BLEND);
		if(this.shouldGlow)
		{
			GL11.glDisable(GL11.GL_LIGHTING);
		}

		//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)(61680 % 65536) / 1.0F, (float)(61680 / 65536) / 1.0F);

		this.model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, hasEve && cooldown <= 0);

		if(this.shouldGlow)
		{
			GL11.glEnable(GL11.GL_LIGHTING);
		}

		GL11.glPopMatrix();
	}
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType itemrendertype, ItemStack itemstack, ItemRendererHelper arg2)
{
	return false;
}
}

http://www.planetminecraft.com/member/sigurd4

I'm making the bioshock mod!

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.