Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[Modloader]How to make a minecraft mob![MC1.1.0]


  • Please log in to reply
54 replies to this topic

#1

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 16 December 2011 - 05:30 PM

First off, thank you Wouter10123 for teaching me how to make a mob, this tutorial is thanks to him!



Wouter's vid:


This will turn into a bunch of tutorials, on how to make blocks, ore, tools, and much more!



What you will need:
Minecraft
MCP 5.0
Modloader
Eclipse Classic


Note: you need MCP ready with Modloader to do this!

OK, first open up Eclipse and choose the "eclipse" folder inside your MPC folder for your workspace. Click the "+" nest to the "client" folder, then on "src", and on "net.minecraft.src". You will see most (if not all) of the classes in minecraft. Right-click on one and select "New > Class". Name it "EntitySteve" and type (or copy) this code into the workspace:
Spoiler:
You may want to change some things. You can rename any "EntitySteve" to what you want, like "EntityKatmoo" or "EntityNotch".

Don't want it to use the default Steve skin? Then make the skin you want and put it in a folder (made by YOU).
Example: I make a folder called "mymob" and in that I place the skin I want, like katmooskin.png, then I rename the part "texture = "/mob/char.png" with "texture = "/mymob/katmooskin.png".
Place that folder in your minecraft.jar (located in "jars > bin > minecraft.jar" in your MCP folder)

It will sound like the "harp" note (from the noteblock) when it "talks", the "snare" note when hit, and the "explosion" sound when it dies. To change that, go into your "Start" menu (The button at the bottom left of your screen" and click the "Run" button. Type %APPDATA% and locate your .minecraft folder. Click "resources" and then "newsound". It will have many sounds to choose from.
Example: I want it to sound like a wolf bark when it gets hit, so I click "mob > wolf" and then you will see "bark1, bark2, and bark3". find the part of the code that says

protected String getHurtSound(){
		return "note.snare";
	}

replace return "note.snare" with return "mob.wolf.bark" . Now it will sound like a barking wolf when it gets hit!

To change what it drops, find this in the code:

protected int getDropItemId(){
		return r.nextInt(2)==0?Item.pickaxeStone.shiftedIndex:Item.stick.shiftedIndex;
	}

To make it drop only one thing change, r.nextInt(2)==0 with, r.nextInt(1)==0

Example: I want it to drop a diamond pickaxe or a diamond block when it dies. I change:

protected int getDropItemId(){
		return r.nextInt(2)==0?Item.pickaxeStone.shiftedIndex:Item.stick.shiftedIndex;
	}

with...

protected int getDropItemId(){
		return r.nextInt(2)==0?Item.pickaxeDiamond.shiftedIndex:Block.blockDiamond.blockID;
	}

Now we want it to spawn. Make a new class and name it "mod_Steve" (or change Steve with what you want) then type (or copy) this code:
Spoiler:

The "100" in EntitySteve.class, 100, 1, 3, EnumCreatureType.creature is the weighted probability to spawn your mob rather than another one, and the 1, 3, is how much can be in a group (1 to 3). You may want it to be more rare, or more common.
Example: I want it to spawn my mob alot more than others, about 300, with groups of 12 to 20 in a group! So I change
EntitySteve.class, 100, 1, 3, EnumCreatureType.creature
with...
EntitySteve.class, 300, 12, 20, EnumCreatureType.creature

You may want it to spawn in a single Biome (like a snowy/wintery biome) so change
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature);


to

ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature,  new BiomeGenBase[]{
						BiomeGenBase.icePlains, BiomeGenBase.iceMountains});


This would only spawn it in icePlains and iceMountains.

Note: I MAY have left something out, if I did then I'm sorry, I will add/fix it When I get the chance.
Can someone direct me to the nearest Age?

Register or log in to remove.

#2

InTheLittleCrazie

Posted 16 December 2011 - 05:32 PM

Sounds great! Will try this later

#3

Vitalcannon32
  • Location: Behind you.

Posted 16 December 2011 - 05:33 PM

Good tutorial, Maybe do a youtube tutorial also. (just sayin')

Otherwise this is Great!
Did I help you in anyway? Help me by pressing the ( + ) At the bottom right corner of the post :D

#4

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 16 December 2011 - 06:18 PM

View PostVitalcannon32, on 16 December 2011 - 05:33 PM, said:

Good tutorial, Maybe do a youtube tutorial also. (just sayin')

Otherwise this is Great!
This mob tutorial is complete based on this vid by Wouter10123!
Can someone direct me to the nearest Age?

#5

viktorjanpaulis
  • Minecraft: viktorjanpaulis

Posted 16 December 2011 - 07:31 PM

how do i make the mobs spawn in different biomes?
Posted Image

#6

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 16 December 2011 - 07:53 PM

View Postviktorjanpaulis, on 16 December 2011 - 07:31 PM, said:

how do i make the mobs spawn in different biomes?
Good question, I have not figured that out my self... I have next to no java experience :\
Can someone direct me to the nearest Age?

#7

Wouter10123
  • Location: The Netherlands
  • Minecraft: Wouter10123

Posted 16 December 2011 - 08:29 PM

Nice post ;) I like how you're inspired by my tutorials ;)
I'd like to point out 1 little error, tough:
You said:

Quote

Now, it will spawn a ton, about 100 at a time, with groups of 1 to 3. You may want to to be more rare, or more common.
but the 100 isn't the amount it spawns at the time, but the weighted probability to spawn your mob rather than another one. In BiomeGenBase lines 86 to 96 you can see the values for other mobs (the first of the three integers). If yours is 100, and in there are 10 mobs with 10 (which isn't true, but just for easier calculation), that would mean whenever MC spawns a group of mobs, it'll take a random number from 0 to 100+10*10, and spawn the mob it's picked with that. That would mean the odds of spawning your mob are as large as spawning any of the original mobs (with my example values above). Get it?
And that is how you make it spawn in certain biomes :)
|
|
|
V

View Postviktorjanpaulis, on 16 December 2011 - 07:31 PM, said:

how do i make the mobs spawn in different biomes?
Just add a BiomeGenBase array to your AddSpawn method like so:
change
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature);
to
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature,  new BiomeGenBase[]{
			BiomeGenBase.icePlains, BiomeGenBase.iceMountains});
This would obviously only spawn them in icePlains and iceMountains ;)
Modding Tutorials: /topic/846178-minecraft-modding-tutorials/, SkyBlock Let's Play: /topic/785602-skyblock-survival-lets-play/  Redstone Tutorials: /topic/775054-redstone-tutorial/

#8

viktorjanpaulis
  • Minecraft: viktorjanpaulis

Posted 16 December 2011 - 09:15 PM

View PostWouter10123, on 16 December 2011 - 08:29 PM, said:

Nice post ;) I like how you're inspired by my tutorials ;)
I'd like to point out 1 little error, tough:
You said:
but the 100 isn't the amount it spawns at the time, but the weighted probability to spawn your mob rather than another one. In BiomeGenBase lines 86 to 96 you can see the values for other mobs (the first of the three integers). If yours is 100, and in there are 10 mobs with 10 (which isn't true, but just for easier calculation), that would mean whenever MC spawns a group of mobs, it'll take a random number from 0 to 100+10*10, and spawn the mob it's picked with that. That would mean the odds of spawning your mob are as large as spawning any of the original mobs (with my example values above). Get it?
And that is how you make it spawn in certain biomes :)
|
|
|
V


Just add a BiomeGenBase array to your AddSpawn method like so:
change
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature);
to
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature,  new BiomeGenBase[]{
			BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
This would obviously only spawn them in icePlains and iceMountains ;)

thnx
Posted Image

#9

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 16 December 2011 - 10:58 PM

View PostWouter10123, on 16 December 2011 - 08:29 PM, said:

-snip-
ah, ok thx, I'll edit the post and add that!
Can someone direct me to the nearest Age?

#10

Winnermarcelosc
  • Location: Deathland
  • Minecraft: winnermarcelosc

Posted 17 December 2011 - 01:36 AM

PREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEETTTTTTTTTTTTTTTTYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRD
:Zombie:  :unsure:  :SSSS:

#11

Verticity
    Verticity

    Lapis Lazuli Collector

  • Members
  • 1150 posts
  • Location: Texture Discussion
  • Minecraft: verticity

Posted 17 December 2011 - 01:47 AM

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: '}' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: ';' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

2 errors
==================

???!!!!!


#12

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 17 December 2011 - 01:22 PM

View PostWinnermarcelosc, on 17 December 2011 - 01:36 AM, said:

PREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEETTTTTTTTTTTTTTTTYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRD
:Zombie:  :unsure:  :SSSS:
could you tell me why? I want it to be easy for everyone.

View PostVerticity, on 17 December 2011 - 01:47 AM, said:

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: '}' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: ';' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

2 errors
==================
hmm... could I see your code? I may find something wrong...
Can someone direct me to the nearest Age?

#13

Wouter10123
  • Location: The Netherlands
  • Minecraft: Wouter10123

Posted 17 December 2011 - 01:37 PM

View PostVerticity, on 17 December 2011 - 01:47 AM, said:

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: '}' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

src\minecraft\net\minecraft\src\mod_Snowmen.java:11: ';' expected
BiomeGenBase.icePlains, BiomeGenBase.iceMountains]);
^

2 errors
==================

Oh derp, I made a mistake in my post :) it's supposed to be ..., BiomeGenBase.iceMountains}); It didn't throw an error for me in eclipse, so I must have made a mistake when copy+pasting ;) Thanks for the reminder xD

View Postkatmoo, on 17 December 2011 - 01:22 PM, said:

hmm... could I see your code? I may find something wrong...
no, I made a mistake ;) Sorry!
Modding Tutorials: /topic/846178-minecraft-modding-tutorials/, SkyBlock Let's Play: /topic/785602-skyblock-survival-lets-play/  Redstone Tutorials: /topic/775054-redstone-tutorial/

#14

jf46784
    jf46784

    Zombie Killer

  • Curse Premium
  • Curse Premium
  • 237 posts
  • Location: In ur cupboard, eatin ur cookies............
  • Minecraft: jf46784

Posted 18 December 2011 - 09:42 PM

Ive tried to add a nametag above thier heads. When i call renderLiving.renderLivingLabel(entityliving, "test", posX, posY - 1.5D, posZ, 64); it doesnt crash but the mobs don't render.

Any help?
I'm a modder! Need help with some code? Send me a PM!
If I helped you in any way, then help me by pressing the green +.

#15

Polie
    Polie

    Glowstone Miner

  • Members
  • 3634 posts
  • Minecraft: Poli_

Posted 26 December 2011 - 09:31 AM

If I changes The ModelZombie to ModelWolf will it be in wolf size then?

If so; SteveDog!
Hmm... I need to change RenderBiped also... but to what?

#16

Wouter10123
  • Location: The Netherlands
  • Minecraft: Wouter10123

Posted 26 December 2011 - 12:01 PM

View PostPoli58548, on 26 December 2011 - 09:31 AM, said:

If I changes The ModelZombie to ModelWolf will it be in wolf size then?

If so; SteveDog!
Hmm... I need to change RenderBiped also... but to what?
I think so, and... how about RenderWolf?

View Postjf46784, on 18 December 2011 - 09:42 PM, said:

Ive tried to add a nametag above thier heads. When i call renderLiving.renderLivingLabel(entityliving, "test", posX, posY - 1.5D, posZ, 64); it doesnt crash but the mobs don't render.

Any help?

To be honest: I have no Idea :( Haven't tried this myself yet ;( I'll let you know if I figure it out ;)
Modding Tutorials: /topic/846178-minecraft-modding-tutorials/, SkyBlock Let's Play: /topic/785602-skyblock-survival-lets-play/  Redstone Tutorials: /topic/775054-redstone-tutorial/

#17

katmoo
    katmoo

    Zombie Killer

  • Members
  • 183 posts
  • Location: MYST Island
  • Minecraft: katmoo

Posted 28 December 2011 - 09:46 PM

I'm trying to update the main post to have many tutorials, but it won't load, so hang in there!
Can someone direct me to the nearest Age?

#18

blockout22
  • Minecraft: blockout22

Posted 28 December 2011 - 10:08 PM

thanks :) other mob tut's never tell u how to control the spawning
ModLoader.AddSpawn(EntitySteve.class, 100, 1, 3, EnumCreatureType.creature,  new BiomeGenBase[]{
						BiomeGenBase.icePlains, BiomeGenBase.iceMountains]); 
this^
Posted Image

#19

AndNowIKnow
  • Location: Land of Fuzz and Kittens
  • Minecraft: AndNowIKnow

Posted 29 December 2011 - 05:07 AM

I got 25 errors 0.0 im pretty sure thats because i tried using EditRocket instead of Eclipse, but thats because when using eclipse it couldn't find and other file past src file in the client folder.

any tips on how to get eclipse to work?
-AndNowYouKnow

#20

AndNowIKnow
  • Location: Land of Fuzz and Kittens
  • Minecraft: AndNowIKnow

Posted 29 December 2011 - 05:16 AM

View PostAndNowIKnow, on 29 December 2011 - 05:07 AM, said:

I got 25 errors 0.0 im pretty sure thats because i tried using EditRocket instead of Eclipse, but thats because when using eclipse it couldn't find and other file past src file in the client folder.

any tips on how to get eclipse to work?

Never mind it turns out i just had some other weird file at my other attempt at a mod, now i have only 1 error:

src\minecraft\net\minecraft\src\EntitySteve.java:5: net.minecraft.src.EntityStev
e is not abstract and does not override abstract method func_40145_a(net.minecra
ft.src.EntityAnimal) in net.minecraft.src.EntityAnimal
public class EntitySteve extends EntityAnimal{
^
-AndNowYouKnow