Jump to content

Head Mod


Palahace

Recommended Posts

I made a cow head and it came out like this:http://imgur.com/gvecMxz

 

So i put in the cow head model and it makes it invisible!

 

 

What did i do wrong??

 

ModelCowHead

// Date: 11/26/2014 6:45:28 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX






package com.sterango.MobHeads.models;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

@SideOnly(Side.CLIENT)
public class ModelCowHead extends ModelBase
{
    public ModelRenderer cowHead;

    public ModelCowHead()
    {
        this(0, 35, 64, 64);
    }

  //fields
    ModelRenderer head;
    ModelRenderer horn1;
    ModelRenderer horn2;
  
    public ModelCowHead(int par1, int par2, int par3, int par4)
    {
        this.textureWidth = par3;
        this.textureHeight = par4;
        this.cowHead = new ModelRenderer(this, par1, par2);
    
      head = new ModelRenderer(this, 0, 0);
      head.addBox(-4F, -4F, -6F, 8, 8, 6);
      head.setRotationPoint(0F, 20F, 3F);
      head.setTextureSize(64, 32);
      head.mirror = true;
      setRotation(head, 0F, 0F, 0F);
      horn1 = new ModelRenderer(this, 22, 0);
      horn1.addBox(-4F, -5F, -4F, 1, 3, 1);
      horn1.setRotationPoint(0F, 19F, 4F);
      horn1.setTextureSize(64, 32);
      horn1.mirror = true;
      setRotation(horn1, 0F, 0F, 0F);
      horn2 = new ModelRenderer(this, 22, 0);
      horn2.addBox(3F, -5F, -4F, 1, 3, 1);
      horn2.setRotationPoint(0F, 19F, 4F);
      horn2.setTextureSize(64, 32);
      horn2.mirror = true;
      setRotation(horn2, 0F, 0F, 0F);
  }
  

  
  public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
  {
      this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
      this.cowHead.render(par7);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
  {
      super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
      this.cowHead.rotateAngleY = par4 / (180F / (float)Math.PI);
      this.cowHead.rotateAngleX = par5 / (180F / (float)Math.PI);
  }

}

 

 

 

TitleEntityRenderer

package com.sterango.MobHeads;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelSkeletonHead;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.sterango.MobHeads.models.ModelCowHead;

@SideOnly(Side.CLIENT)
public class TileEntityHeadsRenderer extends TileEntitySpecialRenderer
{
    private static final ResourceLocation field_110642_c = new ResourceLocation("textures/entity/skeleton/skeleton.png");
    private static final ResourceLocation field_110640_d = new ResourceLocation("textures/entity/skeleton/wither_skeleton.png");
    private static final ResourceLocation field_110641_e = new ResourceLocation("textures/entity/zombie/zombie.png");
    private static final ResourceLocation field_110639_f = new ResourceLocation("textures/entity/creeper/creeper.png");
    public static TileEntityHeadsRenderer skullRenderer;
    private ModelCowHead field_82396_c = new ModelCowHead(0, 0, 64, 64);
    private ModelCowHead field_82395_d = new ModelCowHead(0, 0, 64, 64);

    /**
     * Render a skull tile entity.
     */
    public void renderTileEntityHeadsAt(TileEntityHeads par1TileEntityHeads, double par2, double par4, double par6, float par8)
    {
        this.func_82393_a((float)par2, (float)par4, (float)par6, par1TileEntityHeads.getBlockMetadata() & 7, (float)(par1TileEntityHeads.func_82119_b() * 360) / 16.0F, par1TileEntityHeads.getSkullType(), par1TileEntityHeads.getExtraType());
    }

    /**
     * Associate a TileEntityRenderer with this TileEntitySpecialRenderer
     */
    public void setTileEntityRenderer(TileEntityRenderer par1TileEntityRenderer)
    {
        super.setTileEntityRenderer(par1TileEntityRenderer);
        skullRenderer = this;
    }

    public void func_82393_a(float par1, float par2, float par3, int par4, float par5, int par6, String par7Str)
    {
        ModelCowHead modelskeletonhead = this.field_82396_c;

        switch (par6)
        {
            case 0:
            default:
                this.bindTexture(field_110642_c);
                break;
            case 1:
                this.bindTexture(field_110640_d);
                break;
            case 2:
                this.bindTexture(field_110641_e);
                modelskeletonhead = this.field_82395_d;
                break;
            case 3:
                ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng;

                if (par7Str != null && par7Str.length() > 0)
                {
                    resourcelocation = AbstractClientPlayer.getLocationSkull(par7Str);
                    AbstractClientPlayer.getDownloadImageSkin(resourcelocation, par7Str);
                }

                this.bindTexture(resourcelocation);
                break;
            case 4:
                this.bindTexture(field_110639_f);
        }

        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_CULL_FACE);

        if (par4 != 1)
        {
            switch (par4)
            {
                case 2:
                    GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.74F);
                    break;
                case 3:
                    GL11.glTranslatef(par1 + 0.5F, par2 + 0.25F, par3 + 0.26F);
                    par5 = 180.0F;
                    break;
                case 4:
                    GL11.glTranslatef(par1 + 0.74F, par2 + 0.25F, par3 + 0.5F);
                    par5 = 270.0F;
                    break;
                case 5:
                default:
                    GL11.glTranslatef(par1 + 0.26F, par2 + 0.25F, par3 + 0.5F);
                    par5 = 90.0F;
            }
        }
        else
        {
            GL11.glTranslatef(par1 + 0.5F, par2, par3 + 0.5F);
        }

        float f4 = 0.0625F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(-1.0F, -1.0F, 1.0F);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        modelskeletonhead.render((Entity)null, 0.0F, 0.0F, 0.0F, par5, 0.0F, f4);
        GL11.glPopMatrix();
    }

    public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    {
        this.renderTileEntityHeadsAt((TileEntityHeads)par1TileEntity, par2, par4, par6, par8);
    }
}

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.



×
×
  • Create New...

Important Information

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