Jump to content

[1.6.4] Ore generation not working fully [solved]


majesticmadman98

Recommended Posts

Hey, my problem is that i have 3 ores than i want to generate in the over world, but only one ore seems to be allowed to spawn. So if i have ores 1,2 & 3 all set to load, only the latest saved one will generate. but i can remove any ore and still only one of the running ores will spawn. So if i removed ore 1 than only one of ore 2 or 3 will generate. but all ores have been individually tested so i know they actually can generate separately.

 

Main code

 

package b.OOMOD;

 

import b.OOMOD.Weapons.weaponCBdagger;

import b.OOMOD.Weapons.weaponCBhammer;

import b.OOMOD.Weapons.weaponCBsword;

import b.OOMOD.Weapons.weaponIGknife;

import b.OOMOD.Weapons.weaponIGknife;

import b.OOMOD.Weapons.weaponIGsword;

import b.OOMOD.Weapons.weaponSIaxe;

import b.OOMOD.Weapons.weaponSIdagger;

import b.OOMOD.Weapons.weaponSIsword;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.EnumHelper;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.Mod;

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

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

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

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

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

import b.OOMOD.Ingots.*;

import b.OOMOD.genWorld.CBoreWorldGen;

import b.OOMOD.genWorld.IGoreWorldGen;

import b.OOMOD.genWorld.SIoreWorldGen;

import b.OOMOD.genWorld.MoreWorldGen;

import b.OOMOD.ore.CBore;

 

 

 

//mod info

@Mod(modid = "OOMOD", name = "Odysessues' Oddity", version = "1.0.0")

//client server

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

 

public class OOmain{

//Weapon defining

public static Item CBsword;

public static Item CBdagger;

public static Item CBhammer;

public static Item SIsword;

public static Item SIdagger;

public static Item SIaxe;

public static Item IGsword;

public static Item IGknife;

 

 

 

//define weapon material

public static EnumToolMaterial SWORD = EnumHelper.addToolMaterial("SWORD", 0, 2134, 8.0F, 11.0F, 10);

public static EnumToolMaterial DAGGER = EnumHelper.addToolMaterial("DAGGER", 0, 2134, 8.0F, 5.0F, 10);

public static EnumToolMaterial HAMMER = EnumHelper.addToolMaterial("HAMMER", 0, 2134, 8.0F, 15.0F, 10);

 

 

//Ingot Defining

public static Item CBingot;

public static Item SIingot;

public static Item IGingot;

public static Item Marble;

public static Item DMarble;

 

//Ore Defining

public static Block CBore;

public static Block SIore;

public static Block IGore;

public static Block More;

 

//Block  Defining

public static Block MBlock;

public static Block MPillar;

public static Block MBlockC;

public static Block DMBlock;

public static Block DMPillar;

public static Block DMBlockC;

 

 

 

//Ore World Gen Defining

public static CBoreWorldGen CBO_genWorld = new CBoreWorldGen();

public static SIoreWorldGen SIO_genWorld = new SIoreWorldGen();

public static IGoreWorldGen IGO_genWorld = new IGoreWorldGen();

public static MoreWorldGen MO_genWorld = new MoreWorldGen();

 

 

    //event handler

@EventHandler

public void Load(FMLPreInitializationEvent Event){

 

//Weapon Settings

CBsword = new weaponCBsword(5000, SWORD).setUnlocalizedName("OOmod:CBsword ");

CBdagger = new weaponCBdagger(5001, DAGGER).setUnlocalizedName("OOmod:CBdagger ");

CBhammer = new weaponCBhammer(5002, HAMMER).setUnlocalizedName("OOmod:CBhammer ");

SIsword = new weaponSIsword(5003, SWORD).setUnlocalizedName("OOmod:SIsword ");

SIdagger = new weaponSIdagger(5004, DAGGER).setUnlocalizedName("OOmod:SIdagger ");

SIaxe = new weaponSIaxe(5005, HAMMER).setUnlocalizedName("OOmod:SIaxe ");

IGsword = new weaponIGsword(5006, SWORD).setUnlocalizedName("OOmod:IGsword ");

IGknife = new weaponIGknife(5007, DAGGER).setUnlocalizedName("OOmod:IGdagger ");

 

 

//ingot setting

CBingot = new CBingot(5008).setUnlocalizedName("OOmod:CBingot");

SIingot = new SIingot(5009).setUnlocalizedName("OOmod:SIingot");

IGingot = new IGingot(5010).setUnlocalizedName("OOmod:IGingot");

Marble = new Marble(5011).setUnlocalizedName("OOmod:Marble");

DMarble = new DMarble(5012).setUnlocalizedName("OOmod:DMarble");

 

 

//ore settings

CBore = new b.OOMOD.ore.CBore(4000, Material.rock).setUnlocalizedName("OOmod:CBore");

SIore = new b.OOMOD.ore.SIore(4001, Material.rock).setUnlocalizedName("OOmod:SIore");

IGore = new b.OOMOD.ore.IGore(4002, Material.rock).setUnlocalizedName("OOmod:IGore");

More = new b.OOMOD.ore.More(4003, Material.rock).setUnlocalizedName("OOmod:More");

 

//Block setting

MBlock = new b.OOMOD.block.Mblock(4004, Material.rock).setUnlocalizedName("OOmod:MBlock");

MPillar = new b.OOMOD.block.MPillar(4005, Material.rock).setUnlocalizedName("OOmod:MPillar");

MBlockC = new b.OOMOD.block.MblockC(4006, Material.rock).setUnlocalizedName("OOmod:MBlockC");

DMBlock = new b.OOMOD.block.DMblock(4007, Material.rock).setUnlocalizedName("OOmod:DMBlock");

DMPillar = new b.OOMOD.block.DMPillar(4008, Material.rock).setUnlocalizedName("OOmod:DMPillar");

DMBlockC = new b.OOMOD.block.DMblockC(4009, Material.rock).setUnlocalizedName("OOmod:DMBlockC");

 

 

 

 

 

//Weapon Game Register

GameRegistry.registerItem(CBsword, "CBsword");

GameRegistry.registerItem(CBdagger, "CBdagger");

GameRegistry.registerItem(CBhammer, "CBhammer");

GameRegistry.registerItem(SIsword, "SIsword");

GameRegistry.registerItem(SIdagger, "SIdagger");

GameRegistry.registerItem(SIaxe, "SIaxe");

GameRegistry.registerItem(IGsword, "IGsword");

GameRegistry.registerItem(IGknife, "IGknife");

 

//Ingot Game Register

GameRegistry.registerItem(CBingot, "CBingot");

GameRegistry.registerItem(SIingot, "SIingot");

GameRegistry.registerItem(IGingot, "IGingot");

GameRegistry.registerItem(Marble, "Marble");

GameRegistry.registerItem(DMarble, "DMarble");

 

 

//Ore Game Register

GameRegistry.registerBlock(CBore, "CBore");

GameRegistry.registerBlock(SIore, "SIore");

GameRegistry.registerBlock(IGore, "IGore");

GameRegistry.registerBlock(More, "More");

 

//Block Game Register

GameRegistry.registerBlock(MBlock, "MBlock");

GameRegistry.registerBlock(MPillar, "MPillar");

GameRegistry.registerBlock(MBlockC, "MBlockC");

GameRegistry.registerBlock(DMBlock, "DMBlock");

GameRegistry.registerBlock(DMPillar, "DMPillar");

GameRegistry.registerBlock(DMBlockC, "DMBlockC");

 

 

//World Gen Game Register

GameRegistry.registerWorldGenerator(CBO_genWorld);

MinecraftForge.setBlockHarvestLevel(CBore, "pickaxe", 1);

 

GameRegistry.registerWorldGenerator(SIO_genWorld);

MinecraftForge.setBlockHarvestLevel(SIore, "pickaxe", 1);

 

GameRegistry.registerWorldGenerator(IGO_genWorld);

MinecraftForge.setBlockHarvestLevel(IGore, "pickaxe", 1);

 

GameRegistry.registerWorldGenerator(MO_genWorld);

MinecraftForge.setBlockHarvestLevel(More, "pickaxe", 1);

 

 

//Weapon Language Register

LanguageRegistry.addName(CBsword, "Celestial Bronze Sword");

LanguageRegistry.addName(CBdagger, "Celestial Bronze Dagger");

LanguageRegistry.addName(CBhammer, "Celestial Bronze Hammer");

LanguageRegistry.addName(SIsword, "Stygian Iron Sword");

LanguageRegistry.addName(SIdagger, "Stygian Iron Dagger");

LanguageRegistry.addName(SIaxe, "Stygian Iron Axe");

LanguageRegistry.addName(IGsword, "Imperial Gold Sword");

LanguageRegistry.addName(IGknife, "Imperial Gold Dagger");

 

//Ingot Language Register

LanguageRegistry.addName(CBingot, "Celestial Bronze Ingot");

LanguageRegistry.addName(SIingot, "Stygian Iron Ingot");

LanguageRegistry.addName(IGingot, "Imperial Gold Ingot");

LanguageRegistry.addName(Marble, "Marble");

LanguageRegistry.addName(DMarble, "Dark Marble");

 

//Ore Language Register

LanguageRegistry.addName(CBore, "Celestial Bronze Ore");

LanguageRegistry.addName(SIore, "Stygian Iron Ore");

LanguageRegistry.addName(IGore, "Imperial Gold Ore");

LanguageRegistry.addName(More, "Marble Ore");

 

//Block Language Register

LanguageRegistry.addName(MBlock, "Marble Block");

LanguageRegistry.addName(MPillar, "Marble Pillar");

LanguageRegistry.addName(MBlockC, "Engraved Marble");

LanguageRegistry.addName(DMBlock, "Dark Marble Block");

LanguageRegistry.addName(DMPillar, "Dark Marble Pillar");

LanguageRegistry.addName(DMBlockC, "Engraved Dark Marble");

 

 

//weapon Crafting recipes

GameRegistry.addRecipe(new ItemStack(CBsword), new Object[] {" C "," C "," S ", 'C', CBingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(CBdagger), new Object[] {"  "," C "," S ", 'C', CBingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(CBhammer), new Object[] {"CCC","CSC"," S ", 'C', CBingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(SIsword), new Object[] {" I "," I "," S ", 'I', SIingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(SIdagger), new Object[] {"  "," I "," S ", 'I', SIingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(SIaxe), new Object[] {"III","ISI"," S ", 'I', SIingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(IGsword), new Object[] {" G "," G "," S ", 'G', IGingot, 'S', Item.stick});

GameRegistry.addRecipe(new ItemStack(IGknife), new Object[] {"  "," G "," S ", 'G', IGingot, 'S', Item.stick});

 

//ingot crafting recipe

GameRegistry.addRecipe(new ItemStack(DMarble), new Object[] {" S ","SMS ","  ", 'M', Marble, 'S', SIingot});

 

 

//Smelting Recipes

GameRegistry.addSmelting(CBore.blockID, new ItemStack(CBingot), 1.0F);

GameRegistry.addSmelting(SIore.blockID, new ItemStack(SIingot), 1.0F);

GameRegistry.addSmelting(IGore.blockID, new ItemStack(IGingot), 1.0F);

GameRegistry.addSmelting(More.blockID, new ItemStack(Marble), 1.0F);

 

}}

 

 

 

 

 

Ore 1 world Gen

 

package b.OOMOD.genWorld;

 

import java.util.Random;

 

import b.OOMOD.OOmain;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

 

public class CBoreWorldGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId){

case 0:

generateSurface(world, random, chunkX*16, chunkZ*16);

}

 

}

 

private void generateSurface(World world, Random random, int i, int j) {

for (int k = 0; k < 25; k++) {

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

    int chunkY = random.nextInt(256);

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

   

    (new WorldGenMinable(OOmain.CBore.blockID, 64)).generate(world, random, chunkX, chunkY, chunkZ);}}}

 

 

Ore 2 world Gen

 

package b.OOMOD.genWorld;

 

import java.util.Random;

 

import b.OOMOD.OOmain;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

 

public class IGoreWorldGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId){

case 0:

generateSurface(world, random, chunkX*16, chunkZ*16);

}

 

}

 

private void generateSurface(World world, Random random, int i, int j) {

for (int k = 0; k < 25; k++) {

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

    int chunkY = random.nextInt(256);

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

   

    (new WorldGenMinable(OOmain.IGore.blockID, 64)).generate(world, random, chunkX, chunkY, chunkZ);}}}

 

 

Ore 3 world Gen

 

package b.OOMOD.genWorld;

 

import java.util.Random;

 

import b.OOMOD.OOmain;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

 

public class SIoreWorldGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId){

case 0:

generateSurface(world, random, chunkX*16, chunkZ*16);

}

 

}

 

private void generateSurface(World world, Random random, int i, int j) {

for (int k = 0; k < 25; k++) {

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

    int chunkY = random.nextInt(256);

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

   

    (new WorldGenMinable(OOmain.SIore.blockID, 64)).generate(world, random, chunkX, chunkY, chunkZ);}}}

 

Link to comment
Share on other sites

There's a much easier way to do what you're looking to do. You have 3 separate classes for each world, which isn't needed. Here is my EventManager class:

package betterblocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;

public class EventManager implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {	
	switch(world.provider.dimensionId){
		case -1: generateNether(world, random, chunkX * 16, chunkZ * 16);
		case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16);
		case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16);
	}

}

    private void generateEnd(World world, Random random, int x, int z) {
    	
}

private void generateSurface(World world, Random random, int x, int z) {
	this.addOreSpawn(BBCore.magicOre, world, random, x, z, 16, 16, 3+random.nextInt(3), 20, 10, 50);
}

private void generateNether(World world, Random random, int x, int z) {

}

/**
     * Adds an Ore Spawn to Minecraft. Simply register all Ores to spawn with this method in your Generation method in your IWorldGeneration extending Class
     *
     * @param The Block to spawn
     * @param The World to spawn in
     * @param A Random object for retrieving random positions within the world to spawn the Block
     * @param An int for passing the X-Coordinate for the Generation method
     * @param An int for passing the Z-Coordinate for the Generation method
     * @param An int for setting the maximum X-Coordinate values for spawning on the X-Axis on a Per-Chunk basis
     * @param An int for setting the maximum Z-Coordinate values for spawning on the Z-Axis on a Per-Chunk basis
     * @param An int for setting the maximum size of a vein
     * @param An int for the Number of chances available for the Block to spawn per-chunk
     * @param An int for the minimum Y-Coordinate height at which this block may spawn
     * @param An int for the maximum Y-Coordinate height at which this block may spawn
     **/
    public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY)
    {
          int maxPossY = minY + (maxY - 1);
          assert maxY > minY: "The maximum Y must be greater than the Minimum Y";
          assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16";
          assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0";
          assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0";
          assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16";
         
          int diffBtwnMinMaxY = maxY - minY;
          for(int x = 0; x < chancesToSpawn; x++)
          {
                 int posX = blockXPos + random.nextInt(maxX);
                 int posY = minY + random.nextInt(diffBtwnMinMaxY);
                 int posZ = blockZPos + random.nextInt(maxZ);
                 (new WorldGenMinable(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ);
          }
    }

}

 

Under:

private void generateSurface(World world, Random random, int x, int z) {

 

Put your ore (for spawning in the overworld, aka surface).

Make sure you make the EventManager class, for the end and nether, you need to make separate classes. Here's a tutorial on ore generation:

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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