Jump to content

Recommended Posts

Posted

You need to make a model and render it..

 

Some examples:

 

Put this method

    @SideOnly(Side.CLIENT)
    public boolean isFull3D() {
    	return true;
    }

to your Item class.

public class RenderEvilStaff implements IItemRenderer {

public static ResourceLocation tex = new ResourceLocation(Main.MODID, "textures/models/evilstafftexture.png");

private ModelEvilStaff staff;

public RenderEvilStaff() {
	staff = new ModelEvilStaff();
}

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

	case EQUIPPED: return true;
	case EQUIPPED_FIRST_PERSON: return true;
	default: return false;

	}
}

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

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



	case EQUIPPED: {
		GL11.glPushMatrix();

		Minecraft.getMinecraft().renderEngine.bindTexture(tex);

		GL11.glScalef(1.4F, 1.0F, 1.4F);

		GL11.glRotatef(90, 0F, 1F, 0F);
		GL11.glRotatef(100, 1F, 0F, 0F);
		GL11.glRotatef(10, 1F, 0F, 1F);

		GL11.glTranslatef(0.06F, -1.1F, -0.45F);

		this.staff.renderModel(0.0625F);	
		GL11.glPopMatrix();
	}
	case EQUIPPED_FIRST_PERSON: {

		GL11.glPushMatrix();

		Minecraft.getMinecraft().renderEngine.bindTexture(tex);

		GL11.glScalef(1.4F, 1.0F, 1.4F);

		GL11.glRotatef(90, 0F, 1F, 0F);
		GL11.glRotatef(100, 1F, 0F, 0F);
		GL11.glRotatef(10, 1F, 0F, 1F);

		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.06F, -1.1F, -0.45F);
            		}else{
            			isFirstPerson = true;
            			
            		}
            	}else{
            		GL11.glTranslatef(0.06F, -1.1F, -0.45F);
            		
            	}
            
            this.staff.renderModel(0.0625F);	
		GL11.glPopMatrix();

	} 		default: 
		break;	}}

 

Then render your model. (You can adjust the size and rotation and stuff with the GL11 methods.)

Posted

Well, just put this to your main class. It will run the renderer and will

render the item.

 

If you don't understand Java, please learn before copy-pasting.

And after you know the basics, try to understand the example

code I send you. It's the best way to learn how to mod/code and

customize your mod however you want.

 

	  MinecraftForgeClient.registerItemRenderer(Main.evilStaff, (IItemRenderer)new RenderEvilStaff());

 

Make sure you put this code in the init section.

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.