ModLoader.registerEntityID(EntityNameHere.class, "NameHere", -128, 0xFFFFFF(White), 0x000000(Black));
ModLoader.addSpawn(EntityNameHere.class, SpawnRate, MinPerChunk, MaxPerChunk, EnumCreatureType.creature);
ModLoader.addEntityTracker(this, EntityNameHere.class, -128, 20, 5, true);}
public void generateSurface(World var1, Random var2, int var3, int var4) {}
public void generateNether(World var1, Random var2, int var3, int var4) {}
public void addRenderer(Map var1){
var1.put(EntityNameHere.class, new RenderLiving(new ModelNameHere(), 1.0F));}
public Entity spawnEntity(int var1, World var2, double var3, double var5, double var7){
switch (var1){
case -128:
return new EntityNameHere(var2);
default:
return null;}}
public Packet23VehicleSpawn getSpawnPacket(Entity var1, int var2){
return var1 instanceof EntityNameHere ? new Packet23VehicleSpawn(var1, var2) : null;}{
Post this code under your public void load and everything should work.
I wouldn't recommend using Entity Ids less than 0. Yes it works but it may cause problems in when reading and writing the packets. This explains it in more detail http://www.minecraft...0#entry17786787
Remember, you don't need Entity Tracking when working with NPC's.
Not a template but information on how to make one.
mod_MaleElephant
package net.minecraft.src;
import java.util.Map;
public class mod_MaleElephant extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityMaleElephant.class, "Male Elephant", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityMaleElephant.class, 15, 5, 7, EnumCreatureType.creature);
}
public void addRenderer(Map map)
{
map.put(EntityElephant.class, new RenderMaleElephant(new ModelMaleElephant(), 0.5F));
}
public String getVersion()
{
return "1.3.2";
}
}
EntityMaleElephant
package net.minecraft.src;
import java.util.Random;
public class EntityMaleElephant extends EntityMob
{
public EntityMaleElephant(World world)
{
super(world);
texture = "/Textures/MaleElephant.png";
moveSpeed = 0.5F;
isImmuneToFire = false;
attackStrength = 4;
}
public int getMaxHealth()
{
return 20;
}
//NEEDS CHANGING//
protected String getLivingSound()
{
return "mob.villager.default";
}
protected String getHurtSound()
{
return "mob.villager.defaulthurt";
}
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
protected int getDropItemId()
{
return Item.ingotIron.shiftedIndex;
}
//END EDITING//
protected boolean canDespawn()
{
return false;
}
}
ModelMaleElephant
package net.minecraft.src;
public class ModelMaleElephant extends ModelBase
{
ModelRenderer Shape1;
public ModelMaleElephant()
{
Shape1.equals("/Textures/MaleElephant.tcn");
}
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);
Shape1.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5);
}
}
RenderMaleElephant
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class RenderMaleElephant extends RenderLiving
{
protected ModelMaleElephant modelMaleElephantMain;
protected float field_40296_d;
public RenderMaleElephant(ModelMaleElephant par1ModelMaleElephant, float par2)
{
this(par1ModelMaleElephant, par2, 1.0F);
modelMaleElephantMain = par1ModelMaleElephant;
}
public RenderMaleElephant(ModelMaleElephant par1ModelMaleElephant, float par2, float par3)
{
super(par1ModelMaleElephant, par2);
modelMaleElephantMain = par1ModelMaleElephant;
field_40296_d = par3;
}
}
Don't use modloader's getUniqueEntityId().
http://www.minecraftforum.net/topic/1417041-mod-entity-problem/#entry17228805
http://www.minecraftforum.net/topic/1417041-mod-entity-problem/page__st__100#entry17788237
If you don't want to edit any base files atm just choice an id that isn't in use between 0-127.
ModLoader.registerEntityID(EntityNameHere.class, "NameHere", -128, 0xFFFFFF(White), 0x000000(Black));
ModLoader.addSpawn(EntityNameHere.class, SpawnRate, MinPerChunk, MaxPerChunk, EnumCreatureType.creature);
ModLoader.addEntityTracker(this, EntityNameHere.class, -128, 20, 5, true);}
public void generateSurface(World var1, Random var2, int var3, int var4) {}
public void generateNether(World var1, Random var2, int var3, int var4) {}
public void addRenderer(Map var1){
var1.put(EntityNameHere.class, new RenderLiving(new ModelNameHere(), 1.0F));}
public Entity spawnEntity(int var1, World var2, double var3, double var5, double var7){
switch (var1){
case -128:
return new EntityNameHere(var2);
default:
return null;}}
public Packet23VehicleSpawn getSpawnPacket(Entity var1, int var2){
return var1 instanceof EntityNameHere ? new Packet23VehicleSpawn(var1, var2) : null;}{
Post this code under your public void load and everything should work.
I wouldn't recommend using Entity Ids less than 0. Yes it works but it may cause problems in when reading and writing the packets. This explains it in more detail http://www.minecraft...0#entry17786787