Blogs Tutorial

modding tutorial 5: mobs

  • 1,705 views • 2 today
  • 4
  • 2
  • 26
waterskier
Level 54 : Grandmaster Pony
158
Hey everyone I have another tutorial for you. In this one I will teach you how to make a new mob.

In this one we need 2 classes
mod_waterskier.class
waterskier.class
mod_waterskier
of course we need make it extend basemod
then like always we need load, and getversion
but in this one we need to add 2 lines in load

ModLoader.registerEntityID(waterskier.class, "waterskier", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(waterskier.class, 12, 14, 18, EnumCreatureType.creature);
what this is saying is that we are registering a new entity and its called waterskier.
and also it needs to get a new entity id so it doesn't take one that has already been used.
then it will add spawning for it 12,14,18 says how much it spawns you can play around with this but put them in increasing order for example this wouldn't work 3,2,1
the we are saying that it is non-hostile, if you want it hostile replace the creature with monster
IMPORTANT PLEASE READ
you NEED to put waterskier.class not just waterskier

after you finish that put
public void addRenderer(Map map)
{
map.put(waterskier.class, new RenderBiped(new ModelBiped(), 0.5F));
}
after this your mod_waterskier is done and should look like this
mod_waterskier finished

package net.minecraft.src;

import java.util.Map;

public class mod_waterskier extends BaseMod
{

public void load()
{
ModLoader.registerEntityID(waterskier.class, "waterskier", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(waterskier.class, 12, 14, 18, EnumCreatureType.monster);
}

public void addRenderer(Map map)
{
map.put(waterskier.class, new RenderBiped(new ModelBiped(), 0.5F));
}

public String getVersion()
{
return "1.2.5";
}

}

waterskier.class
in this class we need it to extend EntityMob to be hostile, and EntityCreature to be peacful
then we need this method and everything there is self explanitory exept attack strength.
Take attack strength out if you want a peacful mob

public waterskier(World world)
{
super(world);
texture = "/waterskier.png";
moveSpeed = 0.5F;
attackStrength = 4;
}
then we need all of these. Also self explanitory. If you don't understand any of it comment on witch one

public int getMaxHealth()
{
return 20;
}

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.pickaxeDiamond.shiftedIndex;
}

protected boolean canDespawn()
{
return false;
}

}
after that you are done with your waterskier.class, here is what it should look like
waterskier finished

package net.minecraft.src;

import java.util.Random;

public class waterskier extends EntityCreature
{
public waterskier(World world)
{
super(world);
texture = "/waterskier.png";
moveSpeed = 0.5F;
attackStrength = 4; //take this line out if this class doesn't extend EntityMob.
}

public int getMaxHealth()
{
return 20;
}

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.pickaxeDiamond.shiftedIndex;
}

protected boolean canDespawn()
{
return false;
}

}

thanks for reading! Leave any error code in the comments along with suggestions for future tutorials,and as always diamond and subscribe!
Tags

  Have something to say?

Sellotaper
09/26/2012 7:43 am
Level 49 : Master Musician
Help... It says: "Cannot find server 5mds !!"
when i do reobfuscate...

How do you do it i did all of the classes should i do anithing else befor reobfuscate? Please answer quick. Thanks, by the way epic tut. diamond for you.
1
mathmods
07/22/2012 12:21 pm
Level 5 : Apprentice System
i get errors when i maked this

public void addRenderer(Map map)

{

map.put(waterskier.class, new RenderBiped(new ModelBiped(), 0.5F));

}



can someone tell me it's it right????



this is the mod_ file
1
waterskier
07/23/2012 9:33 pm
Level 54 : Grandmaster Pony
what line? it may be that
1 you didn't change waterskier on that to your mobs name.
2 you havent made the other class for your mob yet (errors will be resolved when you make it.
3 possibly an error that I just didn't see, what line is the error on?
1
iCraftedYou
06/02/2012 5:49 am
Level 12 : Journeyman Bunny
where can I find the .class of a wolf, i can only find the .java but i don't know what to do with the .java
1
waterskier
06/02/2012 2:52 pm
Level 54 : Grandmaster Pony
it should be .java
1
iCraftedYou
06/02/2012 5:25 am
Level 12 : Journeyman Bunny
How do you make the texture of the mob?
1
waterskier
06/02/2012 5:34 am
Level 54 : Grandmaster Pony
download mcskin3d to edit skins. Then just use that skin for the texture; make sure the name is right!!!
1
iCraftedYou
06/02/2012 5:43 am
Level 12 : Journeyman Bunny
thanx :)
1
waterskier
06/02/2012 5:47 am
Level 54 : Grandmaster Pony
sure, these tutorials will continue on my youtube channel, so subscribe to it if you want to see more
http://www.youtube.com/user/waterskier420?feature=guide
1
felixmc
05/20/2012 1:07 am
Level 74 : Legendary Programmer
I was wondering how to make a mob use the pig model? I'm trying to make a new type of pig
1

Welcome