Jump to content

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

[Creating Mods] Simple person mob (MCP) [30/1/11]


  • Please log in to reply
246 replies to this topic

#1

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 10 December 2010 - 12:52 AM

Guide to make a simple mob (MCP)


Posted Image

PLEASE NOTICE: Wow, this simple tutorial has brought the whole Minecraft modding community to a new generation full of human mobs. Every time I look back at this, I see how much I have changed the community, and I feel very happy. This tutorial is very outdated, however. But now, look around, everyone knows how to create a human mob. Get help from one of today's modders on how to make a human mob. I have quit modding since, and I thank everybody for their support while I was a modder. I might never return to modding, but who knows? I probably will in 1.7! ~Club559 (June 21, 2011)

Before testing your results, download (required):
Risugami's ModLoader
303's SpawnList

Tutorial files (required)


In this tutorial I will teach you how to make a simple mob in the shape of a person. This tutorial will not include how to model, neither does it use a model.

First, download all of the listed above. Get out your tutorial folder and go to the sources. Copy all of the sources over to your MCP source folder (decompile unmodified minecraft.jar before doing this). The EntityList is just a fix for the private function MCP converts it to, so copy that to your sources too.

Open up EntityPigman.java.
package net.minecraft.src;

public class EntityPigman extends EntityCreature
{

	public EntityPigman(World world)
	{
		super(world);
		//This is the texture for your mob
		texture = "/mob/mymob.png";
	}

	protected int getDropItemId()
	{
		//This is the item your mob will drop
		return Item.porkCooked.shiftedIndex;
	}
}

Replace all "Pigman" with the name of your mob. Then, replace "mymob" with the name of your mob. After that, change "porkCooked" to the new name of your item. If you want it to drop a block...
return Block.nameofblock.blockID;
Replace "nameofblock" with the name of the block. NOTE: You will have to look inside Item.java and Block.java to see the names of these.
Rename EntityPigman.java to fit your new mob.

Open up mod_Pigman.java.

package net.minecraft.src;

import java.lang.reflect.Method;

public class mod_Pigman extends BaseMod
{
	public mod_Pigman()
	{
	}

	public String Version()
	{
		return "1.2_02";
	}

	public void AddEntityID()
	{
		//This defines your entity. Class name, entity 

name, and then the entity ID.
		EntityList.addMapping(EntityPigman.class, 

"Pigman", ModLoader.getUniqueEntityId());
		//This adds your mob to the spawn list.
		spawnlist.addCreaturesToSpawnList("Surface 

biomes", EntityPigman.class);
	}
}

Again, replace all "Pigman" with the name of your mob, and replace "Surface biomes" with the biome of your needs. For everywhere (like a normal mob), use Surface biomes. If you want a different one, check spawnlist.java for the list of biomes available.
Rename mod_Pigman to suit your new mob.

You are close to being done. Now just open the folder "Texture for minecraft.jar" in your tutorial files, open "mob", and replace mymob.png with the player skin that you would like. Also rename it to what you did on EntityPigman on this line:
texture = "/mob/mymob.png"


Once you have done that, compile the following:
mod_[MobName]
Entity[MobName]

After that, you are done with your mob!
If you get an error, make sure you did everything correctly.

EDIT: Thanks to everyone who told me to move the spawning to mod_Pigman instead of adding mod_SpawnPigman, and someone also confirms this makes it compatible with Mo' Creatures. If you followed this tutorial before, update your mods!
None.

Register or log in to remove.

#2

Sheith
    Sheith

    Void Walker

  • Members
  • 1583 posts
  • Location: The World of Notch

Posted 10 December 2010 - 12:56 AM

:iapprove: Nice work! I've never delved into the world of modding in Minecraft and even I could understand most of that coding! I'm sure this will create a massive increase in mob mods!
Koaku's Clocktown Project
Posted Image
Posted Image

ShadowDusk said:

all hail the tail

theicychamelion said:

Lockfail, second attempt

#3

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 10 December 2010 - 01:54 AM

Added a fix for the EntityList problem. addMapping is a private function in the source, so I made it public. Make sure to copy that over or you'll have problems compiling.
None.

#4

freakstritch

Posted 10 December 2010 - 02:12 AM

Thanks for posting this! Really appreciated! :tnt:  :tnt:

Posted Image


#5

DrZhark
    DrZhark

    Obsidian Miner

  • Members
  • 1367 posts

Posted 10 December 2010 - 03:38 AM

Excellent guide!
With this and the help of spawnlists, we can now have many new mobs added to the game
Posted Image

#6

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 10 December 2010 - 04:40 AM

Thanks for all the positive feedback!  :Sheep:
None.

#7

Mr. okushama

Posted 10 December 2010 - 04:53 AM

Im having problems recompiling the .java files into .class

It's just not happening at all.

EDIT MUCH MUCH LATER: Lol, This tutorial created me, within the time since this post and right now (feb 4th 2011) i've practically learned java, not to mention all the friends i have made along the way :RedShroom:

Club559 man, you sir are epic <3

#8

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 10 December 2010 - 05:09 AM

What type of problems?
None.

#9

XxSombraxX

Posted 10 December 2010 - 07:53 AM

Hello, thank you very much for the guide, I understand the code used, but I want to know if exist any tool to edit the image, I do not understand how to edit the parts for a new mob bigger or smaller, can you help me? thanks.

Sorry for my bad english >_

#10

freakstritch

Posted 10 December 2010 - 08:24 PM

Ok, Club559, two n00b questions.

1- Recompiling. Do I use the recompile.bat file from MCP? If so, where are my three new classes?

2- Do I need to run reobf.bat to re-obfuscate the classes? I did try that and entered the class names in the conf\client_obfuscation.txt file, but i didn't get any class output in the final_out folder

I have decompiled a virgin 1.2.6 minecraft.jar file as you said before going through your tutorial - please help this n0000b!

Posted Image


#11

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 10 December 2010 - 11:09 PM

First of all, run recompile.bat. After that, run reobf.bat. If it says stuff below "Obfuscating client" other than "Obfuscating server", check your minecraft_compile.log and search for "^".
None.

#12

dji435
    dji435

    Full Stack

  • Members
  • 64 posts

Posted 11 December 2010 - 01:51 AM

Ok, I decided to make a new skin for the mob, but I have no idea as to where I need to put it.  Do I just leave it in the '\Texture for Minecraft.jar\mob\mymob.png' but in the src folder? Or do I need to put it elsewhere?

#13

rezzeku
    rezzeku

    Coal Miner

  • Members
  • 106 posts
  • Location: California
  • Minecraft: Rezzeku
  • Xbox:Black W3b

Posted 11 December 2010 - 03:00 AM

Download link is broken.

EDIT:Uh... NVM... It's working now...
wtf
Posted Image
Posted Image

#14

freakstritch

Posted 11 December 2010 - 04:14 AM

CLUB559 - I added the spawn command to the mod_Mummy.class and everything is working great now! I do not understand why, but it does! Thanks.

Posted Image


#15

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 11 December 2010 - 04:53 AM

dji435 said:

Ok, I decided to make a new skin for the mob, but I have no idea as to where I need to put it.  Do I just leave it in the '\Texture for Minecraft.jar\mob\mymob.png' but in the src folder? Or do I need to put it elsewhere?

You put the png into your "mob" folder in minecraft.jar.

You don't need to do anything special to make it work with MCP.
None.

#16

Club559
    Club559

    Obsidian Miner

  • Curse Premium
  • Curse Premium
  • 1344 posts
  • Location: A little west of somewhere.
  • Minecraft: Club559

Posted 11 December 2010 - 07:10 AM

Bump. Thanks for telling me how to make it compatible with Mo' Creatures.
None.

#17

92921376

Posted 11 December 2010 - 08:00 AM

Looks awesome.
Could you edit this slightly to be useful to persons without much knowledge of Java. I think that I could probably get on well if you explained the beginning part more thoroughly because I am trying to learn Java and I think that this could help.
Edit: specifically the decompiling part, but other parts too.
Also, qq:
Will you be making more of these such as ones that show how to model, increasing in difficulty? that would be awesome.

Thanks,

Wanting to get back on Alcraftraz.

#18

Sade1212
  • Minecraft: sade1212

Posted 11 December 2010 - 01:52 PM

When I did this, I got an error :Pig:

This is what I did: I don't get where I was supposed to put my new 'boxman.png'  (Boxman was going to be my mob, based on my skin) so I guessed I could put it in minecraft.jar after I'd compiled.  What I did so far then:  1. Take .java files from tutorial thing and put them in sources\minecraft\net\minecraft\src in my MCP folder after decompiling.  2.  Change every pigman text to boxman!
I then went to recompile (don't worry, I had JDK  B)) but it complained about not being able to find javac.exe :Diamond:  I had it in path and stuff, but I tried everything like putting javac.exe in the MCP folder, running as admin and stuff.

BTW, system specs if relevant:
Posted Image

Hi


#19

Wiizz
    Wiizz

    Stone Miner

  • Members
  • 76 posts

Posted 11 December 2010 - 02:41 PM

Thanks for the tutorial, I now have some company in single player.

Now, how did the person make it compatible with Mo' Creatures? Can you do a short tutorial specifically on that? I'm not so good with it.

#20

y00b0y
    y00b0y

    Out of the Water

  • Members
  • 5 posts

Posted 11 December 2010 - 04:40 PM

Please make a Video Tutorial or Post some images please?