Jump to content

Recommended Posts

Posted

I'm having trouble making ores heres my code:

 

package foreverblu.mods.testmod;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.CreativeTabs;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Material;

import net.minecraft.src.ModLoader;

import net.minecraft.src.World;

import net.minecraft.src.WorldGenMinable;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.IWorldGenerator;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Item;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid = "TestMod1", name = "My First Mod!", version = "1")

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

 

 

public class TestMod1 {

public void generateSurface(World world, Random random, int chunkX, int chunkZ) {

for(int i = 0; i < 50; i++) {

    int randPosX = chunkX + random.nextInt(16);

    int randPosY = random.nextInt(20);

    int randPosZ = chunkZ + random.nextInt(16);

    new WorldGenMinable(this.TestOre.blockID, 8).generate(world, random, randPosX, randPosY, randPosZ);

}

}

private void generateSurface(World world, int chunkX, int chunkZ) {

// TODO Auto-generated method stub

 

}

public static Block TestOre = new BlockTutorial2(1001, 1).setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setBlockName("TestOre");

@Init

public void loadMod1(FMLInitializationEvent event) {

GameRegistry.registerBlock(TestOre);

LanguageRegistry.instance().addNameForObject(TestOre, "en_US", "TestOre");

MinecraftForge.setBlockHarvestLevel(TestOre, "pickaxe", 4);

}

public static Block TestBlock = new BlockTutorial(1000, 0).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("TestBlock");

@Init

public void loadMod(FMLInitializationEvent event) {

GameRegistry.registerBlock(TestBlock);

LanguageRegistry.instance().addNameForObject(TestBlock, "en_US", "Woohoo! My first Block :D");

ModLoader.addRecipe(new ItemStack(TestBlock), new Object[] {

    "BBB",

    "BAB",

    "BBB",

    Character.valueOf('B'), Block.blockClay,

    Character.valueOf('A'), Block.obsidian

});

}

 

}

 

 

This is not working out of the code.

 

public void generateSurface(World world, Random random, int chunkX, int chunkZ) {

for(int i = 0; i < 50; i++) {

    int randPosX = chunkX + random.nextInt(16);

    int randPosY = random.nextInt(20);

    int randPosZ = chunkZ + random.nextInt(16);

    new WorldGenMinable(this.TestOre.blockID, 8).generate(world, random, randPosX, randPosY, randPosZ);

}

}

private void generateSurface(World world, int chunkX, int chunkZ) {

// TODO Auto-generated method stub

 

}

public static Block TestOre = new BlockTutorial2(1001, 1).setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setBlockName("TestOre");

@Init

public void loadMod1(FMLInitializationEvent event) {

GameRegistry.registerBlock(TestOre);

LanguageRegistry.instance().addNameForObject(TestOre, "en_US", "TestOre");

MinecraftForge.setBlockHarvestLevel(TestOre, "pickaxe", 4);

}

 

The ores arent spawning.....

width=700 height=100http://driesgames.game-server.cc//banner.png[/img]

Java, Hosting Servers and Videos...

  • 2 weeks later...
Posted

Well for one the generation code should be in it's own class. Which should be referenced in the main mod file like this:

 

GameRegistry.registerWorldGenerator(new WorldGeneratornamehere());

 

That's how I make my stuff spawn.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.