[SPOILER]
[code]package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Random;
public class mod_Tutorial extends BaseMod
{
public mod_Tutorial()
{
//Registers the Block (You need to put something in between these brackets!)
ModLoader.registerBlock(BlockTutorial);
ModLoader.addName(BlockTutorial, "Tutorial Block");
//Adds the texture to the block
BlockTutorial.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block.png");
}
//Creates the item and its properties (Image, Name, Item ID)
public static final Item ItemTutorial;
static
{
ItemTutorial = (new ItemTutorial(9999).setIconIndex(ModLoader.addOverride("/gui/items.png", "/tutorial/item.png")).setItemName("Tutorial Item"));
}
//Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value)
public static final Block BlockTutorial;
static
{
BlockTutorial = (new BlockTutorial(250, 0).setBlockName("Tutorial Block").setHardness(0F).setResistance(6000F).setLightValue(1F));
}
//Mod version (To update the mod, change this to minecraft version :) )
public String getVersion()
{
return "1.2.5";
}
public void load()
{
ModLoader.addName(BlockTutorial, "Tutorial Block");
ModLoader.addName(ItemTutorial, "Tutorial Item");
ModLoader.addRecipe(new ItemStack (BlockTutorial, 1), (new Object[] {"RRR", "RRR", "RRR", Character.valueOf('R'), Item.bone}));
ModLoader.addRecipe(new ItemStack (ItemTutorial, 9), (new Object[] {" B", " B ", "S ", Character.valueOf('B'), BlockTutorial, Character.valueOf('S'), Item.stick}));
}
}[/code]
[/SPOILER]
Now we'll do the BlockTutorial.java:
[SPOILER]
[code]package net.minecraft.src;
import java.util.*;
public class BlockTutorial extends Block
{
protected BlockTutorial (int i, int j)
{
super(i ,j, Material.glass);
}
//Un-comment to add contact damage
// public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
// {
// par5Entity.attackEntityFrom(DamageSource.cactus, 1);
// }
//Un-comment to be able to walk through it
// public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i)
// {
// return null;
// }
//Un-comment to use it like a redstone torch (It powers redstone)
// public boolean renderAsNormalBlock()
// {
// return false;
// }
// public boolean isPoweringTo(IBlockAccess iblockaccess, int x, int y, int z, int l)
// {
// return l > 1;
// }
// public boolean isIndirectlyPoweringTo(World world, int x, int y, int z, int l)
// {
// return l == 1;
// }
}[/code]
[/SPOILER]
And finally, the ItemTutorial.java file:
[SPOILER]
[code]package net.minecraft.src;
public class ItemTutorial extends Item
{
protected ItemTutorial(int i)
{
super(i);
}
public boolean hasEffect(ItemStack itemstack)
{
return true;
}
public EnumRarity getRarity(ItemStack itemstack)
{
return EnumRarity.epic;
}
}[/code]
[/SPOILER] [/SPOILER]
Now a Tree w/ a sapling!(Thanks to senpaisubaraki for the idea ): [SPOILER] First off, let me tell you that this one is NOT that easy!
You need to make three blocks: The Wood, The Sapling, and The Leaves.
This is a 5-file process! That is as much as a dimension, but THAT has a LOT more code Now, for the mod_Tutorial: [SPOILER]
[code]package net.minecraft.src;
import java.util.Random;
public class mod_Tutorial extends BaseMod
{
public mod_Tutorial()
{
//Registers the Wood and sets its In-Game-Name (IGN)
ModLoader.registerBlock(TutorialWood);
ModLoader.addName(TutorialWood, "Tree Tutorial Wood");
//Registers the Leaves and sets its In-Game-Name (IGN)
ModLoader.registerBlock(TutorialLeaves);
ModLoader.addName(TutorialLeaves, "Tree Tutorial Leaves");
ModLoader.RegisterBlock(TutorialSapling);
ModLoader.AddName(TutorialSapling, "Tree Tutorial Sapling");
//Adds the textures
Alex1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/wood.png");
Brandon1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/leaves.png");
}
//Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value)
public static final Block TutorialWood;
static
{
TutorialWood = (new BlockTutorialWood(250, 0).setBlockName("ANY_NAME_HERE!").setHardness(2F).setResistance(2F).setLightValue(0F));
}
//Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value)
public static final Block Brandon1;
static
{
TutorialLeaves = (new BlockTutorialLeaves(253, 0).setBlockName("ANY_NAME_HERE!").setHardness(1F).setResistance(1F).setLightValue(1F));
}
public static final Block TutorialSapling;
static
{
TutorialSapling = (new BlockTutorialSapling(126, ModLoader.addOverride("/terrain.png", "/tutorial/sapling.png"))).setHardness(0.1F).setStepSound(Block.soundWoodFootstep).setBlockName("Tree Tutorial Sapling");
}
//Same as the last tutorial, sets the Minecraft Version for the mod!
public String getVersion()
{
return "1.2.5";
}
//Makes it naturally generate (P.S: to change the biome in which it spawns, change BiomeGenDesert to what you want! Like BiomeGenForest)
//Biome Choices: Coming soon! All I know is Desert, Tiaga, and Forest XD
//the int il = chunkx + rand.nextInt(16);, the int jl = rand.nextInt(64);, and int kl = chunkz + rand.nextInt(16); are where it spawns in a chunk!
public void generateSurface(World world, Random rand, int chunkx, int chunkz)
{
for (int l = 0; l<45; l++)
{
int il = chunkx + rand.nextInt(16);
int jl = rand.nextInt(64);
int kl = chunkz + rand.nextInt(16);
}
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkx, chunkz);
WorldGenTutorial worldgentutorial = new WorldGenTutorial();
if(biome instanceof BiomeGenDesert)
{
for(int x = 0; x < 1; x++)
{
int Xcoord = chunkx + rand.nextInt(16);
int Zcoord = chunkz + rand.nextInt(16);
int i = world.getHeightValue(Xcoord, Zcoord);
tree.generate(world, rand, Xcoord, i, Zcoord);
}
}
}
public void load()
{
//Adds the Logs to Wooden planks recipe
ModLoader.addRecipe(new ItemStack (Block.planks, 4), (new Object[] {"W ", " ", " ", Character.valueOf('R'), mod_Tutorial.TutorialWood.blockID}));
}
}[/code] [/SPOILER]
BlockTutorialWood.java:
[SPOILER]
[code]package net.minecraft.src;
import java.util.Random;
public class BlockTutorialWood extends Block
{
protected BlockTutorialWood(int i, int j)
{
super(i, j, Material.wood);
baseIndexInPNG = j;
}
public int quantityDropped(Random random)
{
return 1;
}
public int idDropped(int i, Random random)
{
return mod_Tutorial.TutorialWood.blockID;
}
public int getBlockTextureFromSide(int i)
{
if(i == 1 || i == 0)
{
return 21;
} else
{
return baseIndexInPNG;
}
}
private int baseIndexInPNG;
}[/code]
[/SPOILER]
BlockTutorialLeaves.java:
[SPOILER]
[code]package net.minecraft.src;
import java.util.Random;
public class BlockTutorialLeaves extends BlockLeavesBase
{
protected BlockTutorialLeaves(int i, int j)
{
super(i, j, Material.leaves, false);
baseIndexInPNG = j;
setTickOnLoad(true);
}
public int idDropped(int i, Random random)
{
if(random.nextInt(3) == 0)
{
return mod_Tutorial.TutorialSapling.blockID;
} else
{
return -1;
}
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if (world.isRemote)
{
return;
}
int l = world.getBlockMetadata(i, j, k);
if ((l & 8) != 0 && (l & 4) == 0)
{
byte byte0 = 4;
int i1 = byte0 + 1;
byte byte1 = 32;
int j1 = byte1 * byte1;
int k1 = byte1 / 2;
if (adjacentTreeBlocks == null)
{
adjacentTreeBlocks = new int[byte1 * byte1 * byte1];
}
if (world.checkChunksExist(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1))
{
for (int l1 = -byte0; l1 <= byte0; l1++)
{
for (int k2 = -byte0; k2 <= byte0; k2++)
{
for (int i3 = -byte0; i3 <= byte0; i3++)
{
int k3 = world.getBlockId(i + l1, j + k2, k + i3);
if (k3 == mod_Tutorial.TutorialWood.blockID)
{
adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = 0;
continue;
}
if (k3 == mod_Tutorial.TutorialLeaves.blockID)
{
adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -2;
}
else
{
adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -1;
}
}
}
}
for (int i2 = 1; i2 <= 4; i2++)
{
for (int l2 = -byte0; l2 <= byte0; l2++)
{
for (int j3 = -byte0; j3 <= byte0; j3++)
{
for (int l3 = -byte0; l3 <= byte0; l3++)
{
if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] != i2 - 1)
{
continue;
}
if (adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2)
{
adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2;
}
if (adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2)
{
adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2;
}
if (adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] == -2)
{
adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] = i2;
}
if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] == -2)
{
adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] = i2;
}
if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] == -2)
{
adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] = i2;
}
if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] == -2)
{
adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] = i2;
}
}
}
}
}
}
int j2 = adjacentTreeBlocks[k1 * j1 + k1 * byte1 + k1];
if (j2 >= 0)
{
world.setBlockMetadata(i, j, k, l & -9);
}
else
{
removeLeaves(world, i, j, k);
}
}
}
private void removeLeaves(World world, int i, int j, int k)
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
}
public int quantityDropped(Random random)
{
return random.nextInt(5) != 0 ? 0 : 1; //1 / # = chance | EX: 2 = 50% chance (1/2 = .5 chance)
//Random from 0 - (#-1)
//if the random number = 0
//drops 1 item
}
public int idDropped(int i, Random random, int j)
{
if(random.nextInt(5) == 0)
return Item.appleRed.shiftedIndex;
return mod_Tutorial.TutorialSapling.blockID; // Your fruit of choice //
//return Block.sapling.blockID;
}
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
if(!world.multiplayerWorld && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
{
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
dropBlockAsItem_do(world, i, j, k, new ItemStack(mod_Tutorial.TutorialLeaves.blockID, 1, l & 3)); //////Leaf/////////
} else
{
super.harvestBlock(world, entityplayer, i, j, k, l);
}
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, i1);
if (!world.multiplayerWorld && (l & 3) == 0 && world.rand.nextInt(200) == 0)
{
dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.appleRed, 1, 0));
}
}
public boolean isOpaqueCube()
{
return false;
}
public void onEntityWalking(World world, int i, int j, int k, Entity entity)
{
super.onEntityWalking(world, i, j, k, entity);
}
int adjacentTreeBlocks[];
private int baseIndexInPNG;
}[/code]
[/SPOILER]
BlockTutorialSapling.java:
[SPOILER]
[code]package net.minecraft.src;
import java.util.Random;
public class BlockTutorialSapling extends BlockFlower
{
protected BlockTutorialSapling(int i, int j)
{
super(i, j);
float f = 0.4F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.multiplayerWorld)
{
return;
}
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(25) == 0)
{
int l = world.getBlockMetadata(i, j, k);
if((l & 8) == 0)
{
world.setBlockMetadataWithNotify(i, j, k, l | 8);
} else
{
growTree(world, i, j, k, random);
}
}
}
public void growTree(World world, int i, int j, int k, Random random)
{
int l = world.getBlockMetadata(i, j, k) & 3;
world.setBlock(i, j, k, 0);
Object obj = null;
if(l == 1)
{
obj = new WorldGenTaiga2(true);
} else
if(l == 2)
{
obj = new WorldGenForest(true);
}
else
{
obj = new WorldGenTutorial();
if (random.nextInt(10) == 0)
{
obj = new WorldGenBigTree(true);
}
}
if (!((WorldGenerator) (obj)).generate(world, random, i, j, k))
{
world.setBlockAndMetadata(i, j, k, blockID, l);
}
}
public int idDropped(int i, Random random)
{
return mod_Tutorial.TutorialSapling.blockID;
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
ItemStack equipped = entityplayer.getCurrentEquippedItem();
if (equipped == null)
{
return false;
}
if ((equipped.getItem() == Item.dyePowder) && (equipped.getItemDamage() == 15)) //if bone meal
{
growTree(world, i, j, k, world.rand);
equipped.stackSize -= 1;
}
return false;
}
}[/code]
[/SPOILER]
WorldGenTutorial.java:
[SPOILER]
[code]package net.minecraft.src;
import java.util.Random;
public class WorldGenTutorial extends WorldGenerator
{
public WorldGenTutorial()
{
}
public boolean generate(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(3) + 4;
boolean flag = true;
if (j < 1 || j + l + 1 > world.worldHeight)
{
return false;
}
for (int i1 = j; i1 <= j + 1 + l; i1++)
{
byte byte0 = 1;
if (i1 == j)
{
byte0 = 0;
}
if (i1 >= (j + 1 + l) - 2)
{
byte0 = 2;
}
for (int i2 = i - byte0; i2 <= i + byte0 && flag; i2++)
{
for (int l2 = k - byte0; l2 <= k + byte0 && flag; l2++)
{
if (i1 >= 0 && i1 < world.worldHeight)
{
int j3 = world.getBlockId(i2, i1, l2);
if (j3 != 0 && j3 != mod_Tutorial.TutorialLeaves.blockID)
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
int j1 = world.getBlockId(i, j - 1, k);
if (j1 != Block.grass.blockID && j1 != Block.dirt.blockID || j >= world.worldHeight - l - 1)
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID);
for (int k1 = (j - 3) + l; k1 <= j + l; k1++)
{
int j2 = k1 - (j + l);
int i3 = 1 - j2 / 2;
for (int k3 = i - i3; k3 <= i + i3; k3++)
{
int l3 = k3 - i;
for (int i4 = k - i3; i4 <= k + i3; i4++)
{
int j4 = i4 - k;
if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)])
{
world.setBlockAndMetadata(k3, k1, i4, mod_YourTree.YourLeaves.blockID, 3);
}
}
}
}
for (int l1 = 0; l1 < l; l1++)
{
int k2 = world.getBlockId(i, j + l1, k);
if (k2 == 0 || k2 == Block.leaves.blockID)
{
world.setBlockAndMetadata(i, j + l1, k, mod_Tutorial.Tutorial.blockID, 3);
}
}
return true;
}
}[/code]
[/SPOILER] [/SPOILER]
Now, for PARTICLES!!!!:
[SPOILER]
[code]worldObj.spawnParticle("reddust", posX, posY, posZ, 0.0D /*red*/, 1.0D /*green*/, 0.0D /*blue*/);[/code]
List of particle names:
[spoiler]
[code]largesmoke
portal
reddust
largeexplode (like shearing mooshrooms)
explode (when a mob dies)
largeexplosion (a bunch of largeexplode particles)
note
bubble
flame
crit
smoke (torches)
heart
splash
snowballpoof (thanks BlueberryKush!)
suspended(thanks GrygrFlzr for the rest)
depthsuspend
townaura
magicCrit
mobSpell
spell
instantSpell
enchantmenttable
lava
footstep
cloud
dripLava
dripWater
snowshovel
slime
iconcrack_ (after the underscore, put an item's id)
tilecrack_ (same here, except with block ids)[/code]
[/spoiler]
[/spoiler]
Colored names!!!:
[spoiler]
Its all in the ModLoader.addName!:
[spoiler]
[code]ModLoader.addName([NAME HERE], "\u00a7{COLOR}[INGAMENAME]");[/code]
[/spoiler]
Here are the various colors: (change the '{COLOR}')
[spoiler]
[code]a - light green
b - light blue
c - light red
d - pink
e - yellow
f - white
1 - blue
2 - green
3 - teal
4 - red
5 - purple
6 - orange
7 - light gray
8 - dark gray
9 - water blue
0 - black[/code]
[/spoiler]
[/spoiler]
An NPC!:
[spoiler]
mod_Tutorial:
[spoiler]
[code]package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Random;
public class mod_Tutorial extends BaseMod
{
public mod_Tutorial()
{
//Registers the NPC
ModLoader.registerEntityID(EntityTutorial.class, "{IGN}", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityTutorial.class, 8, 4, 10, EnumCreatureType.monster);
//EnumCreatureType can do monster, mob, creature
}
public void addRenderer(Map map)
{
map.put(EntityTutorial.class, new RenderBiped(new ModelBiped(), 0.5F)); //Makes it spawn
}
public String getVersion()
{
return "1.2.5";
}
}[/code]
[/spoiler]
EntityTutorial:
[spoiler]
[code]
package net.minecraft.src;
public class EntityTutorial extends EntityMob //EntityMob, EntityLiving, and more coming soon!
{
public EntityTutorial(World world)
{
super(world);
texture = "/dm/mobs/dm_mob.png"; //The texture, the same as a player skin
moveSpeed = 0.3F; //ow fast does it move
attackStrength = 4; //Half a heart per 1, so 2 hearts each
isImmuneToFire = true; //Can it be like a Zombie Pigman? (fireproof)
}
public void load()
{
}
public int getMaxHealth()
{
return 20; //Each is half a heart, so this is twice the player's health
}
protected int getDropItemId()
{
return Item.bone.shiftedIndex; //What does it drop when it dies?
}
protected boolean isAIEnabled()
{
return true; //Use the new AI?
}
public boolean canBreatheUnderwater()
{
return true; //Can it breathe underwater?
}
protected boolean canDespawn()
{
return true; //Can it despawn?
}
public void onEntityDeath()
{
//Tutorial for this coming soon!
}
}
[/spoiler]
Was that so hard? Nope! These tutorials are all thanks to weeks of work, and I wanted to pass on the legacy of MC modding
Special Thanks to:
Alexbegt - Thanks for the code to make the sapling able to be bone-mealed!
senpaisubaraki - Thanks for the Tree tutorial suggestion!
Creeperass - Thanks for the idea for A Sugar-cane like plant idea! I will work on it when I can!
More tutorials coming soon...
For more help, here is how to communicate with me:
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Don't forget the code i posted if you want it to grow with bonemeal
Okay I'll add it
-DM
Rollback Post to RevisionRollBack
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
I wouldn't copy and paste, because I like to actually learn what the stuff does (I already know how to mod, though), you should tell the people what everything does, 'cause if they wanna do it again, but change some settings, they won't know what to change.
Especially on the WorldGenTutorial, you didn't say what ANY of that stuff did. And world gen is usually what people want to change.
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Alright, if anyone can fix these errors(They are errors I have never seen before), they are a boss and they get the pre-release of the MoreFun mod I am making:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/BlockTrampoline.java:8: cannot find symbol
symbol : constructor Block()
location: class net.minecraft.src.Block
{
^
src/minecraft/net/minecraft/src/BlockTrampoline.java:17: incompatible types
found : java.lang.String
required: int
return "morefun/trampoline.png";
^
src/minecraft/net/minecraft/src/ItemGrenade.java:20: cannot find symbol
symbol : method entityJoinedWorld(net.minecraft.src.EntityGrenade)
location: class net.minecraft.src.World
world.entityJoinedWorld(new EntityGrenade(world, entityplayer));
^
src/minecraft/net/minecraft/src/mod_FunMain.java:29: cannot find symbol
symbol : constructor BlockTrampoline(int,int)
location: class net.minecraft.src.BlockTrampoline
BlockTrampoline = (new BlockTrampoline(249, 0).setBlockName("More Fun: Trampoline").setHardness(2F).setResistance(0F).setLightValue(1F));
^
src/minecraft/net/minecraft/src/mod_FunMain.java:39: cannot find symbol
symbol : constructor ItemStack(int,int)
location: class net.minecraft.src.ItemStack
ModLoader.addRecipe(new ItemStack (mod_FunMain.BlockTrampoline.blockID, 2), (new Object[] {" ", "SWS", "III", Character.valueOf('S'), mod_FunMain.ItemSpring.shiftedIndex, Character.valueOf('W'), Block.cloth, Character.valueOf('I'), Item.ingotIron.shiftedIndex}));
^
src/minecraft/net/minecraft/src/EntityGrenade.java:94: cannot find symbol
symbol : method attackEntityFrom(net.minecraft.src.Entity,int)
location: class net.minecraft.src.EntityItem
super.attackEntityFrom(entity, i);
^
6 errors
==================
Rollback Post to RevisionRollBack
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
I actually don't know how to yet
As soon as I know how to, it'll be up in the list!
Rollback Post to RevisionRollBack
Eons ago, there was only void. Then came the big bang. Voxels colliding with voxels, cubes with cubes. Blocks were forming, each texture unique from the rest. That was when our universe was born.
Okay, so these short tutorials will show you how to make:
I test these mods myself before posting, so if you get errors, please let me know!
Required files:
MCP: http://www.mediafire...c6liau295225253
Modloader: http://adf.ly/1849S
A brain xD
Here is for the first tutorial (Block & item):
[SPOILER]
the mod_Tutorial.java file:
[SPOILER]
[code]package net.minecraft.src; import java.lang.reflect.Method; import java.util.Random; public class mod_Tutorial extends BaseMod { public mod_Tutorial() { //Registers the Block (You need to put something in between these brackets!) ModLoader.registerBlock(BlockTutorial); ModLoader.addName(BlockTutorial, "Tutorial Block"); //Adds the texture to the block BlockTutorial.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block.png"); } //Creates the item and its properties (Image, Name, Item ID) public static final Item ItemTutorial; static { ItemTutorial = (new ItemTutorial(9999).setIconIndex(ModLoader.addOverride("/gui/items.png", "/tutorial/item.png")).setItemName("Tutorial Item")); } //Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value) public static final Block BlockTutorial; static { BlockTutorial = (new BlockTutorial(250, 0).setBlockName("Tutorial Block").setHardness(0F).setResistance(6000F).setLightValue(1F)); } //Mod version (To update the mod, change this to minecraft version :) ) public String getVersion() { return "1.2.5"; } public void load() { ModLoader.addName(BlockTutorial, "Tutorial Block"); ModLoader.addName(ItemTutorial, "Tutorial Item"); ModLoader.addRecipe(new ItemStack (BlockTutorial, 1), (new Object[] {"RRR", "RRR", "RRR", Character.valueOf('R'), Item.bone})); ModLoader.addRecipe(new ItemStack (ItemTutorial, 9), (new Object[] {" B", " B ", "S ", Character.valueOf('B'), BlockTutorial, Character.valueOf('S'), Item.stick})); } }[/code]
[/SPOILER]
Now we'll do the BlockTutorial.java:
[SPOILER]
[code]package net.minecraft.src; import java.util.*; public class BlockTutorial extends Block { protected BlockTutorial (int i, int j) { super(i ,j, Material.glass); } //Un-comment to add contact damage // public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) // { // par5Entity.attackEntityFrom(DamageSource.cactus, 1); // } //Un-comment to be able to walk through it // public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) // { // return null; // } //Un-comment to use it like a redstone torch (It powers redstone) // public boolean renderAsNormalBlock() // { // return false; // } // public boolean isPoweringTo(IBlockAccess iblockaccess, int x, int y, int z, int l) // { // return l > 1; // } // public boolean isIndirectlyPoweringTo(World world, int x, int y, int z, int l) // { // return l == 1; // } }[/code]
[/SPOILER]
And finally, the ItemTutorial.java file:
[SPOILER]
[code]package net.minecraft.src; public class ItemTutorial extends Item { protected ItemTutorial(int i) { super(i); } public boolean hasEffect(ItemStack itemstack) { return true; } public EnumRarity getRarity(ItemStack itemstack) { return EnumRarity.epic; } }[/code]
[/SPOILER]
[/SPOILER]
Now a Tree w/ a sapling!(Thanks to senpaisubaraki for the idea ):
[SPOILER]
First off, let me tell you that this one is NOT that easy!
You need to make three blocks: The Wood, The Sapling, and The Leaves.
This is a 5-file process! That is as much as a dimension, but THAT has a LOT more code
Now, for the mod_Tutorial:
[SPOILER]
[code]package net.minecraft.src; import java.util.Random; public class mod_Tutorial extends BaseMod { public mod_Tutorial() { //Registers the Wood and sets its In-Game-Name (IGN) ModLoader.registerBlock(TutorialWood); ModLoader.addName(TutorialWood, "Tree Tutorial Wood"); //Registers the Leaves and sets its In-Game-Name (IGN) ModLoader.registerBlock(TutorialLeaves); ModLoader.addName(TutorialLeaves, "Tree Tutorial Leaves"); ModLoader.RegisterBlock(TutorialSapling); ModLoader.AddName(TutorialSapling, "Tree Tutorial Sapling"); //Adds the textures Alex1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/wood.png"); Brandon1.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/leaves.png"); } //Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value) public static final Block TutorialWood; static { TutorialWood = (new BlockTutorialWood(250, 0).setBlockName("ANY_NAME_HERE!").setHardness(2F).setResistance(2F).setLightValue(0F)); } //Creates the blocks and adds its properties (ID, Name, How long it takes to break, Explosion Resistance, glowing value) public static final Block Brandon1; static { TutorialLeaves = (new BlockTutorialLeaves(253, 0).setBlockName("ANY_NAME_HERE!").setHardness(1F).setResistance(1F).setLightValue(1F)); } public static final Block TutorialSapling; static { TutorialSapling = (new BlockTutorialSapling(126, ModLoader.addOverride("/terrain.png", "/tutorial/sapling.png"))).setHardness(0.1F).setStepSound(Block.soundWoodFootstep).setBlockName("Tree Tutorial Sapling"); } //Same as the last tutorial, sets the Minecraft Version for the mod! public String getVersion() { return "1.2.5"; } //Makes it naturally generate (P.S: to change the biome in which it spawns, change BiomeGenDesert to what you want! Like BiomeGenForest) //Biome Choices: Coming soon! All I know is Desert, Tiaga, and Forest XD //the int il = chunkx + rand.nextInt(16);, the int jl = rand.nextInt(64);, and int kl = chunkz + rand.nextInt(16); are where it spawns in a chunk! public void generateSurface(World world, Random rand, int chunkx, int chunkz) { for (int l = 0; l<45; l++) { int il = chunkx + rand.nextInt(16); int jl = rand.nextInt(64); int kl = chunkz + rand.nextInt(16); } BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkx, chunkz); WorldGenTutorial worldgentutorial = new WorldGenTutorial(); if(biome instanceof BiomeGenDesert) { for(int x = 0; x < 1; x++) { int Xcoord = chunkx + rand.nextInt(16); int Zcoord = chunkz + rand.nextInt(16); int i = world.getHeightValue(Xcoord, Zcoord); tree.generate(world, rand, Xcoord, i, Zcoord); } } } public void load() { //Adds the Logs to Wooden planks recipe ModLoader.addRecipe(new ItemStack (Block.planks, 4), (new Object[] {"W ", " ", " ", Character.valueOf('R'), mod_Tutorial.TutorialWood.blockID})); } }[/code]
[/SPOILER]
BlockTutorialWood.java:
[SPOILER]
[code]package net.minecraft.src; import java.util.Random; public class BlockTutorialWood extends Block { protected BlockTutorialWood(int i, int j) { super(i, j, Material.wood); baseIndexInPNG = j; } public int quantityDropped(Random random) { return 1; } public int idDropped(int i, Random random) { return mod_Tutorial.TutorialWood.blockID; } public int getBlockTextureFromSide(int i) { if(i == 1 || i == 0) { return 21; } else { return baseIndexInPNG; } } private int baseIndexInPNG; }[/code]
[/SPOILER]
BlockTutorialLeaves.java:
[SPOILER]
[code]package net.minecraft.src; import java.util.Random; public class BlockTutorialLeaves extends BlockLeavesBase { protected BlockTutorialLeaves(int i, int j) { super(i, j, Material.leaves, false); baseIndexInPNG = j; setTickOnLoad(true); } public int idDropped(int i, Random random) { if(random.nextInt(3) == 0) { return mod_Tutorial.TutorialSapling.blockID; } else { return -1; } } public void updateTick(World world, int i, int j, int k, Random random) { if (world.isRemote) { return; } int l = world.getBlockMetadata(i, j, k); if ((l & 8) != 0 && (l & 4) == 0) { byte byte0 = 4; int i1 = byte0 + 1; byte byte1 = 32; int j1 = byte1 * byte1; int k1 = byte1 / 2; if (adjacentTreeBlocks == null) { adjacentTreeBlocks = new int[byte1 * byte1 * byte1]; } if (world.checkChunksExist(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) { for (int l1 = -byte0; l1 <= byte0; l1++) { for (int k2 = -byte0; k2 <= byte0; k2++) { for (int i3 = -byte0; i3 <= byte0; i3++) { int k3 = world.getBlockId(i + l1, j + k2, k + i3); if (k3 == mod_Tutorial.TutorialWood.blockID) { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = 0; continue; } if (k3 == mod_Tutorial.TutorialLeaves.blockID) { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -2; } else { adjacentTreeBlocks[(l1 + k1) * j1 + (k2 + k1) * byte1 + (i3 + k1)] = -1; } } } } for (int i2 = 1; i2 <= 4; i2++) { for (int l2 = -byte0; l2 <= byte0; l2++) { for (int j3 = -byte0; j3 <= byte0; j3++) { for (int l3 = -byte0; l3 <= byte0; l3++) { if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] != i2 - 1) { continue; } if (adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[((l2 + k1) - 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } if (adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1 + 1) * j1 + (j3 + k1) * byte1 + (l3 + k1)] = i2; } if (adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + ((j3 + k1) - 1) * byte1 + (l3 + k1)] = i2; } if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1 + 1) * byte1 + (l3 + k1)] = i2; } if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + ((l3 + k1) - 1)] = i2; } if (adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] == -2) { adjacentTreeBlocks[(l2 + k1) * j1 + (j3 + k1) * byte1 + (l3 + k1 + 1)] = i2; } } } } } } int j2 = adjacentTreeBlocks[k1 * j1 + k1 * byte1 + k1]; if (j2 >= 0) { world.setBlockMetadata(i, j, k, l & -9); } else { removeLeaves(world, i, j, k); } } } private void removeLeaves(World world, int i, int j, int k) { dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0); world.setBlockWithNotify(i, j, k, 0); } public int quantityDropped(Random random) { return random.nextInt(5) != 0 ? 0 : 1; //1 / # = chance | EX: 2 = 50% chance (1/2 = .5 chance) //Random from 0 - (#-1) //if the random number = 0 //drops 1 item } public int idDropped(int i, Random random, int j) { if(random.nextInt(5) == 0) return Item.appleRed.shiftedIndex; return mod_Tutorial.TutorialSapling.blockID; // Your fruit of choice // //return Block.sapling.blockID; } public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) { if(!world.multiplayerWorld && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) { entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1); dropBlockAsItem_do(world, i, j, k, new ItemStack(mod_Tutorial.TutorialLeaves.blockID, 1, l & 3)); //////Leaf///////// } else { super.harvestBlock(world, entityplayer, i, j, k, l); } } public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1) { super.dropBlockAsItemWithChance(world, i, j, k, l, f, i1); if (!world.multiplayerWorld && (l & 3) == 0 && world.rand.nextInt(200) == 0) { dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.appleRed, 1, 0)); } } public boolean isOpaqueCube() { return false; } public void onEntityWalking(World world, int i, int j, int k, Entity entity) { super.onEntityWalking(world, i, j, k, entity); } int adjacentTreeBlocks[]; private int baseIndexInPNG; }[/code]
[/SPOILER]
BlockTutorialSapling.java:
[SPOILER]
[code]package net.minecraft.src; import java.util.Random; public class BlockTutorialSapling extends BlockFlower { protected BlockTutorialSapling(int i, int j) { super(i, j); float f = 0.4F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); } public void updateTick(World world, int i, int j, int k, Random random) { if(world.multiplayerWorld) { return; } super.updateTick(world, i, j, k, random); if(world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(25) == 0) { int l = world.getBlockMetadata(i, j, k); if((l & 8) == 0) { world.setBlockMetadataWithNotify(i, j, k, l | 8); } else { growTree(world, i, j, k, random); } } } public void growTree(World world, int i, int j, int k, Random random) { int l = world.getBlockMetadata(i, j, k) & 3; world.setBlock(i, j, k, 0); Object obj = null; if(l == 1) { obj = new WorldGenTaiga2(true); } else if(l == 2) { obj = new WorldGenForest(true); } else { obj = new WorldGenTutorial(); if (random.nextInt(10) == 0) { obj = new WorldGenBigTree(true); } } if (!((WorldGenerator) (obj)).generate(world, random, i, j, k)) { world.setBlockAndMetadata(i, j, k, blockID, l); } } public int idDropped(int i, Random random) { return mod_Tutorial.TutorialSapling.blockID; } public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { ItemStack equipped = entityplayer.getCurrentEquippedItem(); if (equipped == null) { return false; } if ((equipped.getItem() == Item.dyePowder) && (equipped.getItemDamage() == 15)) //if bone meal { growTree(world, i, j, k, world.rand); equipped.stackSize -= 1; } return false; } }[/code]
[/SPOILER]
WorldGenTutorial.java:
[SPOILER]
[code]package net.minecraft.src; import java.util.Random; public class WorldGenTutorial extends WorldGenerator { public WorldGenTutorial() { } public boolean generate(World world, Random random, int i, int j, int k) { int l = random.nextInt(3) + 4; boolean flag = true; if (j < 1 || j + l + 1 > world.worldHeight) { return false; } for (int i1 = j; i1 <= j + 1 + l; i1++) { byte byte0 = 1; if (i1 == j) { byte0 = 0; } if (i1 >= (j + 1 + l) - 2) { byte0 = 2; } for (int i2 = i - byte0; i2 <= i + byte0 && flag; i2++) { for (int l2 = k - byte0; l2 <= k + byte0 && flag; l2++) { if (i1 >= 0 && i1 < world.worldHeight) { int j3 = world.getBlockId(i2, i1, l2); if (j3 != 0 && j3 != mod_Tutorial.TutorialLeaves.blockID) { flag = false; } } else { flag = false; } } } } if (!flag) { return false; } int j1 = world.getBlockId(i, j - 1, k); if (j1 != Block.grass.blockID && j1 != Block.dirt.blockID || j >= world.worldHeight - l - 1) { return false; } world.setBlock(i, j - 1, k, Block.dirt.blockID); for (int k1 = (j - 3) + l; k1 <= j + l; k1++) { int j2 = k1 - (j + l); int i3 = 1 - j2 / 2; for (int k3 = i - i3; k3 <= i + i3; k3++) { int l3 = k3 - i; for (int i4 = k - i3; i4 <= k + i3; i4++) { int j4 = i4 - k; if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)]) { world.setBlockAndMetadata(k3, k1, i4, mod_YourTree.YourLeaves.blockID, 3); } } } } for (int l1 = 0; l1 < l; l1++) { int k2 = world.getBlockId(i, j + l1, k); if (k2 == 0 || k2 == Block.leaves.blockID) { world.setBlockAndMetadata(i, j + l1, k, mod_Tutorial.Tutorial.blockID, 3); } } return true; } }[/code]
[/SPOILER]
[/SPOILER]
Now, for PARTICLES!!!!:
[SPOILER]
[code]worldObj.spawnParticle("reddust", posX, posY, posZ, 0.0D /*red*/, 1.0D /*green*/, 0.0D /*blue*/);[/code]
List of particle names:
[spoiler]
[code]largesmoke portal reddust largeexplode (like shearing mooshrooms) explode (when a mob dies) largeexplosion (a bunch of largeexplode particles) note bubble flame crit smoke (torches) heart splash snowballpoof (thanks BlueberryKush!) suspended(thanks GrygrFlzr for the rest) depthsuspend townaura magicCrit mobSpell spell instantSpell enchantmenttable lava footstep cloud dripLava dripWater snowshovel slime iconcrack_ (after the underscore, put an item's id) tilecrack_ (same here, except with block ids)[/code]
[/spoiler]
[/spoiler]
Colored names!!!:
[spoiler]
Its all in the ModLoader.addName!:
[spoiler]
[code]ModLoader.addName([NAME HERE], "\u00a7{COLOR}[INGAMENAME]");[/code]
[/spoiler]
Here are the various colors: (change the '{COLOR}')
[spoiler]
[code]a - light green b - light blue c - light red d - pink e - yellow f - white 1 - blue 2 - green 3 - teal 4 - red 5 - purple 6 - orange 7 - light gray 8 - dark gray 9 - water blue 0 - black[/code]
[/spoiler]
[/spoiler]
An NPC!:
[spoiler]
mod_Tutorial:
[spoiler]
[code]package net.minecraft.src; import java.lang.reflect.Method; import java.util.Map; import java.util.Random; public class mod_Tutorial extends BaseMod { public mod_Tutorial() { //Registers the NPC ModLoader.registerEntityID(EntityTutorial.class, "{IGN}", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(EntityTutorial.class, 8, 4, 10, EnumCreatureType.monster); //EnumCreatureType can do monster, mob, creature } public void addRenderer(Map map) { map.put(EntityTutorial.class, new RenderBiped(new ModelBiped(), 0.5F)); //Makes it spawn } public String getVersion() { return "1.2.5"; } }[/code]
[/spoiler]
EntityTutorial:
[spoiler]
[code]
package net.minecraft.src;
public class EntityTutorial extends EntityMob //EntityMob, EntityLiving, and more coming soon!
{
public EntityTutorial(World world)
{
super(world);
texture = "/dm/mobs/dm_mob.png"; //The texture, the same as a player skin
moveSpeed = 0.3F; //ow fast does it move
attackStrength = 4; //Half a heart per 1, so 2 hearts each
isImmuneToFire = true; //Can it be like a Zombie Pigman? (fireproof)
}
public void load()
{
}
public int getMaxHealth()
{
return 20; //Each is half a heart, so this is twice the player's health
}
protected int getDropItemId()
{
return Item.bone.shiftedIndex; //What does it drop when it dies?
}
protected boolean isAIEnabled()
{
return true; //Use the new AI?
}
public boolean canBreatheUnderwater()
{
return true; //Can it breathe underwater?
}
protected boolean canDespawn()
{
return true; //Can it despawn?
}
public void onEntityDeath()
{
//Tutorial for this coming soon!
}
}
[/spoiler]
Was that so hard? Nope! These tutorials are all thanks to weeks of work, and I wanted to pass on the legacy of MC modding
Special Thanks to:
Alexbegt - Thanks for the code to make the sapling able to be bone-mealed!
senpaisubaraki - Thanks for the Tree tutorial suggestion!
Creeperass - Thanks for the idea for A Sugar-cane like plant idea! I will work on it when I can!
More tutorials coming soon...
For more help, here is how to communicate with me:
You copy and paste.
Use MCP:
http://www.mediafire.com/?c6liau295225253
I just learned how. So Time to make a tree!
Grow an item? What do you mean?
Like a sugar cane but instead make that grow higher and drop item when harvesting
Okay I'll add it
-DM
Youtube:http://www.youtube.com/user/TheKontrollerz?ob=0
You HAVE to create the .java files, then copy-and-paste into the files.
Yes, I'm working on making //comments to it
I don't have a screen recording program 3:
I will work on it as soon as I can!
They are not.
I'll add that to the tutorial as soon as I canOh, and anyone who can fix this error gets a spot on this post:
Current MCP 62 error:
'"java" -jar runtime/bin/mcinjector.jar temp/minecraft_rg.jar temp/minecraft_exc.jar conf/client.exc ...' failed : 1
I actually don't know how to yet
As soon as I know how to, it'll be up in the list!