MC Modding
Please register and join the community!

[Answered] New block making help

MC Modding :: Help :: Help

View previous topic View next topic Go down

[Answered] New block making help

Post by jesshankin22 on Wed Oct 26, 2011 9:38 pm

I have followed several tutorials to a T and cannot find one that actually works. I don't know why this is, because when I run it there are no errors or problems, and minecraft doesn't crash. But when I try to generate it or do the recipe I made for it... nothing. Also, any help on showing me how to "draw" the blocks. thanks-Jess

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: [Answered] New block making help

Post by lcass on Wed Oct 26, 2011 10:43 pm

to add recipes you need to do
Code:
ModLoader.AddRecipe(new ItemStack(mod_grinder.grinder, 10), new Object[] {
                    "PPP",  Character.valueOf('P'), Block.grass
                    });
the block.grass can be edited to be the thing in your mod eg in mine its mod_emeraldgem.emeraldgme
to get the texture go into the Blockemeraldgem or emeraldgem which ever you have name it you then go to the part that says or if you haven't do so
Code:
namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/spritefilename/spritenamehere.png");
to draw a block texture you can use anything but for item textures use photoshop sumopaint ect....
to generate the ore put this code I will show an example cause this can get confusing
Code:
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
        for(int i = 0; i < RARITY; i++)
        {
            int randPosX = chunkX + rand.nextInt(16);
            int randPosY = rand.nextInt(HEIGHT ABOVE BEDROCK);
            int randPosZ = chunkZ + rand.nextInt(16);
            (new WorldGenMinable(mod_Namehere.Namehere.blockID, VEIN SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
        }
    }

and the example
Code:
package net.minecraft.src;

import java.util.Random;
 
public class mod_namehere extends BaseMod
{
  public static Block namehere = new namehere(ID, 0).setHardness(3.0F).setResistance(150.0F).setLightValue(1.0F).setBlockName("emerald");
 
  public mod_namehere() {
    ModLoader.RegisterBlock(namehere);
    ModLoader.AddName(namehere, "namehere");
    namehere.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/spritefile/spritenamehere.png");
    ModLoader.AddRecipe(new ItemStack(namehere, 2), new Object[] {
        "r", Character.valueOf('r'), Item.appleGold
        });
 
  }
  public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
  {
      for(int i = 0; i < how rare coal is 20; i++)
      {
          int randPosX = chunkX + rand.nextInt(16);
          int randPosY = rand.nextInt(HEIGHTABOVEBEDROCK);
          int randPosZ = chunkZ + rand.nextInt(16);
          (new WorldGenMinable(mod_namehere.namehere.blockID, VEINSIZEMAX)).generate(world, rand, randPosX, randPosY, randPosZ);
      }
  }
  public String Version()
  {
      return "1.8.1";
  }
}

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [Answered] New block making help

Post by jesshankin22 on Thu Oct 27, 2011 6:09 am

thank you so much for the help! worked right away!

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: [Answered] New block making help

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


MC Modding :: Help :: Help

 
Permissions in this forum:
You cannot reply to topics in this forum