You are viewing our Forum Archives. To view or take place in current topics click here.
Need help making a npc +rep
Posted:

Need help making a npc +repPosted:

Gavin_Garner
  • TTG Senior
Status: Offline
Joined: Jun 10, 201013Year Member
Posts: 1,000
Reputation Power: 46
Status: Offline
Joined: Jun 10, 201013Year Member
Posts: 1,000
Reputation Power: 46
I dont know whats wrong but when ever i start the game the mob isnt there i dont get any errors though. If anyone van help ill +rep heres the code.

mod_Mob.java
package net.minecraft.src;
import java.util.Map;
import java.util.Random;

public class mod_Mob extends BaseMod
{

   public mod_Mob()
   {
      AddMobs();
   }
   
   public void AddMobs()
   {
      ModLoader.RegisterEntityID(EntityPedo.class, "Pedo Bear", ModLoader.getUniqueEntityId());
      
      ModLoader.AddSpawn("Pedo", 500, 10, 13, EnumCreatureType.creature);
   }
   
   public void addrenderer(Map map)
   {
      map.put(EntityPedo.class, new RenderPedo(new ModelPedo(), 0.5f));
   }

   public String Version()
   {
      return "3.14159265";
   }
}


EntityPedo.java
package net.minecraft.src;

public class EntityPedo extends EntityLiving
{

    public EntityPedo(World world)
    {
        super(world);

        //Set the texture
        texture = "/skin.png";

        //Set the size of the hitbox
        setSize(2F,2F);

        //Set the speed of the mob
        //NOTE: 0 = 0% speed, 1 = 100%, 0.75 = 75%
        moveSpeed = 20F;

        //Set how much health the mob has
       health = 10;

    }     

    public void writeEntityToNBT(NBTTagCompound nbttagcompound)
    {
        super.writeEntityToNBT(nbttagcompound);
    }

    public void readEntityFromNBT(NBTTagCompound nbttagcompound)
    {
        super.readEntityFromNBT(nbttagcompound);
    }

 //Need audiomod for the next 3. Remove them if you want a silent mob (except for the sound of foot steps)
 //You can also use sounds from default mobs by going into their respective entity files (like I did in the video)
    protected String getLivingSound()
    {
        //This is what sound the mob makes when it is alive and well
        return "mob.cow";
    }

    protected String getHurtSound()
    {
       //This is what sound the mob makes when it is getting hurt
        return "mob.cow";
    }

    protected String getDeathSound()
    {
       //This is what sound the mob makes when it is in the process of dying
        return "mob.cow";
    }

    //Here's where you change the volume of the mob's sounds
    protected float getSoundVolume()
    {
        return 0.4F;
    }

    //Here you define what items/blocks you want the mob to drop when killed
     protected void dropFewItems()
    {
      dropItem(Item.coal.shiftedIndex, 1);
      dropItem(Item.stick.shiftedIndex, 1);
      dropItem(Item.swordDiamond.shiftedIndex, 1);
    }
}


ModelPedo.java
package net.minecraft.src;

public class ModelPedo extends ModelBiped
{
    public ModelPedo()
    {
        super(1, 0.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);
    }

    public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
    {
        super.setRotationAngles(f, f1, f2, f3, f4, f5);
    }
}


RenderPedo.java
package net.minecraft.src;
import org.lwjgl.opengl.GL11;

public class RenderPedo extends RenderLiving

{

 //The three numbers below change the size of your model (you'll need to change the hitbox size too though)
    protected void preRenderScale(EntityPedo entity, float f)
    {
        GL11.glScalef(1.5F, 1.5F, 1.5F);
    }

    public RenderPedo(ModelPedo modelbase, float f)
    {
        super(modelbase, f);
    }

    public void func_177_a(EntityPedo entity, double d, double d1, double d2,
            float f, float f1)
    {
        super.doRenderLiving(entity, d, d1, d2, f, f1);
    }

    public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2,
            float f, float f1)
    {
        super.doRenderLiving((EntityPedo) entityliving, d, d1, d2, f, f1);
    }

    public void doRender(Entity entity, double d, double d1, double d2,
            float f, float f1)
    {
        doRenderLiving((EntityPedo)entity, d, d1, d2, f, f1);
    }

    protected void preRenderCallback(EntityLiving entityliving, float f)
    {
        preRenderScale((EntityPedo)entityliving, f);
    }
}
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.