Jump to content

[1.6.2] Forge Item Model Help


Macapple

Recommended Posts

Hi everyone,i made a model for my item,and loaded it.

The problem is it shows INVISIBLE in game...so i think it renders it in a bad way.

 

If you need it, here's the renderer :

 

package DubGun;

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.client.renderer.texture.IconRegister;
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;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

public class ItemRendererWubGun implements IItemRenderer 
{

protected DubGunRender dubgunmodel;

public ItemRendererWubGun()
{
	dubgunmodel = new DubGunRender();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type)
	{
	case EQUIPPED: return true;
	default: return false;
	}
}


@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	// TODO Auto-generated method stub
	return false;
}




@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
	switch(type)
	{
	case EQUIPPED:
		{
			GL11.glPushMatrix();

			Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png"));
			float scale = 1.8F;

			GL11.glScalef(scale, scale, scale);

			GL11.glRotatef(10F, 0.8F, 0.0F, 0.0F); //x
			GL11.glRotatef(-175F, 30.0F, 8.5F, -1.2F);  //y
			GL11.glRotatef(0F, 0.0F, 0.0F, 1.0F);	//z

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

			GL11.glPopMatrix();
		}
		default:
			break;
	}

}

}

 

 

Here's the Item in Main Class

 

 dubGun = (new ItemWubGun(12905)).setUnlocalizedName("dubgun").setCreativeTab(DubTab).setFull3D();
    GameRegistry.addRecipe(new ItemStack(dubGun), new Object[]{"RRR", "RRR", "RRR", 'R', Block.blockDiamond}); //Temporary test Recipe//

	MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun());

 

 

Any help is appreciated :)

Link to comment
Share on other sites


			Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png"));

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

 

ok so first of all your registering your texture wrong it should this

 

Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun:textures/models/dg3d.png"));

 

or this

 

Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun"+ ":"+"textures/models/dg3d.png"));

 

and as for the render function try replacing data[1] with null and see if that works.

 

 

if (You.likescoding == false){
      You.goaway;
}

Link to comment
Share on other sites

you may also want to try having the resource location as a private static final method, then register it

 

like this

 

//this gets the textures
private static final ResourceLocation resourceloc = new (ResourceLocation"mac_dubstepgun", "textures/models/dg3d.png");

// this calls the texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(resourceloc);

 

what this means is that your texture path must look like this

 

"/assets/mac_dubstepgun/textures/models/dg3d.png"

if (You.likescoding == false){
      You.goaway;
}

Link to comment
Share on other sites

also try turning this

MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun());

into this because you dont need (IItemRenderer) it extends it therefore it doesn't need to be cast to it.

MinecraftForgeClient.registerItemRenderer(dubGun.itemID, new ItemRendererWubGun());

 

also try putting it in your clientproxy class

if (You.likescoding == false){
      You.goaway;
}

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.