[1.8.1] Human NPC
+2
MrCreeper07
Strengthowns
6 posters
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
[1.8.1] Human NPC
Human NPC
- Spoiler:
- EntityNamehere
- Code:
package net.minecraft.src;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/Namehere.png";
moveSpeed = 0.5F;
attackStrength = 2;
isImmuneToFire = false;
}
protected int getDropItemId()
{
return Item.swordStone.shiftedIndex;
}
public boolean canBreatheUnderwater()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
public void onEntityDeath()
{
//If you know what you're doing, you can make it
//do cool things. e.g. explode like creeper.
}
}
mod_Namehere- Code:
package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
ModLoader.RegisterEntityID(EntityNamehere.class, "Namehere", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityNamehere.class, 8, 4, 10, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(EntityNamehere.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String Version()
{
return "1.7.3";
}
}
Help: EntityNamehere
1. At the top, you can make it extend any of these: EntityCreature, EntityMob, EntityWaterMob. This changes the way it moves and it's behaviour.
2. Change whatever you want at the top like movespeed etc. The attack strength is how many half hearts of damage it does. If you want it immune to fire then make it "true".
3. The rest is self explaining. The texture is the exact same as what you'd use as your own skin.
4. Make the canBreatheUnderwater "true" if you want it to well...breathe underwater.
5. If you never want it to despawn other than by being killed, set the canDespawn to "true".
6. Take out the attackStrength if it isn't a hostile mob.Help: mod_Namehere
1. At this part, change the Namehere between these " symbols to what you want it to be called in-game.- Code:
ModLoader.RegisterEntityID(EntityNamehere.class, "Namehere"
2. The 8 on the next line is the probability of the amount being spawned. If you have other NPC's in the same mod_Namehere file, think of it as a pie chart. Say one has 4 and one has 7, it will divide the total (11) between them. So the one with 4 has a probability of 4/11 chance of spawning.
2.1. The 4 is the minimum spawned per chunk.
2.2. The 10 is the max spawned per chunk.
3. For the enumcreatureblabla, you can make it one of these: monster, creature, waterCreature. This is how/where it spawns.
Extra:
- Spoiler:
- Making it Hold Something1. If you want it to hold something, then make your EntityNamehere like this:
- Code:
package net.minecraft.src;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/Namehere.png";
}
protected int getDropItemId()
{
return Item.swordStone.shiftedIndex;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
private static final ItemStack defaultHeldItem;
static
{
defaultHeldItem = new ItemStack(Item.swordStone, 1);
}
}
2. Just change the Item.swordStone to whatever you want.
Re: [1.8.1] Human NPC
do you know how to combine different codes to do something? I wanted my Ben npc to hold a diamond sword and have "Ben" on the top of his head but i can't figure it out. i tried just combining it and it had errors. i could only get it to say "Ben" one time and not say that and have a diamond sword.
love your tutorials just registered! im a beginerer modder.
Thanks
-Ben
love your tutorials just registered! im a beginerer modder.
Thanks
-Ben
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1] Human NPC
I get an error at:
- Code:
attackStrength = 2;
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [1.8.1] Human NPC
Get rid of that line, as it's not needed if your mob is peaceful. Also, please post in the help section for help.
Re: [1.8.1] Human NPC
Do you know a way were you can like make it so you can pay them like gold or somthing , then they follow you and they kill dangerous mobs
Also it would be cool if you can give them like a specific things
Like u give them a sertain sword, armor, ect..
Also it would be cool if you can give them like a specific things
Like u give them a sertain sword, armor, ect..
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Human NPC
Have a look in the wolf code, it should have everything you need. I'm not tooo sure about the giving them specific things..
Re: [1.8.1] Human NPC
Ooo! Good idea!
Then I'll look and pig zombie for the weapon!
Then I'll look and pig zombie for the weapon!
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Human NPC
o i was on iphone and it didnt show
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Human NPC
hey do you know how to add custom sounds with audio mod
bottz2- Member
- Posts : 14
Join date : 2011-10-24
Re: [1.8.1] Human NPC
i dont but ill find a tut
it didnt let me post a link so i copied/pasted it
How to add Music or Sound Effect to Minecraft with AudioMod
Custom Music
Simply place you music files into folder mod/sound in Minecraft’s folder.
Custom Sound Effects
Copy and Paste your sound effects into mod/sound.
Example, if you want to add new footstep sound effect to stone just add new stone1.ogg in mod/sound/step folder, and that’s all you need to do.
it didnt let me post a link so i copied/pasted it
How to add Music or Sound Effect to Minecraft with AudioMod
Custom Music
Simply place you music files into folder mod/sound in Minecraft’s folder.
Custom Sound Effects
Copy and Paste your sound effects into mod/sound.
Example, if you want to add new footstep sound effect to stone just add new stone1.ogg in mod/sound/step folder, and that’s all you need to do.
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1] Human NPC
how do i make i sensor with audio mod and how do i make .ogg files
bottz2- Member
- Posts : 14
Join date : 2011-10-24
Re: [1.8.1] Human NPC
how would i get it to replace blocks instead of delete them.
etc. replace sand with gravel, dirt with stone
etc. replace sand with gravel, dirt with stone
jaojake1804- Member
- Posts : 10
Join date : 2011-10-26
Re: [1.8.1] Human NPC
when exploding i mean, mine explodes and i want it to replace blocks, instead of delete them
jaojake1804- Member
- Posts : 10
Join date : 2011-10-26
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum