111
Welcome to the my first java encoding tutorial for Minecraft. Before we start, you need the following:
+Eclipse
+Minecraft Coder pack
~Add the Audio Mod and Modloader to the Minecraft Coder Pack jars before decompiling
... Lets Begin.
First, make a java file called "mod_..." and then whatever you want to name your npc. NOTE: when I type in
"[Whatever]", get rid of the square brackets and type in the name of your npc. Also, don't type in the equals signs i put below here, they just represent a new section. Delete the Asterisks.
then type in:
==========================================================================
package net.minecraft.src;
import java.util.Map;
public class mod_[Whatever] extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(Entity[Whatever].class, "[Whatever]",
ModLoader.getUniqueEntityId());
ModLoader.addSpawn(Entity[Whatever].class, 1, 1, 5, EnumCreatureType.monster*);
}
public void addRenderer(Map map)
{
map.put(Entity[Whatever].class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "[Whatever]"**;
}
}
==================================================================
*can be changed from monster to creature or to water creature for underwater animals
**type in the version of your mod
==================================================================
You'll get an error on line 9, 12, and 16. Ignore them, we'll fix them later.
Next, create another java file named "Entity..." and then type in whatever you want your mod to be called, as said above. Same notes as said before apply here.
Type in:
==================================================================
package net.minecraft.src;
public class Entity[Whatever] extends EntityMob
{
private static final int HeldItem = Item. [Whatever] *.shiftedIndex;
public EntityEnclaveSoldier (World world)
{
super (world);
texture = " [Whatever] **";
attackStrength = 2***;
moveSpeed = 0.5F****;
}
public int getMaxHealth()
{
return ***;
}
public String addName()
{
return " [Whatever] ";
}
protected String getHurtSound()
{
return " [Whatever] ******";
}
protected String getDeathSound()
{
return " [Whatever] *****";
}
protected int getDropItemId()
{
return Item.[Whatever]*.shiftedIndex;
}
}
==============================================================
*after typing in Item. , you'll get a list of options to choose from
**Drag and drop the .png skin file into the net.minecraft.src package for your character, and in the quotations, have the name of that file with .png at the end
***any integer you want
****any integer you want, and then end it with a capital F
*****Drag and drop any .ogg sound file into the net.minecraft.src package and in the quotations add the name of your sound file with .ogg at the end
==============================================================
Go to your main Minecraft Coder Pack folder and run the following batch files in order.
+recompile.bat
+reobfuscate.bat
And then go into Minecraft Coder PackeclipseClientbinnetminecraftsrc
Extract the java files that were converted to class and then the png images and ogg sound files to go with it. Put them all in a .zip folder and Enjoy!
+Eclipse
+Minecraft Coder pack
~Add the Audio Mod and Modloader to the Minecraft Coder Pack jars before decompiling
... Lets Begin.
First, make a java file called "mod_..." and then whatever you want to name your npc. NOTE: when I type in
"[Whatever]", get rid of the square brackets and type in the name of your npc. Also, don't type in the equals signs i put below here, they just represent a new section. Delete the Asterisks.
then type in:
==========================================================================
package net.minecraft.src;
import java.util.Map;
public class mod_[Whatever] extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(Entity[Whatever].class, "[Whatever]",
ModLoader.getUniqueEntityId());
ModLoader.addSpawn(Entity[Whatever].class, 1, 1, 5, EnumCreatureType.monster*);
}
public void addRenderer(Map map)
{
map.put(Entity[Whatever].class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "[Whatever]"**;
}
}
==================================================================
*can be changed from monster to creature or to water creature for underwater animals
**type in the version of your mod
==================================================================
You'll get an error on line 9, 12, and 16. Ignore them, we'll fix them later.
Next, create another java file named "Entity..." and then type in whatever you want your mod to be called, as said above. Same notes as said before apply here.
Type in:
==================================================================
package net.minecraft.src;
public class Entity[Whatever] extends EntityMob
{
private static final int HeldItem = Item. [Whatever] *.shiftedIndex;
public EntityEnclaveSoldier (World world)
{
super (world);
texture = " [Whatever] **";
attackStrength = 2***;
moveSpeed = 0.5F****;
}
public int getMaxHealth()
{
return ***;
}
public String addName()
{
return " [Whatever] ";
}
protected String getHurtSound()
{
return " [Whatever] ******";
}
protected String getDeathSound()
{
return " [Whatever] *****";
}
protected int getDropItemId()
{
return Item.[Whatever]*.shiftedIndex;
}
}
==============================================================
*after typing in Item. , you'll get a list of options to choose from
**Drag and drop the .png skin file into the net.minecraft.src package for your character, and in the quotations, have the name of that file with .png at the end
***any integer you want
****any integer you want, and then end it with a capital F
*****Drag and drop any .ogg sound file into the net.minecraft.src package and in the quotations add the name of your sound file with .ogg at the end
==============================================================
Go to your main Minecraft Coder Pack folder and run the following batch files in order.
+recompile.bat
+reobfuscate.bat
And then go into Minecraft Coder PackeclipseClientbinnetminecraftsrc
Extract the java files that were converted to class and then the png images and ogg sound files to go with it. Put them all in a .zip folder and Enjoy!
Tags |
tools/tracking
1091315
6
modding-tutorial-1-adding-a-npc
Create an account or sign in to comment.
I'll definitely post more