mod_Mobs
package net.minecraft.src;
import java.util.Map;
public class mod_Mobs extends BaseMod
{
@Override
public String getVersion() {
return "Test";
}
public void addRenderer(Map map)
{
map.put(EntiteBloodMonster.class, new RenderBloodMonster( new ModelBloodMonster(), 0.5f));
map.put(EntityHerobrine.class, new RenderHerobrine( new ModelHerobrine(), 0.5f));
}
@Override
public void load() {
ModLoader.registerEntityID(EntiteBloodMonster.class, "Blood Monster", ModLoader.getUniqueEntityId());
ModLoader.registerEntityID(EntityHerobrine.class, "Herobrine", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntiteBloodMonster.class, 12, 4, 4, EnumCreatureType.creature);
ModLoader.addSpawn(EntityHerobrine.class, 5, 1, 1, EnumCreatureType.creature, new BiomeGenBase[] {BiomeGenBase.hell, });
}
}
EntityHerobrine
----
package net.minecraft.src;
import java.util.Random;
public class EntityHerobrine extends EntityMob
{
public EntityHerobrine(World par1World)
{
super(par1World);
texture = "/mod/herobrine.png";
moveSpeed = 0.25F;
attackStrength = 15;
getNavigator().setBreakDoors(true);
}
public int getMaxHealth()
{
return 28;
}
/**
* Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue()
{
return 2;
}
/**
* Returns true if the newer Entity AI code should be run
*/
protected boolean isAIEnabled()
{
return true;
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
super.onLivingUpdate();
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.zombie";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.zombiehurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.zombiedeath";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected void dropFewItems(boolean flag, int i)
{
int num =rand.nextInt(10);
if (num>=3){
dropItem(Item.appleGold.shiftedIndex,1);
}
else if (num==2){
dropItem(10,1);
}
else{
dropItem(51,1);
}
dropItem(Item.diamond.shiftedIndex,1);
}
/**
* Get this Entity's EnumCreatureAttribute
*/
public ItemStack getHeldItem()
{return new ItemStack(Item.swordGold, 1);}
{
}
}
RENDERHEROBRINE
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class RenderHerobrine extends RenderLiving
{
protected ModelBiped modelBipedMain;
protected float field_40296_d;
public RenderHerobrine(ModelHerobrine modelHerobrine, float par2)
{
this(modelHerobrine, par2, 1.0F);
modelBipedMain = modelHerobrine;
}
public RenderHerobrine(ModelBiped par1ModelBiped, float par2, float par3)
{
super(par1ModelBiped, par2);
modelBipedMain = par1ModelBiped;
field_40296_d = par3;
}
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
{
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack itemstack = par1EntityLiving.getHeldItem();
if (itemstack != null)
{
GL11.glPushMatrix();
modelBipedMain.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
float f = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f *= 0.75F;
GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f, -f, f);
}
else if (itemstack.itemID == Item.bow.shiftedIndex)
{
float f1 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, f1);
GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
}
else if (Item.itemsList[itemstack.itemID].isFull3D())
{
float f2 = 0.625F;
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
}
else
{
float f3 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f3, f3, f3);
GL11.glRotatef(60F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F);
}
renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
if (itemstack.getItem().func_46058_c())
{
renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 1);
}
GL11.glPopMatrix();
}
}
}