Modding tutorials for Minecraft 1.2.4
I am Compaq on Xboxmb
I am Khronic from xboxchaos
Requirements:
Java Development Kit (JDK) - http://www.oracle.com/technetwork/java/javase/downloads/index.html
Java Runtime Environments (JRE) - http://www.oracle.com/technetwork/java/javase/downloads/index.html
Eclipse (not required but helps so much) - http://www.eclipse.org/downloads/ [choose the first link]
Minecraft Coder Pack (MCP) - http://mcp.ocean-labs.de/index.php/MCP_Releases
How to install mods
Open Me
Are you on a Mac? Well you’re paying to much for an average computer…
http://youtu.be/http://www.youtube.com/watch?v=6-LPvijRUjM
Are you on a Windows Computer? 88) aa)
here is your tutorial:
first press Windows Key + R
type
%appdata%\.minecraft\bin\
now get a archiving program that can open the .jar file, I recommend WinRAR but 7zip and WinZIP work too.
copy the Minecraft.jar and save it as Minecraft -Backup.jar or whatever you want (this is a backup just incase you screw up)
Now open the Minecraft.jar file with your archiving program and delete the META-INF folder.
Now drag the mod files that you downloaded. Let it overwrite the files because it will save the changes that way.
Fixing ModLoader Errors
Open Me
just put that in your mod_Namehere
public String getVersion()
{
// TODO Auto-generated method stub
return null;
}
public void load()
{
// TODO Auto-generated method stub
}
Creating Your First Block
Open Me
BlockNamehere.java
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j)
{
super(i, j, Material.ground);
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public int quantityDropped(Random random)
{
return 3;
}
}
mod_Namehere.java
package net.minecraft.src;
public class mod_Block extends BaseMod
{
public static final Block Namehere = new BlockName(160, 0).setBlockName("anynamehere").setHardness(3F).setResistance(4F).setLightValue(1F);
public void load()
{
Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/pathtoyourfile/image.png");
ModLoader.registerBlock(Namehere);
ModLoader.addName(Namehere, "In-Game Name Here");
ModLoader.addRecipe(new ItemStack(Namehere, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.1";
}
}
HELP: BlockNamehere.java
At return mod_Namehere.Namehere.blockID;
This is what the block drops, Change mod_Namehere.Namehere not the .blockID
examples
return Block.grass.blockID;
return Item.clay.shiftedIndex;
HELP: mod_Namehere
At new BlockNamehere(190,
change 190, that is the block ID be careful not to use the same ID again
At .setHardness(1.0F)
change the 1.0, dirt is 0.5; stone is 1.5; 10 is unbreakable
At .setResistance(2500.0F)
this is how resistant the block is to Explosives
change the 2500.0, obsidian is 2000.0F all other blocks are 5.0F
At .setLightValue(1.0F)
this is how bright your block is
1.0F is as high as it goes, Torches are 0.9375F and redstone is 0.5F
At ModLoader.AddName(Namehere, “Nameingamehere”);
this is the ingame name, so change Namehere to the block name (in mod_Namehere) and change Nameingamehere to whatever you want it to say ingame
At Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", “/Namehere.png”);
this is the texture, change the Namehere.blockIndexInTexture and in the () change “/Namehere.png” ex. “/Mod/Fireblock.png” the /Mod/ is a folder and the Fireblock.png is the image file
Creating your First Item
Open Me
Again use the template to your advantage
ItemNamehere.java
package net.minecraft.src;
import java.util.Random;
public class ItemNamehere extends Item
{
public ItemNamehere (int i)
{
super(i);
maxStackSize = 64;
}
}
mod_Namehere.java
package net.minecraft.src;
public class mod_Item extends BaseMod
{
public static final Item Namehere = new ItemNamehere(5000).setItemName("anynamehere");
public void load()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/pathtoyourfile/image.png");
ModLoader.AddName(Namehere, "In-Game Name Here");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.1";
}
}
HELP: mod_Namehere.java
At setItemName
this is the coding name not the ingame name
Creating a Food
Open Me
This is the same as the item tutorial with some small tweaks
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere;
public String Version()
{
return "1.0.0";
}
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Items/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
}
static
{
new ItemFood(1000, 10, true).setItemName("1");
}
}
HELP:
At new ItemFood(28000, 4, 1F,
1F stands for half a heart so 5F is 2.5 hearts
An Item That Spawns a Mob!
Open Me
ItemNamehere
package net.minecraft.src;
import java.util.*;
public class ItemNamehere extends Item
{
private World worldObj;
public ItemNamehere (int i)
{
super(i);
maxStackSize = 1;
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(!world.multiplayerWorld)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Summoned a pig!");
EntityLiving entityliving = (EntityLiving)EntityList.createEntityInWorld("Pig", entityplayer.worldObj);
entityliving.setLocationAndAngles(i, j + 1, k, 0F, 0F);
entityplayer.worldObj.entityJoinedWorld(entityliving);
entityplayer.swingItem();
}
return true;
}
}
mod_Namehere
package net.minecraft.src;
public class mod_Namehere extends BaseMod
{
public static Item Namehere;
public String Version()
{
return "1.0.0";
}
public mod_Namehere()
{
Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Items/Namehere.png");
ModLoader.AddName(Namehere, "Namehere");
ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {"###", "###", "###", Character.valueOf('#'), Item.seeds});
}
static
{
new Item(1000).setItemName("1");
}
}
NOTE** The mod_Namehere isn’t different then the Item tutorial only the ItemNamehere.java file is being altered
HELP: ItemNamehere.java
At ModLoader.getMinecraftInstance().thePlayer.addChatMessage(“A pig has Spawned!”)
this is the function that makes a message pop up on the screen
Making the Block more Advanced!
Open Me
This tutorial edits the BlockNamehere.java file
slipperiness = 1.5F;
it would go under
super(i, j, Material.ground);
Makes you run faster as long as your on that specific block, great for long distance travel
A Bouncy Block
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
goes here
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Transparent Block[details=Open Me]
public boolean isOpaqueCube()
{
return true;
}
set return true to false if you want the object transparent. Aka without you being able to see down into the rest of the world.
[/details]
Creating a Slab Block[details=Open Me]
the mod_Namehere class will not be altered in this tutorial.
BlockNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockNamehereSlab extends Block
{
protected BlockNamehereSlab(int i, int j)
{
super(i, j, Material.wood);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
setLightOpacity(255);
}
public boolean isOpaqueCube()
{
return false;
}
public int idDropped(int i, Random random, int j)
{
return mod_Slab.Namehere.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
if (this != Block.stairSingle)
{
super.shouldSideBeRendered(iblockaccess, i, j, k, l);
}
if (l == 1)
{
return true;
}
if (!super.shouldSideBeRendered(iblockaccess, i, j, k, l))
{
return false;
}
if (l == 0)
{
return true;
}
else
{
return iblockaccess.getBlockId(i, j, k) != blockID;
}
}
}
setBlockBounds in the constructor of the block class is what makes you able to walk over it. 1F, 0.5F, and 1F are the length, height and width of the block, respectively.
The shouldSideBeRendered method is one that I can’t seem to figure out. I have used the block with and without this code, next to stairs and such, but it doesn’t seem to make a difference. I have left it in the tutorial in case someone does run into a few lighting issues when the block is next to stairs.[/details]
Creating a flower[details=Open Me]
The mod_Namehere file will not be altered, only the BlockNamehere.
BlockNamehere.java
add
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
at the bottom of the block class, and then at the top where it extends make it extend BlockFlower.[/details]
Creating Armor
Open Me
mod_Namehere
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
NamehereHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherehelmet.png");
NamehereBody.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherebody.png");
NamehereLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Nameherelegs.png");
NamehereBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/Armor/Namehereboots.png");
ModLoader.AddName(NamehereHelmet, "Namehere Helmet");
ModLoader.AddName(NamehereBody, "Namehere Chestplate");
ModLoader.AddName(NamehereLegs, "Namehere Leggings");
ModLoader.AddName(NamehereBoots, "Namehere Boots");
ModLoader.AddRecipe(new ItemStack(NamehereHelmet, 1), new Object[] {"sss", "s s", " ", Character.valueOf('s'), Item.seeds});
ModLoader.AddRecipe(new ItemStack(NamehereBody, 1), new Object[] {"s s", "sss", "sss", Character.valueOf('s'), Item.seeds});
ModLoader.AddRecipe(new ItemStack(NamehereLegs, 1), new Object[] {"sss", "s s", "s s", Character.valueOf('s'), Item.seeds});
ModLoader.AddRecipe(new ItemStack(NamehereBoots, 1), new Object[] {" ", "s s", "s s", Character.valueOf('s'), Item.seeds});
}
static
{
new ItemArmor(1000, 3, ModLoader.AddArmor("NamehereArmor"), 0).setItemName("1");
new ItemArmor(1001, 3, ModLoader.AddArmor("NamehereArmor"), 1).setItemName("2");
new ItemArmor(1002, 3, ModLoader.AddArmor("NamehereArmor"), 2).setItemName("3");
new ItemArmor(1003, 3, ModLoader.AddArmor("NamehereArmor"), 3).setItemName("4");
}
public String Version()
{
return "1.0.0";
}
public static Item NamehereHelmet;
public static Item NamehereBody;
public static Item NamehereLegs;
public static Item NamehereBoots;
}
HELP:
At (“NamehereArmor”), 0))
the 0 is the type of armor
types 0-Helmet 1-Body 2-Legs 3-Boots
Adding Armor effects
Open Me
put
ModLoader.SetInGameHook(this, true, false);
under all your recipes
add
public boolean OnTickInGame(Minecraft minecraft)
{
ItemStack boots = minecraft.thePlayer.inventory.armorInventory[0];
ItemStack legs = minecraft.thePlayer.inventory.armorInventory[1];
ItemStack chest = minecraft.thePlayer.inventory.armorInventory[2];
ItemStack helm = minecraft.thePlayer.inventory.armorInventory[3];
if(boots == null || legs == null || chest == null || helm == null)
{
return true;
}
if(boots.itemID == NamehereBoots.shiftedIndex && legs.itemID == NamehereLegs.shiftedIndex && chest.itemID == NamehereBody.shiftedIndex && helm.itemID == NamehereHelmet.shiftedIndex)
{
minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
}
return true;
}
into
ModLoader.AddRecipe(new ItemStack(NamehereBoots, 1), new Object[] {
" ", "r r", "r r", Character.valueOf('r'), Item.redstone
});
ModLoader.SetInGameHook(this, true, false);
}
public boolean OnTickInGame(Minecraft minecraft)
{
ItemStack boots = minecraft.thePlayer.inventory.armorInventory[0];
ItemStack legs = minecraft.thePlayer.inventory.armorInventory[1];
ItemStack chest = minecraft.thePlayer.inventory.armorInventory[2];
ItemStack helm = minecraft.thePlayer.inventory.armorInventory[3];
if(boots == null || legs == null || chest == null || helm == null)
{
return true;
}
if(boots.itemID == NamehereBoots.shiftedIndex && legs.itemID == NamehereLegs.shiftedIndex && chest.itemID == NamehereBody.shiftedIndex && helm.itemID == NamehereHelmet.shiftedIndex)
{
minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
}
return true;
}
at the bottom where it says minecraft.thePlayer.air = minecraft.thePlayer.maxAir;
you can change it to minecraft.thePlayer.isImmuneToFire = true;
Human NPC
Open Me
EntityNamehere
package net.minecraft.src;
import java.util.Random;
public class EntityNamehere extends EntityCreature
{
public EntityNamehere(World world)
{
super(world);
texture = "/image.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.ingotIron.shiftedIndex;
}
protected boolean canDespawn()
{
return false;
}
}
mod_Namehere
package net.minecraft.src;
import java.util.Map;
public class mod_HumanNPC extends BaseMod
{
public void load()
{
ModLoader.RegisterEntityID(EntityNamehere.class, "In-gameEntityName", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityNamehere.class, 12, 14, 18, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(EntityNamehere.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.1";
}
}
[color=green
Sugar-Cane Like block
Open Me
This tutorial is more difficult and i’m not the best with these kinds of mods I might not be able to help as much
mod_Namehere
package net.minecraft.src;
import java.util.Random;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
ModLoader.RegisterBlock(Namehere);
ModLoader.AddName(Namehere, "Namehere");
ModLoader.AddRecipe(new ItemStack(Item.redstone, 3), new Object[] {
"#", Character.valueOf('#'), Namehere
});
}
public void GenerateSurface(World world, Random random, int i, int j)
{
if(random.nextInt(20) == 0)
{
for(int k = 0; k < 16; k++)
{
for(int l = 0; l < 16; l++)
{
int i1 = random.nextInt(200);
if(world.getBlockId(i + l, i1, j + k) != Block.grass.blockID || !world.isAirBlock(i + l, i1 + 1, j + k))
{
continue;
}
int j1 = random.nextInt(2);
if(j1 == 0)
{
world.setBlock(i + l, i1 + 1, j + k, Namehere.blockID);
}
if(j1 == 1)
{
world.setBlock(i + l, i1 + 1, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 2, j + k, Namehere.blockID);
}
if(j1 == 2)
{
world.setBlock(i + l, i1 + 1, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 2, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 3, j + k, Namehere.blockID);
}
if(j1 == 3)
{
world.setBlock(i + l, i1 + 1, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 2, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 3, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 4, j + k, Namehere.blockID);
}
}
}
}
}
public String Version()
{
return "1.7.3";
}
public static Block Namehere = (new BlockNamehere(124, ModLoader.addOverride("/terrain.png", "/Namehere.png"))).setHardness(0.0F).setResistance(0.0F).setBlockName("Namehere");
}
BlockNamehere
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
protected BlockNamehere(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
float f = 0.375F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
setTickOnLoad(true);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.isAirBlock(i, j + 1, k))
{
int l;
for(l = 1; world.getBlockId(i, j - l, k) == blockID; l++) { }
if(l < 3)
{
int i1 = world.getBlockMetadata(i, j, k);
if(i1 == 15)
{
world.setBlockWithNotify(i, j + 1, k, blockID);
world.setBlockMetadataWithNotify(i, j, k, 0);
} else
{
world.setBlockMetadataWithNotify(i, j, k, i1 + 1);
}
}
}
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j - 1, k);
if(l == blockID)
{
return true;
}
return l == Block.grass.blockID || l == Block.dirt.blockID;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
checkBlockCoordValid(world, i, j, k);
}
protected final void checkBlockCoordValid(World world, int i, int j, int k)
{
if(!canBlockStay(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
public boolean canBlockStay(World world, int i, int j, int k)
{
return canPlaceBlockAt(world, i, j, k);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public int idDropped(int i, Random random)
{
return mod_Namehere.Namehere.blockID;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
Help: mod_Namehere
At
if(j1 == 1)
{
world.setBlock(i + l, i1 + 1, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 2, j + k, Namehere.blockID);
}
if you want it to grow more then add extra lines and just +1 more
like this
world.setBlock(i + l, i1 + 3, j + k, Namehere.blockID);
world.setBlock(i + l, i1 + 4, j + k, Namehere.blockID);
Help: BlockNamehere
At
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j - 1, k);
if(l == blockID)
{
return true;
}
return l == Block.grass.blockID || l == Block.dirt.blockID;
you can change or add more blocks that it can spawn on
Making Tools!
Open Me
mod_Namehere
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_Namehere extends BaseMod
{
public mod_Namehere()
{
NameherePickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/Nameherepick.png");
NamehereShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/Nameherespade.png");
NamehereAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/Namehereaxe.png");
NamehereHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/Nameherehoe.png");
NamehereSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/Nameheresword.png");
ModLoader.AddName(NameherePickaxe, "Namehere Pickaxe");
ModLoader.AddName(NamehereShovel, "Namehere Shovel");
ModLoader.AddName(NamehereAxe, "Namehere Axe");
ModLoader.AddName(NamehereHoe, "Namehere Hoe");
ModLoader.AddName(NamehereSword, "Namehere Sword");
ModLoader.AddRecipe(new ItemStack(NameherePickaxe, 1), new Object[] {"sss", " | ", " | ", Character.valueOf('s'), Item.seeds, Character.valueOf('|'), Item.stick});
ModLoader.AddRecipe(new ItemStack(NamehereShovel, 1), new Object[] {" s ", " | ", " | ", Character.valueOf('s'), Item.seeds, Character.valueOf('|'), Item.stick});
ModLoader.AddRecipe(new ItemStack(NamehereAxe, 1), new Object[] {"ss ", "s| ", " | ", Character.valueOf('s'), Item.seeds, Character.valueOf('|'), Item.stick});
ModLoader.AddRecipe(new ItemStack(NamehereHoe, 1), new Object[] {"ss ", " | ", " | ", Character.valueOf('s'), Item.seeds, Character.valueOf('|'), Item.stick});
ModLoader.AddRecipe(new ItemStack(NamehereSword, 1), new Object[] {" s ", " s ", " | ", Character.valueOf('s'), Item.seeds, Character.valueOf('|'), Item.stick});
}
static
{
new ItemPickaxe(1000, EnumToolMaterial.EMERALD).setItemName("1");
new ItemSpade(1001, EnumToolMaterial.EMERALD).setItemName("2");
new ItemAxe(1002, EnumToolMaterial.EMERALD).setItemName("3");
new ItemHoe(1003, EnumToolMaterial.EMERALD).setItemName("4");
new ItemSword(1004, EnumToolMaterial.EMERALD).setItemName("5");
}
public String Version()
{
return "1.0.0";
}
public static Item NameherePickaxe;
public static Item NamehereShovel;
public static Item NamehereAxe;
public static Item NamehereHoe;
public static Item NamehereSword;
}
This is just like making an item except you dont need to make ItemNamehere.java files!
now for the only difficult part. find EnumToolMaterial.java file and open it up
at the top where it says
WOOD(“WOOD”, 0, 0, 59, 2.0F, 0, 15),
STONE(“STONE”, 1, 1, 131, 4F, 1, 5),
IRON(“IRON”, 2, 2, 250, 6F, 2, 14),
EMERALD(“EMERALD”, 3, 3, 1561, 8F, 3, 10),
GOLD(“GOLD”, 4, 0, 32, 12F, 0, 22);
delete the ; after the Gold line and put a comma there
for a new material
Namehere(“NAMEHERE”, 5, #, ##, #F, #, ###);
= 0 means it can only mine stone/coal, 1 means iron, 2 means gold/diamond/redstone/lupis, 3 means obsidian
= how many uses
#F = How strong it is against ores
= not sure XD put the same number as emerald (aka diamond)
Making a Sword Catch Mobs on Fire!
[details=Open Me]Add
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
entityliving.fire=300;
return false;
}
to you ItemNamehere.java file
[/details]
Making an Ore Generate
Open Me
mod_Namehere
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < Rarity; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(Height);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Namehere.Namehere.blockID, Vein Size)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
goes in after
public String Version()
{
return "1.0.0";
}
How to give foods a potion effect
Open Me
Applying a potion effect to a food. This is very easy to do. You simply make a food(follow the tutorial above), and add this bit of code to it
.setPotionEffect(Potion.hunger.id, 30, 0, 0.8F)
so it would fit in like this:
public static final Item Namehere = new ItemFood(5001, 4, 1F, false).setPotionEffect(Potion.hunger.id, 30, 0, 1F).setItemName("anynamehere");
Note that .setPotionEffect MUST go before .setItemName otherwise you will get recompilation errors. I use the hunger potion in this example, which is what is used in rotten flesh. You can use any potion effect when doing this. They are all listed in Potion.java. I’m not sure what the 0 means, but the 30 is the time the effect lasts for. An int of 20 here lasts for 6 seconds, so 30 is about 9 seconds. The float(1F) is the chance of the potion being successful. Rotten flesh has 0.8F here, and it has an 80% chance of giving you food poisoning. Having 1F in this position should be a 100% success rate.[/details]
How to edit Start Menu[details=Open Me]
Do you want to make your Minecraft Menu look like this?
- Open Minecraft.jar and open the lang folder and open en_US.lang
gui.done=Done
gui.cancel=Cancel
gui.toMenu=Back to title screen
gui.up=Up
gui.down=Down
gui.yes=Yes
gui.no=No
menu.singleplayer=Singleplayer
menu.multiplayer=Multiplayer
menu.mods=Texture Packs
menu.options=Options...
menu.quit=Quit
Now you can edit the text after the .
and for the text color http://minecraftonline.com/wiki/Colour_Codes
use
4 for Red
c for Rose
6 for Gold
e for Yellow
2 for Green
a for Lightgreen
b for Lightblue
3 for Cyan
1 for Navy
9 for Blue
d for Lightpurple
5 for Purple
f for White
7 for Lightgray
8 for Gray
0 for Black
Credit to Lot and his post http://www.thetechgame.com/Forums/t=2630396/how-to-edit-the-start-menu-on-minecraft-tut.html
I have permission for putting taking his tutorial
Video Tutorials
Open Me
Credit to TheInstituion for the videos
Create a Biome
http://youtu.be/http://www.youtube.com/watch?v=S3Lo9N5_-UE
Potion Effected Food
http://youtu.be/http://www.youtube.com/watch?v=WVfVpnmTnHs
Make A New Liquid
http://youtu.be/http://www.youtube.com/watch?v=DEizvA8tgPw
Structure Generation
http://youtu.be/http://www.youtube.com/watch?v=tde5vdszWOQ
Create/Generate A Tree
http://youtu.be/http://www.youtube.com/watch?v=YPYXQ49nwE0
Create A New Sapling
http://youtu.be/http://www.youtube.com/watch?v=YPYXQ49nwE0
Nether Generation
Puddlehund’s Dimension API Tutorial[details=Open Me]
mod_Namehere
package net.minecraft.src;
public class mod_Tutorial extends BaseMod{
public static final Item tutorial = new ItemTutorial(250, 0).setItemName("Derp");
public mod_Tutorial() {
DimensionAPI.registerDimension(new WorldProviderTutorial());
}
public String getVersion() {
return "Spaces Tutorials!";
}
public void load() {
ModLoader.addName(tutorial,"Tutorial Portal");
ModLoader.addRecipe(new ItemStack(tutorial, 1), new Object[] {"#", Character.valueOf('#'), Block.dirt});
}
}
WorldProviderNamehere
package net.minecraft.src;
public class WorldProviderTutorial extends WorldProviderBase
{
public int getDimensionID()
{
return 3;
}
public boolean renderClouds()
{
return true;
}
public boolean renderVoidFog()
{
return false;
}
public float setSunSize()
{
return 0.5F;
}
public float setMoonSize()
{
return 0.5F;
}
public boolean renderStars()
{
return true;
}
public boolean darkenSkyDuringRain()
{
return false;
}
public String getRespawnMessage()
{
return "Your a derp.";
}
public void registerWorldChunkManager()
{
worldChunkMgr = new WorldChunkManagerTutorial(worldObj);
}
public IChunkProvider getChunkProvider()
{
return new ChunkProviderTutorial(worldObj, worldObj.getSeed(), hasNoSky);
}
}
ChunkManagerNamehere
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class ChunkProviderTutorial implements IChunkProvider
{
private World worldObj;
private Random random;
private final boolean useStructures;
private MapGenVillage villageGen;
public ChunkProviderTutorial(World par1World, long par2, boolean par4)
{
villageGen = new MapGenVillage(1);
worldObj = par1World;
useStructures = par4;
random = new Random(par2);
}
private void generate(byte par1ArrayOfByte[])
{
int i = par1ArrayOfByte.length / 256;
for (int j = 0; j < 16; j++)
{
for (int k = 0; k < 16; k++)
{
for (int l = 0; l < i; l++)
{
int i1 = 0;
if (l == 0)
{
i1 = Block.bedrock.blockID;
}
else if (l <= 2)
{
i1 = Block.dirt.blockID;
}
else if (l == 3)
{
i1 = Block.grass.blockID;
}
par1ArrayOfByte[j << 11 | k << 7 | l] = (byte)i1;
}
}
}
}
/**
* Creates an empty chunk ready to put data from the server in
*/
public Chunk loadChunk(int par1, int par2)
{
return provideChunk(par1, par2);
}
/**
* Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
* specified chunk from the map seed and chunk seed
*/
public Chunk provideChunk(int par1, int par2)
{
byte abyte0[] = new byte[32768];
generate(abyte0);
Chunk chunk = new Chunk(worldObj, abyte0, par1, par2);
if (useStructures)
{
villageGen.generate(this, worldObj, par1, par2, abyte0);
}
chunk.generateSkylightMap();
return chunk;
}
/**
* Checks to see if a chunk exists at x, y
*/
public boolean chunkExists(int par1, int par2)
{
return true;
}
/**
* Populates chunk with ores etc etc
*/
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
{
random.setSeed(worldObj.getSeed());
long l = (random.nextLong() / 2L) * 2L + 1L;
long l1 = (random.nextLong() / 2L) * 2L + 1L;
random.setSeed((long)par2 * l + (long)par3 * l1 ^ worldObj.getSeed());
if (useStructures)
{
villageGen.generateStructuresInChunk(worldObj, random, par2, par3);
}
}
/**
* Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
* Return true if all chunks have been saved.
*/
public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
{
return true;
}
/**
* Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list
* is always empty and will not remove any chunks.
*/
public boolean unload100OldestChunks()
{
return false;
}
/**
* Returns if the IChunkProvider supports saving.
*/
public boolean canSave()
{
return true;
}
/**
* Converts the instance data to a readable string.
*/
public String makeString()
{
return "FlatLevelSource";
}
/**
* Returns a list of creatures of the specified type that can spawn at the given location.
*/
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
BiomeGenBase biomegenbase = worldObj.func_48454_a(par2, par4);
if (biomegenbase == null)
{
return null;
}
else
{
return biomegenbase.getSpawnableList(par1EnumCreatureType);
}
}
/**
* Returns the location of the closest structure of the specified type. If not found returns null.
*/
public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int i, int j)
{
return null;
}
}
WorldChunkManagerNamehere
package net.minecraft.src;
import java.util.*;
public class WorldChunkManagerTutorial extends WorldChunkManager
{
private GenLayer genBiomes;
/** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
private GenLayer biomeIndexLayer;
/** The BiomeCache object for this world. */
private BiomeCache biomeCache;
/** A list of biomes that the player can spawn in. */
private List biomesToSpawnIn;
protected WorldChunkManagerTutorial()
{
biomeCache = new BiomeCache(this);
biomesToSpawnIn = new ArrayList();
biomesToSpawnIn.add(BiomeGenBase.forest);
biomesToSpawnIn.add(BiomeGenBase.plains);
biomesToSpawnIn.add(BiomeGenBase.taiga);
biomesToSpawnIn.add(BiomeGenBase.taigaHills);
biomesToSpawnIn.add(BiomeGenBase.forestHills);
biomesToSpawnIn.add(BiomeGenBase.field_48416_w);
biomesToSpawnIn.add(BiomeGenBase.field_48417_x);
biomesToSpawnIn.add(BiomeGenBase.virus);
}
public WorldChunkManagerTutorial(long par1, WorldType par3WorldType)
{
this();
GenLayer agenlayer[] = GenLayer.func_48425_a(par1, par3WorldType);
genBiomes = agenlayer[0];
biomeIndexLayer = agenlayer[1];
}
public WorldChunkManagerTutorial(World par1World)
{
this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
}
/**
* Gets the list of valid biomes for the player to spawn in.
*/
public List getBiomesToSpawnIn()
{
return biomesToSpawnIn;
}
/**
* Returns the BiomeGenBase related to the x, z position on the world.
*/
public BiomeGenBase getBiomeGenAt(int par1, int par2)
{
return biomeCache.getBiomeGenAt(par1, par2);
}
/**
* Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
*/
public float[] getRainfall(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
{
IntCache.resetIntCache();
if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
{
par1ArrayOfFloat = new float[par4 * par5];
}
int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
for (int i = 0; i < par4 * par5; i++)
{
float f = (float)BiomeGenBase.biomeList[ai[i]].getIntRainfall() / 65536F;
if (f > 1.0F)
{
f = 1.0F;
}
par1ArrayOfFloat[i]= f;
}
return par1ArrayOfFloat;
}
/**
* Return an adjusted version of a given temperature based on the y height
*/
public float getTemperatureAtHeight(float par1, int par2)
{
return par1;
}
/**
* Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length
*/
public float[] getTemperatures(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
{
IntCache.resetIntCache();
if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
{
par1ArrayOfFloat = new float[par4 * par5];
}
int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
for (int i = 0; i < par4 * par5; i++)
{
float f = (float)BiomeGenBase.biomeList[ai[i]].getIntTemperature() / 65536F;
if (f > 1.0F)
{
f = 1.0F;
}
par1ArrayOfFloat[i]= f;
}
return par1ArrayOfFloat;
}
/**
* Returns an array of biomes for the location input.
*/
public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase par1ArrayOfBiomeGenBase[], int par2, int par3, int par4, int par5)
{
IntCache.resetIntCache();
if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
}
int ai[] = genBiomes.getInts(par2, par3, par4, par5);
for (int i = 0; i < par4 * par5; i++)
{
par1ArrayOfBiomeGenBase[i]= BiomeGenBase.biomeList[ai[i]];
}
return par1ArrayOfBiomeGenBase;
}
/**
* Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
* WorldChunkManager Args: oldBiomeList, x, z, width, depth
*/
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase par1ArrayOfBiomeGenBase[], int par2, int par3, int par4, int par5)
{
return getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
}
/**
* Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
* don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
*/
public BiomeGenBase[] getBiomeGenAt(BiomeGenBase par1ArrayOfBiomeGenBase[], int par2, int par3, int par4, int par5, boolean par6)
{
IntCache.resetIntCache();
if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
}
if (par6 && par4 == 16 && par5 == 16 && (par2 & 0xf) == 0 && (par3 & 0xf) == 0)
{
BiomeGenBase abiomegenbase[] = biomeCache.getCachedBiomes(par2, par3);
System.arraycopy(abiomegenbase, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
return par1ArrayOfBiomeGenBase;
}
int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
for (int i = 0; i < par4 * par5; i++)
{
par1ArrayOfBiomeGenBase[i]= BiomeGenBase.biomeList[ai[i]];
}
return par1ArrayOfBiomeGenBase;
}
/**
* checks given Chunk's Biomes against List of allowed ones
*/
public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
{
int i = par1 - par3 >> 2;
int j = par2 - par3 >> 2;
int k = par1 + par3 >> 2;
int l = par2 + par3 >> 2;
int i1 = (k - i) + 1;
int j1 = (l - j) + 1;
int ai[] = genBiomes.getInts(i, j, i1, j1);
for (int k1 = 0; k1 < i1 * j1; k1++)
{
BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[k1]];
if (!par4List.contains(biomegenbase))
{
return false;
}
}
return true;
}
/**
* Finds a valid position within a range, that is once of the listed biomes.
*/
public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
{
int i = par1 - par3 >> 2;
int j = par2 - par3 >> 2;
int k = par1 + par3 >> 2;
int l = par2 + par3 >> 2;
int i1 = (k - i) + 1;
int j1 = (l - j) + 1;
int ai[] = genBiomes.getInts(i, j, i1, j1);
ChunkPosition chunkposition = null;
int k1 = 0;
for (int l1 = 0; l1 < ai.length; l1++)
{
int i2 = i + l1 % i1 << 2;
int j2 = j + l1 / i1 << 2;
BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[l1]];
if (par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(k1 + 1) == 0))
{
chunkposition = new ChunkPosition(i2, 0, j2);
k1++;
}
}
return chunkposition;
}
/**
* Calls the WorldChunkManager's biomeCache.cleanupCache()
*/
public void cleanupCache()
{
biomeCache.cleanupCache();
}
}
TeleporterNamehere
package net.minecraft.src;
public class TeleporterTutorial extends Teleporter{}
ItemNamehere
package net.minecraft.src;
import java.util.ArrayList;
import java.util.List;
public class ItemTutorial extends ItemTeleporterBase
{
public ItemTutorial(int i, int j)
{
super(i);
}
public WorldProviderBase getDimension()
{
return new WorldProviderTutorial();
}
public TeleporterTutorial getTeleporter()
{
return new TeleporterTutorial();
}
public String getEnteringMessage()
{
return "Entering the Tutorial Dimension";
}
public String getLeavingMessage()
{
return "Leaving the Tutorial Dimension";
}
public boolean isPortalImmediate()
{
return true;
}
public boolean displayPortalAnimation()
{
return true;
}
public int returnsPlayerToDimension()
{
return 0;
}
public double getDistanceRatio()
{
return 0.2D;
}
public int getPortalDelay()
{
return 150;
}
}
[/details]