Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

Look in the wiki, there's a tutorial.

Read the EAQ before posting! OR ELSE!

 

This isn't building better software, its trying to grab a place in the commit list of a highly visible github project.

 

www.forgeessentials.com

 

Don't PM me, I don't check this account unless I have to.

  • 2 weeks later...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.