HelpNation Tutorials

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


    [Creating Mods]How to make a Block / Advanced Block [Windows + Mac][1.0][Intermediate]

    Share
    avatar
    Original

    Posts : 8
    Join date : 2011-12-11
    Age : 20
    Location : Folsom, CA, USA

    [Creating Mods]How to make a Block / Advanced Block [Windows + Mac][1.0][Intermediate]

    Post  Original on Sun Dec 11, 2011 10:57 pm

    Mac users read my tutorial on how to get setup then continue with this mod

    How to make a Block

    BlockNamehere.java
    Code:

    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
    Code:

    package net.minecraft.src;

    public class mod_Namehere extends BaseMod
    {
      public static Block Namehere;
     
      public String Version()
      {
          return "1.0.0";
      }
     
      public mod_Namehere()
      {
          ModLoader.RegisterBlock(Namehere);
               
          Namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Blocks/Namehere.png");
               
          ModLoader.AddName(Namehere, "Namehere");
               
          ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] {"###", "###", "###", Character.valueOf('#'), Item.seeds});
      }
     
      static
      {
              new BlockNamehere(210, 0).setHardness(1.0F).setResistance(1.0F).setLightValue(1.0F).setBlockName("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



    ----------------------------------------------------------------------


    Making a more advanced block

    a speedy block
    Code:
     slipperiness = 1.5F;

    would go into

    Code:
     super(i, j, Material.ground);

    a bouncy block
    Code:
     public void onEntityWalking(World world, int x, int y, int z, Entity entity)
         {
                 entity.motionY += 2.0;
         }

    goes here

    Code:
     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;
         }
     }

      Current date/time is Sat Jun 24, 2017 11:43 am