• 1

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun - EnumToolMaterial!
    Hey guys! I am ScratchForFun, and I do modding with forge in minecraft!
    All mods i am creating is working for 1.4.7! and contains video tutorial!

    Uploading Modding Tutorials every single day!


    Hit up my channel at http://youtube.com/ScratchForFun!



    Today we create an 'EnumToolMaterial' for 1.4.7!

    Main mod class
    A EnumToolMaterial can be incredible handy. EnumToolMaterial is used for tools, it holds the information on how fast the tool mines, how hard it hits, and so on.

    To make our custom EnumToolMaterial we only need a little bit of code.
    This code is a nasty bit to understand at first for some people.

    To make a EnumToolMaterial Forge has created a class called EnumHelper, and EnumHelper got a method called 'addToolMaterial'.
    public static EnumToolMaterial coalToolMaterial = EnumHelper.addToolMaterial("COAL", 4, 2500, 20.0F, 5, 100);

    Now, this method needs 6 arguments.

    The firstone being a String. This String is the name of the EnumToolMaterial.


    The second is a int of the harvest level. This is the level of material this tool can harvest.
    Obsidian is a block only diamond can break. diamond is set to 3 at harvest level.

    If you have harvest level at 3 i can harvest all kinds of stuff, everything in normal minecraft.


    The third being the max uses this tool has.


    The forth is efficiencyOnProperMaterial, this is a float, and this tells the strength of this tool agains blocks that it is effective against.

    Like pickaxe on stone or shovel on dirt.
    Diamond at 8.0F here, and Gold at 12.0F


    The fifth is the damageVsEntity, this tells how hard this tool is on another entity/mob


    And the last is the enchantability. every enchantment has its max enchantability. if this argument is over that it will not be able to enchant that spesific enchantment. in other word, the higher, the better enchantments on this tool


    The ingame EnumToolMaterials for you to compare
    ("WOOD", 0, 59, 2.0F, 0, 15);
    ("STONE", 1, 131, 4.0F, 1, 5);
    ("IRON", 2, 250, 6.0F, 2, 14);
    ("EMERALD", 3, 1561, 8.0F, 3, 10); //Diamond
    ("GOLD", 0, 32, 12.0F, 0, 22);




    Hope this helped you!
    Be sure to subscribe and follow my main post!


    Everything I have done is at my youtube channel!



    Have any ideas? Please feel free to comment at any of my videos or in my main post! You can also email me at: [email protected]
    Posted in: Tutorials
  • 0

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun - CraftingHandler!
    Hey guys! I am ScratchForFun, and I do modding with forge in minecraft!
    All mods i am creating is working for 1.4.7! and contains video tutorial!

    Uploading Modding Tutorials every single day!


    Hit up my channel at http://youtube.com/ScratchForFun!



    Today we create a 'CraftingHandler' for 1.4.7!

    Main mod class
    Now, what is a craftingHandler you might say?

    Well, a craftingHandler is a handler that receives information every time you smelt or craft an item, or smelt something.

    So, first thing we will need to do is to add some code to our main mod class.
    And, as you probaly guessed, we will need to create our CraftingHandler.

    To do so you write:
    public static ModCraftingHandler modCraftHandler = new ModCraftingHandler();


    So, yes we have now created our CraftingHandler, but now we need to register it.
    To do so you just need this bit of code:
    GameRegistry.registerCraftingHandler(modCraftHandler);



    CraftingHandler class
    We have succesfully created and registered our CraftingHandler, but we will have to code some more to receive all information that it puts out.

    First thing we do is to create the CraftingHandler class.

    this is pretty basic stuff:
    public class ModCraftingHandler implements ICraftingHandler{
    
    }

    Now, you will get an error, by saying this, but thats because we need to 'add unimplemented methods',
    so to do that you hover your mouse over the error of your mod class and click 'add unimplemented methods'.

    It should now look something like this:
    public class ModCraftingHandler implements ICraftingHandler{
    
    @Override
    public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
    // TODO Auto-generated method stub
    }
    
    @Override
    public void onSmelting(EntityPlayer player, ItemStack item) {
    // TODO Auto-generated method stub
    }
    }

    After this step is done, its all up to you.

    The most common thing to do is to add this bit of code to your onCrafting() or onSmelting():
    if(item.itemID == Item.beefCooked.itemID){
    System.out.println("Hope it tastes!");
    }

    This bit of code says:

    If the item/block created after crafting/smelting has the same id as the Item of cooked beef. I want to print to the console: "Hope it tastes!"

    You switch out the println() with something of your choice, for example change a boolean or something in your main mod class.


    it says item but can mean anything! (Block or Item), this is a itemstack, not a item!


    Everything should look something like this:
    import net.minecraft.block.Block;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import cpw.mods.fml.common.ICraftingHandler;
    
    public class ModCraftingHandler implements ICraftingHandler{
    
    public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
    
    }
    
    public void onSmelting(EntityPlayer player, ItemStack item) {
    if(item.itemID == Item.beefCooked.itemID){
    System.out.println("Hope it tastes!");
    }
    }
    
    }



    Hope this helped you!
    Be sure to subscribe and follow my main post!


    Everything I have done is at my youtube channel!



    Have any ideas? Please feel free to comment at any of my videos or in my main post! You can also email me at: [email protected]
    Posted in: Tutorials
  • 0

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun
    Quote from brendan321

    could you do a tut on Liquid storage please and multi-block structures


    By 'liquid storage' do you mean a bucket or a block?
    Posted in: Tutorials
  • 0

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun - Liquid!
    Hey guys! I am ScratchForFun, and I do modding with forge in minecraft!
    All mods i am creating is working for 1.4.7! and contains video tutorial!

    Uploading Modding Tutorials every single day!


    Hit up my channel at http://youtube.com/ScratchForFun!



    Today we creat our 'Custom Liquid' for 1.4.7!

    Main class
    First we need add our liquid to out main mod class!
    To do so we create two blocks:
    public static Block scratchLiquidStill;
    public static Block scratchLiquidFlowing;



    Then we need to initialize our two blocks
    we do this in our load method:
    scratchLiquidStill = new BlockLiquidStill(2013).setBlockName("scratchLiquidStill");
    scratchLiquidFlowing = new BlockLiquidFlowing(2012).setBlockName("scratchLiquidFlowing");

    This give the game name(Not Display Name!) to our blocks and sets the blockID


    To get the blocks registert in to the game we put in these lines in our load method:
    GameRegistry.registerBlock(scratchLiquidStill, "scratchLiquidStill");
    GameRegistry.registerBlock(scratchLiquidFlowing, "scratchLiquidFlowing");



    To set the ingame name / Display name to our block we write:
    LanguageRegistry.addName(scratchLiquidFlowing, "Scratch Liquid");

    This will add a name to our flowing scratchLiquidFlowing block, the name is in the string: "Scratch Liquid"
    We don't need a name for the Still block because it will never be held in your hand :D

    We have now completed the coding in our main mod file!
    The rest will be to add the classes:
    - BlockLiquidStill
    - BlockLiquidFlowing

    The BlockLiquidStill class
    Now to create the still block, this is almost the same as the last one.

    We start by importing:
    import net.minecraft.block.BlockStationary;
    import net.minecraft.block.material.Material;

    This will make us able to use content from both a custom class named BlockStationary and use some custom Materials.


    Now, lets just jump right to it.
    First our class needs to extends BlockStationary.
    The line will look somthing like this:
    public class BlockLiquidStill extends BlockStationary{

    Now we can use the content from BlockStationary and we can use it's 'super'.


    So the constructor of this class will look something like this:
    protected BlockLiquidStill(int par1) {
    super(par1, Material.water);
    
    this.blockHardness = 100.0F;
    this.setLightOpacity(3);
    this.disableStats();
    this.setRequiresSelfNotify();
    }

    The constructor is protected and has the Parameter of a int.
    We call this int for par1.

    Then we call BlockStationary with the super(par1, Material.water);
    Since we extends BlockStationary this is necessary.

    The parameters of the super is our int form our constructor and a Material
    Since we imported Material we can use this here.
    Material.water is a custom Material that mojang uses for their water aswell.

    We are also setting the block hardness to a ridiculous number.
    A normal grass block is something like 1.5F :/

    We are also setting the LightOpacity of our block, but instead of setting the creative tab, we are disabling the stats with: this.disableStats(); and make the block stop send blockupdates when it changes metadata with: this.setRequiresSelfNotify();


    We will also need to set our texture file
    To do so we use the method:
    public String getTextureFile(){
    return "/mod_terrain.png";
    }

    This will set the texture to a file called mod_terrain.png in minecraft.jar
    Minecraft.jar is located at: mcp/jars/bin/minecraft.jar

    Just drag and drop your texture into there.


    The BlockLiquidFlowing class
    Now to create the flowing block we first need to add some imports:
    import net.minecraft.block.BlockFlowing;
    import net.minecraft.block.material.Material;

    This will make us able to use content from both a custom class named BlockFlowing and use some custom Materials.


    Now, lets just jump right to it.
    First our class needs to extends BlockFlowing.
    The line will look somthing like this:
    public class BlockLiquidFlowing extends BlockFlowing{

    Now we can use the content from BlockFlowing and we can use it's 'super'.


    So the constructor of this class will look something like this:
    protected BlockLiquidFlowing(int par1) {
    super(par1, Material.water);
    
    this.blockHardness = 100.0F;
    this.setLightOpacity(3);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }

    The constructor is protected and has the Parameter of a int.
    We call this int for par1.

    Then we call BlockFlowing with the super(par1, Material.water);
    Since we extends BlockFlowing this is necessary.

    The parameters of the super is our int form our constructor and a Material
    Since we imported Material we can use this here.
    Material.water is a custom Material that mojang uses for their water.

    We are also setting the block hardness to a ridiculous number.
    A normal grass block is something like 1.5F :/

    We are also setting the LightOpacity of our block and the creativeTab


    We will also need to set our texture file
    To do so we use the method:
    public String getTextureFile(){
    return "/mod_terrain.png";
    }

    This will set the texture to a file called mod_terrain.png in minecraft.jar, just like above in the other Liquid class.


    After all this you need to create your texture.
    Your texture will be 256x256 and will have 5 water images at the same location as water is in the terrain.png.

    terrain.png is also located in your minecraft.jar




    Hope this helped you!
    Be sure to subscribe and follow my main post!


    Everything I have done is at my youtube channel!


    Have any ideas? Please feel free to comment at any of my videos or in my main post! You can also email me at: [email protected]
    Posted in: Tutorials
  • 0

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun
    All up to date :D
    Posted in: Tutorials
  • 2

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun
    Hey guys! I am ScratchForFun, and I do modding with forge in minecraft!
    All mods i am creating is working for 1.4.7! and contains video tutorial or text tutorial!

    Uploading Modding Tutorials every single day!


    Hit up my channel at http://youtube.com/ScratchForFun!




    Forge Tutorials:
    - Achievement + AchievementPage []
    - Settup []
    - Creative Tabs []
    - Blocks []
    - Texture []
    - Materials []
    - Items []
    - Crafting and Smelting Recipes []
    - Custom Furnace []
    - Custom TNT []

    - CraftingHandler [] [Text]

    - Custom Liquids [Text]
    - EnumToolMaterial [Text]



    Workin' On:

    - Armor
    - Basic Power System (#Ginjo)
    - Biomes Advanced
    - Biomes Simple
    - Bow Ammo / Arrows
    - Bows
    - Custom Crafting Table
    - Dimensions
    - Exporting mods
    - Enchantment
    - LandMines (Explosive version!)
    - Liquid Storage (Like Block #Brendan321)
    - Liquid Storage (Like Bucket #Brendan321)
    - Mobs
    - Multi-Block (Like wire #Ginjo)
    - Multi-Block Structures (#Brendan321)
    - Own Explosion
    - Plants (Like Sugarcane and Crops #TheKodyShaw)
    - Portals
    - Structues
    - Tools
    - Weapons/Guns/Grenades


    Have any ideas? Please feel free to comment at any of my videos or in this post! You can also email me at: [email protected]
    Posted in: Tutorials
  • 0

    posted a message on [1.4.7] Minecraft Modding With Forge - ScratchForFun
    Hey guys! I am ScratchForFun, and I do modding with forge in minecraft!
    All mods i am creating is working for 1.4.7! and contains video tutorial!



    Tutorials:

    Settup
    Posted in: Tutorials
  • To post a comment, please .