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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm using Modrinth as a launcher for a forge modpack on 1.20.1, and can't diagnose the issue on the crash log myself. Have tried repairing the Minecraft instillation as well as removing a few mods that have been problematic for me in the past to no avail. Crash log is below, if any further information is necessary let me know. Thank you! https://paste.ee/p/k6xnS
    • Hey folks. I am working on a custom "Mecha" entity (extended from LivingEntity) that the player builds up from blocks that should get modular stats depending on the used blocks. e.g. depending on what will be used for the legs, the entity will have a different jump strength. However, something unexpected is happening when trying to override a few of LivingEntity's functions and using my new own "Mecha" specific fields: instead of their actual instance-specific value, the default value is used (0f for a float, null for an object...) This is especially strange as when executing with the same entity from a point in the code specific to the mecha entity, the correct value is used. Here are some code snippets to better illustrate what I mean: /* The main Mecha class, cut down for brevity */ public class Mecha extends LivingEntity { protected float jumpMultiplier; //somewhere later during the code when spawning the entity, jumpMultiplier is set to something like 1.5f //changing the access to public didn't help @Override //Overridden from LivingEntity, this function is only used in the jumpFromGround() function, used in the aiStep() function, used in the LivingEntity tick() function protected float getJumpPower() { //something is wrong with this function //for some reason I can't correctly access the fields and methods from the instanciated entity when I am in one of those overridden protected functions. this is very annoying LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 0f return this.jumpMultiplier * super.getJumpPower(); } //The code above does not operate properly. Written as is, the entity will not jump, and adding debug logs shows that when executing the code, the value of this.jumpMultiplier is 0f //in contrast, it will be the correct value when done here: @Override public void tick() { super.tick(); //inherited LivingEntity logic //Custom logic LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 1.5f } } My actual code is slightly different, as the jumpMuliplier is stored in another object (so I am calling "this.legModule.getJumpPower()" instead of the float), but even using a simple float exactly like in the code above didn't help. When running my usual code, the object I try to use is found to be null instead, leading to a crash from a nullPointerException. Here is the stacktrace of said crash: The full code can be viewed here. I have found a workaround in the case of jump strength, but have already found the same problem for another parameter I want to do, and I do not understand why the code is behaving as such, and I would very much like to be able to override those methods as intended - they seemed to work just fine like that for vanilla mobs... Any clues as to what may be happening here?
    • Please delete post. Had not noticed the newest edition for 1.20.6 which resolves the issue.
    • https://paste.ee/p/GTgAV Here's my debug log, I'm on 1.18.2 with forge 40.2.4 and I just want to get it to work!! I cant find any mod names in the error part and I would like some help from the pros!! I have 203 mods at the moment.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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