I had made a hedgehog mod for 1.4.5 and it worked fine. When I updated to 1.4.6, it stopped spawning and the spawn egg does nothing. Here's my code:
mod_Hedgehog
package net.minecraft.src;
import java.util.Map;
import java.awt.Color;
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",-58, 0xA68064, 0x545454);
ModLoader.addSpawn(EntityHedgehog.class, 50, 12, 15, EnumCreatureType.creature);
ModLoader.addLocalization("entity.Hedgehog.name", "Hedgehog");//adds Mob name on the spawn egg
}
}
EntityHedgehog
package net.minecraft.src;
public class EntityHedgehog extends EntityMob
{
public EntityHedgehog(World par1World)
{
super(par1World);
this.texture = "/hedgehog/Hedgehog.png";
this.setSize(0.2F, 0.5F);
this.moveSpeed = 0.25F;
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, new Byte((byte)0));
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
if (!this.worldObj.isRemote)
{
this.setBesideClimbableBlock(this.isCollidedHorizontally);
}
}
public int getMaxHealth()
{
return 999999;
}
/**
* Returns the Y offset from the entity's position for any entity riding this one.
*/
public double getMountedYOffset()
{
return (double)this.height * 0.75D - 0.5D;
}
/**
* Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
* (Animals, Spiders at day, peaceful PigZombies).
*/
protected Entity findPlayerToAttack()
{
double var2 = 0.5D;
return this.worldObj.getClosestVulnerablePlayerToEntity(this, var2);
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return null;
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return null;
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return null;
}
/**
* Plays step sound at given x, y, z for the entity
*/
protected void playStepSound(int par1, int par2, int par3, int par4)
{
}
/**
* Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
*/
protected void attackEntity(Entity par1Entity, float par2)
{
EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 1.0D);
if (var1==null)
{
this.entityToAttack = null;
}
else
{
super.attackEntity(par1Entity, par2);
}
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return -1;
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
super.dropFewItems(par1, par2);
}
/**
* returns true if this entity is by a ladder, false otherwise
*/
public boolean isOnLadder()
{
return this.isBesideClimbableBlock();
}
/**
* Sets the Entity inside a web block.
*/
public void setInWeb() {}
/**
* How large the spider should be scaled.
*/
public float spiderScaleAmount()
{
return 1.0F;
}
/**
* Get this Entity's EnumCreatureAttribute
*/
/**
* Returns true if the WatchableObject (Byte) is 0x01 otherwise returns false. The WatchableObject is updated using
* setBesideClimableBlock.
*/
public boolean isBesideClimbableBlock()
{
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
/**
* Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is
* false.
*/
public void setBesideClimbableBlock(boolean par1)
{
byte var2 = this.dataWatcher.getWatchableObjectByte(16);
if (par1)
{
var2 = (byte)(var2 | 1);
}
else
{
var2 &= -2;
}
this.dataWatcher.updateObject(16, Byte.valueOf(var2));
}
/**
* Initialize this creature.
*/
public void initCreature()
{
}
}
RenderHedgehog
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);
}
}
This sounds weird, but make a hole, try to spawn your creature, and shoot at it with a bow. If it drops, I had the same error with Forge earlier, and if not, sorry, I have no idea.
This sounds weird, but make a hole, try to spawn your creature, and shoot at it with a bow. If it drops, I had the same error with Forge earlier, and if not, sorry, I have no idea.
No luck
Rollback Post to RevisionRollBack
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
mod_Hedgehog
EntityHedgehog
RenderHedgehog
ModelHedgehog
Thanks in advance!
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
I did see this in the code:
No idea as to what that does, but it could cause it to get two render sizes and make it not work.
no errors, worked fine in 1.4.5, I didn'tt change a thing.
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank
I mod things. Check me out on twitter or on Espernet IRC at #TheSteamTank