• 1

    posted a message on [1.6.2] ChickensBallz's Beginner - Advanced Forge Modding Tutorial ~ [SRC Included]
    DISCONTINUED

    For the basic set up, take a look over at fisherman77's guide!

    :Iron: = Easy
    :GoldBar: = Normal
    :Diamond: = Advanced

    Basic Block :Iron:
    Lets make a basic block first! We will make Copper Ore as our first block!


    Main Class
    package chickensballz.Tutorial.common; //the package
    
    import net.minecraft.block.Block; //Imports that you will need
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.Mod.PreInit;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.network.NetworkRegistry;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
    import cpw.mods.fml.common.SidedProxy;
    import chickensballz.MoAdventure.common.TutorialModCommonProxy;
    import chickensballz.MoAdventure.common.blocks.BlockCopperOre; //change this to your block
    import chickensballz.MoAdventure.common.handlers.MoAdventureClientPacketHandler;
    import chickensballz.MoAdventure.common.handlers.MoAdventureServerPacketHandler;
    
    @NetworkMod(clientSideRequired=true,serverSideRequired=true,
    clientPacketHandlerSpec = @SidedPacketHandler(channels = {"NameoftheMod"}, packetHandler = MoAdventureClientPacketHandler.class),
    serverPacketHandlerSpec = @SidedPacketHandler(channels = {"NameoftheMod"}, packetHandler = MoAdventureServerPacketHandler.class))
    
    @Mod(modid="Name",name="Name",version="Version of the mod")
    
    public class TutorialMod {
    
    @Instance("Name") //The instance
    
    public static TutorialMod instance = new TutorialMod();
    
    @SidedProxy(clientSide = "chickensballz.Tutorial.client.TutorialModClientProxy", serverSide = "chickensballz.common.TutorialModCommonProxy")
    
    public static MoAdventureCommonProxy proxy;
    
    public static Block CopperOre;
    
    @PreInit
    public void PreInit(FMLPreInitializationEvent e){
    
    CopperOre = new BlockCopperOre(3800).setHardness(3.0F).setResistance(10.0F).setUnlocalizedName("copperOre").setCreativeTab(CreativeTabs.tabBlock); //Hardness = How long it takes to break the block, Resistance = Resistance to explosion, UnlocalizedName = needed for texture and other stuff.
    
    @Init
    public void InitTutorialMod(FMLInitializationEvent event){
    
    proxy.registerBlocks();
    
    NetworkRegistry.instance().registerGuiHandler(this, proxy);
    
    }
    }


    BlockCopperOre
    package chickensballz.Tutorial.common.blocks; //package
    
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockFlower;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IconRegister; //imports that you will need
    
    public class BlockCopperOre extends Block
    {
    		public BlockCopperOre(int par1)
    		{
    				super(par1, Material.rock); //The material of the block
    		}
    		public void registerIcons(IconRegister iconRegister)
    		{
    						 blockIcon = iconRegister.registerIcon("folder:UnlocalizedNameHere"); //texture
    		}
    }


    CommonProxy
    package chickensballz.Tutorial.common; //package
    
    import net.minecraft.block.Block;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.world.World;
    import cpw.mods.fml.common.network.IGuiHandler;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry; //list of imports you will need
    
    public class TutorialModCommonProxy implements IGuiHandler{ //DO NOT CHANGE ANYTHING EXCEPT ITS NAME
    public void registerRenderInformation()
    {
    }
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    return null;
    }
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    return null;
    }
    
    public void registerTiles(){
    }
    
    public void registerBlocks(){
    GameRegistry.registerBlock(TutorialMod.CopperOre, "copperOre"); //name
    LanguageRegistry.addName(TutorialMod.CopperOre, "Copper Ore "); //in-game name
    }
    
    public void registerItems(){
    
    }
    }

    Basic Item :Iron:
    Copper Ore without Copper Ingot is stupid! Let's make Copper Ingot now!

    Main Class

    Add this
    public static Item CopperIngot;
    under
    public static TutorialModCommonProxy proxy;


    Add this under PreInit
    CopperIngot = new ItemCopperIngot(ItemID).setCreativeTab(CreativeTabs.tabMaterials);


    Common Proxy

    Add this!
    GameRegistry.registerItem(TutorialMod..CopperIngot, "copperIngot"); //name
    LanguageRegistry.addName(TutorialMod.CopperIngot, "Copper Ingot"); //In-game name


    ItemCopperIngot

    package chickensballz.Tutorial.common.items; //package
    
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.Icon;
    
    public class ItemCopperIngot extends Item {
    
    private Icon iconIndex;
    
    public ItemCopperIngot(int id) {
    super(id);
    
    maxStackSize = 64;
    }
    
    public void registerIcons(IconRegister reg) {
    
    this.itemIcon = reg.registerIcon("folder:UnlocalizedName");
    }
    
    }

    Crafting and Smelting Recipe :Iron:
    Crafting and Smelting Recipe will be coded in the CommonProxy.

    Imports you will need.
    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.item.crafting.FurnaceRecipes;


    Crafting Recipe
    GameRegistry.addRecipe(new ItemStack (Item.diamond, 1), new Object []{" X ", " X ", " a ", 'X', Block.dirt, 'a', Item.stick});

    The Recipe will be like this = Empty :soil: Empty
    ================== Empty :soil: Empty
    ================== Empty :|: Empty = :Diamond:

    Smelting Recipe
    FurnaceRecipes.smelting().addSmelting(Block.dirt.blockID, new ItemStack(Item.diamond, 1, 0), 0.1f);

    The Recipe will be like this = :soil: -> :Diamond:

    Texture :Iron:
    blockIcon = iconRegister.registerIcon("folder:UnlocalizedNameHere");

    This is the code from my BlockCopperOre. Now, how do you do textures?
    ("folder:UnlocalizedNameHere")
    folder is the name of the folder, UnlocalizedName is the name of the texture. THE TEXTURE MUST BE A PNG PICTURE. For example if I used
    blockIcon = iconRegister.registerIcon("ChickensBallz:copperOre")
    I will have to create a new folder in /forge/mcp/eclipse/Minecraft/bin called assets. inside the assets folder, you will have to create a new folder called ChickensBallz, then, inside THAT folder, create a new folder called textures, then, in the texture folder, create 2 folders called blocks and items. Finally, you can put your textures there.

    Enchanted Effect on Items :Iron:
    This is really easy, first, open your ItemClass and add this
    public boolean hasEffect(ItemStack par1ItemStack) {
    return true;

    Change true to false if you don't want the enchanted effect.

    Here is the final code.
    package chickensballz.Tutorial.common;
    
    import chickensballz.Tutorial.common.TutorialMod;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.item.EnumRarity;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.ItemSword;
    
    public class ItemCopperSword extends ItemSword{
    
    public ItemCopperSword(int par1, EnumToolMaterial par2EnumToolMaterial) {
    super(par1, par2EnumToolMaterial);
    
    }
    private EnumToolMaterial material;
    
    public void registerIcons(IconRegister iconRegister) {
    itemIcon = iconRegister.registerIcon("tutorialmod:copperSword");
    }
    public boolean hasEffect(ItemStack par1ItemStack) {
    return false;
    }
    }


    Tools tutorial coming soon?

    Extended Tool Tips for Items :Iron:
    Add this into your itemclass
    public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean i)
    {
    list.add("\u00A76Copper is good <3");


    Result
    Change the 6 in
    \u00A76
    to other for other cool color/effects!

    0 - Black
    1 - Dark Blue
    2 - Dark Green
    3 - Cyan
    4 - Dark Red
    5 - Purple
    6 - Gold
    7 - Gray
    8 - Dark Gray
    9 - Blue
    a - Green
    b - Aqua
    c - Red
    d - Pink
    e - Yellow
    f - White

    Format Code -

    k - Random Stuffs
    l - Bold
    m - Strikethrough
    n - Underline

    o - Italic

    Block Generation :GoldBar:
    In this tutorial, I am going to make my Copper Ore spawn naturally.

    Make a new class called CopperOreWorldGeneration

    Copy and paste
    package chickensballz.Tutorial.common; //package
    
    import java.util.Random;
    
    import net.minecraft.world.World; //Imports
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.feature.WorldGenMinable;
    import cpw.mods.fml.common.IWorldGenerator;
    
    public class CopperOreWorldGeneration implements IWorldGenerator {
    
    @Override
    public void generate(Random random, int chunkX, int chunkZ, World world,
    IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
    switch (world.provider.dimensionId) {
    case -1:
    generateNether();
    break;
    case 0:
    generateSurface(world, random, chunkX * 16, chunkZ * 16);
    break;
    case 1:
    generateEnd();
    break;
    }
    }
    
    public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
    for (int i = 0; i < 40; i++) { //40 is how many block will spawn in one chunk.
    int randPosX = chunkX + rand.nextInt(16);
    int randPosY = rand.nextInt(64); //64 is the height
    int randPosZ = chunkZ + rand.nextInt(16);
    
    (new WorldGenMinable(TutorialMod.CopperOre.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ); //Change 10 to any number, this is how many block will spawn together.
    }
    }
    
    public void generateNether() {
    }
    
    public void generateEnd() {
    }
    
    }


    Now... In your CommonProxy
    GameRegistry.registerWorldGenerator(new CopperOreWorldGeneration());
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on Please Help, new server, 3 mods need to be installed + world file
    It took me more than 30 sec to read this, so im not helping
    Posted in: Server Support and Administration
  • 1

    posted a message on TechGuy's Modding Tutorials
    armour please?
    Posted in: Mapping and Modding Tutorials
  • To post a comment, please .