package net.minecraft.src;
import java.util.Map;
public class mod_Hedgehog extends BaseMod{
@Override
public String getVersion() {
return "1.4.5";
}
public void addRenderer(Map map)
{
map.put(EntityHedgehog.class, new RenderHedgehog(new ModelHedgehog(), 0.5F));
}
@Override
public void load() {
ModLoader.registerEntityID(EntityHedgehog.class, "Hedgehog",
ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHedgehog.class, 12, 4, 4, EnumCreatureType.creature);
}
}
EntityHedgehog:
package net.minecraft.src;
public class EntityHedgehog extends EntityAnimal
{
public EntityHedgehog(World par1World)
{
super(par1World);
this.texture = "/hedgehog/Hedgehog.png";
this.setSize(0.9F, 1.3F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
this.tasks.addTask(2, new EntityAIMate(this, 0.2F));
this.tasks.addTask(3, new EntityAITempt(this, 0.25F, Item.wheat.shiftedIndex, false));
this.tasks.addTask(4, new EntityAIFollowParent(this, 0.25F));
this.tasks.addTask(5, new EntityAIWander(this, 0.2F));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 10;
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.cow.say";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.cow.hurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.cow.hurt";
}
/**
* Plays step sound at given x, y, z for the entity
*/
protected void playStepSound(int par1, int par2, int par3, int par4)
{
this.func_85030_a("mob.cow.step", 0.15F, 1.0F);
}
/**
* Returns the volume for the sounds this mob makes.
*/
protected float getSoundVolume()
{
return 0.4F;
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.leather.shiftedIndex;
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);
int var4;
for (var4 = 0; var4 < var3; ++var4)
{
this.dropItem(Item.leather.shiftedIndex, 1);
}
var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);
for (var4 = 0; var4 < var3; ++var4)
{
if (this.isBurning())
{
this.dropItem(Item.beefCooked.shiftedIndex, 1);
}
else
{
this.dropItem(Item.beefRaw.shiftedIndex, 1);
}
}
}
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
if (var2 != null && var2.itemID == Item.bucketEmpty.shiftedIndex)
{
if (--var2.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bucketMilk));
}
else if (!par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bucketMilk)))
{
par1EntityPlayer.dropPlayerItem(new ItemStack(Item.bucketMilk.shiftedIndex, 1, 0));
}
return true;
}
else
{
return super.interact(par1EntityPlayer);
}
}
/**
* This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
*/
public EntityHedgehog spawnBabyAnimal(EntityAgeable par1EntityAgeable)
{
return new EntityHedgehog(this.worldObj);
}
public EntityAgeable func_90011_a(EntityAgeable par1EntityAgeable)
{
return this.spawnBabyAnimal(par1EntityAgeable);
}
}
package net.minecraft.src;
public class RenderHedgehog extends RenderLiving
{
public RenderHedgehog(ModelBase par1ModelBase, float par2)
{
super(par1ModelBase, par2);
}
public void renderHedgehog(EntityHedgehog par1EntityHedgehog, double par2, double par4, double par6, float par8, float par9)
{
super.doRenderLiving(par1EntityHedgehog, par2, par4, par6, par8, par9);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.renderHedgehog((EntityHedgehog)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderHedgehog((EntityHedgehog)par1Entity, par2, par4, par6, par8, par9);
}
}
Thanks in advance for the help!
Rollback Post to RevisionRollBack
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
Did you see the mob or was it just a random crash?
I'm pretty sure I saw it, because I made a new world and was flying around in creative when it crashed. When I load the world, after the midrange chunks are loaded it crashes.
Error:
mod_Hedgehog:
EntityHedgehog:
ModelHedgehog:
RenderHedgehog:
Thanks in advance for the help!
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
I'm pretty sure I saw it, because I made a new world and was flying around in creative when it crashed. When I load the world, after the midrange chunks are loaded it crashes.
I have that on the line after, but thanks. Any other ideas?
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
http://www.minecraftforum.net/topic/1417041-mod-entity-problem-updated-with-forge/#entry17228805
I would really consider using Forge.
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank