HelpNation Tutorials

Would you like to react to this message? Create an account in a few clicks or log in to continue.
HelpNation Tutorials

Learn how to mod, make, read, or just review modding tutorials and mods!


    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0]

    Poll

    What Would You Give This Tutorial?

    [ 0 ]
    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_left0%[Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_right [0%] 
    [ 0 ]
    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_left0%[Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_right [0%] 
    [ 0 ]
    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_left0%[Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_right [0%] 
    [ 0 ]
    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_left0%[Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_right [0%] 
    [ 0 ]
    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_left0%[Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Bar_right [0%] 

    Total Votes: 0
    Or1g1n_Of_Death
    Or1g1n_Of_Death
    Forum Founder
    Forum Founder


    Posts : 24
    Join date : 2011-11-05
    Location : My Computer

    [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0] Empty [Creating Mods]ModLoader Compatibility!*WINDOWS*[1.0.0]

    Post  Or1g1n_Of_Death Sun Nov 06, 2011 3:36 pm

    Making Mods ModLoader Compatible!

    Modding Disclaimer:

    I, Or1g1n_Of_Death, do not take any responsibility for anything that might happen to your computer or any device you use while making code that may be unwanted. Anything saying I will be sued, etc. Will be deleted and you will be told to review this section.

    Just in case you didn't exactly get what I first said...

    Or1g1n_Of_Death is not responsible for anything that happens to your device you use to mod with, that you may not want. Thank you, have a nice day.

    Signed,
    ~Or1g1n; The King king


    Back To Modding!

    Well, we are going to make our block-SpeedStone-which we made earlier, ModLoader compatible! Whenever we do this, we're going to change quite a bit of our code. This isn't actually to hard though, so let's review. This is what our BlockSpeedStone.java's code should look like:

    Code:

    // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3) braces deadcode

    package net.minecraft.src;

    import java.util.Random;

    // Referenced classes of package net.minecraft.src:
    //            Block, Material

    public class BlockSpeedStone extends Block
    {

        public BlockSpeedStone(int i, int j)
        {
            super(i, j, Material.rock);
          slipperiness = 0.1F;
        }
       
    }

    Well, we're going to have to make a few changes... Well, actually alot of changes. So, this is what our block's code should look like after we change it:

    Code:

    package net.minecraft.src;

        public class mod_SpeedStone extends BaseMod  //Our mod extends BaseMod a ModLoader component, not Block anymore.
        {
          public static final Block SpeedStone;  //Letting Minecraft know our block exists
         
          static
          {
              SpeedStone = (new Block(110, 0, Material.rock)).setHardness(1.5F).setLightValue(1.0F).setStepSound(Block.soundStoneFootstep).setBlockName("SpeedStone");
          }                    //Our block properties
         
          public void load()
          {
              ModLoader.AddName(SpeedStone, "SpeedStone");  //Block's in-game name
             
              ModLoader.RegisterBlock(SpeedStone);  //Tells ModLoader to register SpeedStone as a block
           
              SpeedStone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/randomfolder/SpeedStone.png");
             
              ModLoader.AddRecipe(new ItemStack(SpeedStone, 1), new Object[] {
              "x", Character.valueOf('x'), Block.dirt
          });                                          //This is our recipe from earlier                 
          }
         
         
          public String Version()  //Our Minecraft version goes here
          {
              return "1.8.1"; 
          }
        }

    If you read the comments on the side, it's actually not very complicated. After this, we need to go into Block.java and CraftingManager.java and then delete all of the code we made in there. Also, regarding the line with the properties, listing the the integers, well, look. Int j is a 0. Well, if you look at "SpeedStone.blockIndexTexture" that overrides the terrain.png. So, to get your image to upload, you have to make a folder in your mcp/temp/bin/minecraft. Name it whatever you want, make a 16x16 pixel png of your block and name it SpeedStone.png then place it in there. Now, this part is VERY important, you HAVE to copy that folder and then place it in the mcp/jars/bin/minecraft.jar otherwise when doing your testing, you will get a game crash because it cannot find the image. Another thing you MUST do is rename it mod_SpeedStone.java. DON'T DELETE SPEEDSTONE.JAVA! We will need it!

    Now, if you do recompile.bat and startclient.bat, you'll notice our block doesn't make us slide! Well, your going to have go into mod_SpeedStone.java again and delete the part that says "Material.rock". It will then stop thinking your block is rock.

    And now, go back into mod_SpeedStone.java, and then you see the part that says "SpeedStone = (new Block("? Well, change it to this:


    Code:

    SpeedStone = (new SpeedStone(

    Well, guess what? We're done! You should now know how to make a mod ModLoader compatible! Hooray! Once again, to get your files back, just reobfuscate and open reobf and then open Minecraft. Now, if you just want this to be a normal old block, and not slippery, then you don't have to create a second class, and you can keep the original settings of "Material.rock" and "SpeedStone = (new Block(" Please, rate this tutorial, and tell me what you think! I spent loads of time writing this, and I tried to make sure I explained everything as simply as possible! Bye!

    ~Or1g1n; The King king

      Current date/time is Thu Nov 21, 2024 7:05 am