Jump to content

[1.7.2] Can't find item in creative tab


iLexiconn

Recommended Posts

I'm making an basic item with a 3d render, But I can't find my item in the creative tab and the texture doesn't work.

 

Here is the code:

Item-Define-Class

wolveMask = new ItemWolveMask().setUnlocalizedName("wolveMask").setCreativeTab(CreativeTabs.tabMisc).setTextureName(Reference.modid + ":wolveMask");
GameRegistry.registerItem(wolveMask, "wolveMask");

 

Item class:

public class ItemWolveMask extends Item
{
public ItemWolveMask()
{
	super();
}
}

 

Client proxy:

MinecraftForgeClient.registerItemRenderer(Items.wolveMask, (IItemRenderer)new RenderWolveMask());

 

Render class:

package ilexiconn.ownagenetwork.item.render;

import ilexiconn.ownagenetwork.item.model.ModelWolveMask;
import ilexiconn.ownagenetwork.reference.Reference;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;

public class RenderWolveMask implements IItemRenderer
{

protected ModelWolveMask wolveMask;
boolean isFirstPerson = false;

public RenderWolveMask()
{

	wolveMask = new ModelWolveMask();

}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{

	switch (type)
	{

		case EQUIPPED:
			return true;

		case EQUIPPED_FIRST_PERSON:
			return true;

		default:
			return false;
	}

}

public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
	return false;
}

public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{

	switch (type)
	{
		case EQUIPPED:
		{

			Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Reference.modid + ":WolveMask_1.png"));

			GL11.glPushMatrix();

			GL11.glRotatef(10, 1, 0, 0);
			GL11.glRotatef(180, 0, 1, 0);
			GL11.glRotatef(70, 0, 0, 1);

			boolean IsFirstPerson = false;

			if (data[1] != null && data[1] instanceof EntityPlayer)
			{
				if (!((EntityPlayer) data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 1 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F)))
				{
					GL11.glTranslatef(0.2F, 0.4F, 0.025F);
				}
				else
				{
					IsFirstPerson = true;

					GL11.glTranslatef(0.2F, 0.4F, 0.025F);
				}
			}
			else
			{
				GL11.glTranslatef(0F, 0F, 0F);
			}

			wolveMask.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

			GL11.glPopMatrix();

		}
			break;
		case EQUIPPED_FIRST_PERSON:
		{
			Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Reference.modid + ":WolveMask_1.png"));

			GL11.glPushMatrix();

			GL11.glRotatef(10, 1, 0, 0);
			GL11.glRotatef(180, 0, 1, 0);
			GL11.glRotatef(155, 0, 0, 1);

			boolean IsFirstPerson = false;

			if (data[1] != null && data[1] instanceof EntityPlayer)
			{
				if (!((EntityPlayer) data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F)))
				{
					GL11.glTranslatef(0.7F, 1F, 0F);
				}
				else
				{
					IsFirstPerson = true;

					GL11.glTranslatef(0.5F, 0.1F, 0.0F);
				}
			}
			else
			{
				GL11.glTranslatef(0F, 0.2F, 0F);
			}

			wolveMask.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

			GL11.glPopMatrix();

		}
			break;
		default:
			break;
	}

}

}

 

Model class:

package ilexiconn.ownagenetwork.item.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelWolveMask extends ModelBase
{
public ModelRenderer maskFront1;
public ModelRenderer maskFront2;
public ModelRenderer maskFront3;
public ModelRenderer maskFront4;
public ModelRenderer maskFront5;
public ModelRenderer maskEar1;
public ModelRenderer maskEar2;
public ModelRenderer rope1;
public ModelRenderer rope2;
public ModelRenderer rope3;

public ModelWolveMask() 
{
	textureWidth = 64;
	textureHeight = 32;

	maskFront1 = new ModelRenderer(this, 0, 0);
	maskFront1.addBox(-5F, -4F, -5F, 10, 4, 1);
	maskFront1.setRotationPoint(0F, 0F, 0F);
	maskFront1.setTextureSize(64, 32);
	maskFront1.mirror = true;
	setRotation(maskFront1, 0F, 0F, 0F);
	maskFront2 = new ModelRenderer(this, 22, 0);
	maskFront2.addBox(-5F, -5F, -5F, 2, 1, 1);
	maskFront2.setRotationPoint(0F, 0F, 0F);
	maskFront2.setTextureSize(64, 32);
	maskFront2.mirror = true;
	setRotation(maskFront2, 0F, 0F, 0F);
	maskFront3 = new ModelRenderer(this, 34, 0);
	maskFront3.addBox(3F, -5F, -5F, 2, 1, 1);
	maskFront3.setRotationPoint(0F, 0F, 0F);
	maskFront3.setTextureSize(64, 32);
	maskFront3.mirror = true;
	setRotation(maskFront3, 0F, 0F, 0F);
	maskFront4 = new ModelRenderer(this, 28, 0);
	maskFront4.addBox(-1F, -5F, -5F, 2, 1, 1);
	maskFront4.setRotationPoint(0F, 0F, 0F);
	maskFront4.setTextureSize(64, 32);
	maskFront4.mirror = true;
	setRotation(maskFront4, 0F, 0F, 0F);
	maskFront5 = new ModelRenderer(this, 40, 0);
	maskFront5.addBox(-5F, -6F, -5F, 10, 1, 1);
	maskFront5.setRotationPoint(0F, 0F, 0F);
	maskFront5.setTextureSize(64, 32);
	maskFront5.mirror = true;
	setRotation(maskFront5, 0F, 0F, 0F);
	maskEar1 = new ModelRenderer(this, 22, 2);
	maskEar1.addBox(-3F, -8F, -5F, 2, 2, 1);
	maskEar1.setRotationPoint(0F, 0F, 0F);
	maskEar1.setTextureSize(64, 32);
	maskEar1.mirror = true;
	setRotation(maskEar1, 0F, 0F, 0F);
	maskEar2 = new ModelRenderer(this, 28, 2);
	maskEar2.addBox(1F, -8F, -5F, 2, 2, 1);
	maskEar2.setRotationPoint(0F, 0F, 0F);
	maskEar2.setTextureSize(64, 32);
	maskEar2.mirror = true;
	setRotation(maskEar2, 0F, 0F, 0F);
	rope1 = new ModelRenderer(this, 0, 23);
	rope1.addBox(4F, -4F, -4F, 1, 1, ;
	rope1.setRotationPoint(0F, 0F, 0F);
	rope1.setTextureSize(64, 32);
	rope1.mirror = true;
	setRotation(rope1, 0F, 0F, 0F);
	rope2 = new ModelRenderer(this, 0, 23);
	rope2.addBox(-5F, -4F, -4F, 1, 1, ;
	rope2.setRotationPoint(0F, 0F, 0F);
	rope2.setTextureSize(64, 32);
	rope2.mirror = true;
	setRotation(rope2, 0F, 0F, 0F);
	rope3 = new ModelRenderer(this, 18, 30);
	rope3.addBox(-5F, 0F, 0F, 10, 1, 1);
	rope3.setRotationPoint(0F, -4F, 4F);
	rope3.setTextureSize(64, 32);
	rope3.mirror = true;
	setRotation(rope3, 0F, 0F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
	super.render(entity, f, f1, f2, f3, f4, f5);
	setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	maskFront1.render(f5);
    maskFront2.render(f5);
    maskFront3.render(f5);
    maskFront4.render(f5);
    maskFront5.render(f5);
    maskEar1.render(f5);
    maskEar2.render(f5);
    rope1.render(f5);
    rope2.render(f5);
    rope3.render(f5);
}

private void setRotation(ModelRenderer model, float x, float y, float z)
{
	model.rotateAngleX = x;
	model.rotateAngleY = y;
	model.rotateAngleZ = z;
}
}

 

:-\

Link to comment
Share on other sites

Try Removing the ".setCreativeTab()" from where you register your item and add this into your item class "this.setCreativeTab(CreativeTabs.tabMisc)

Not sure if it will make a difference but it might.

 

Also if you want a 2D texture - i like the method of using this in your item class:

 

public void registerIcons(IconRegister ir) {

itemIcon = ir.registerIcon([ModId Of YourMod] + ":" + this.getUnlocalizedName().substring(5));

}

 

So in your case this will look in the folder - assets/[YourModid]/textures/items/wolveMask.png

 

Hope This Helped :D

 

Also on a side note - you wouldn't know how to make a 3d item render face where the head faces?

Link to comment
Share on other sites

You should probably use a tab other than tabAllSearch, too.

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

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.