I am trying to program a 1.7.10 mod, and add in some ores. I have come across one major error, explained at the bottom of the page. I am not the one using this code, yet trying to make it work for a friend, thus there are some notes added in. Keep in mind that I am using Eclipse Mars.
package Test2;
import java.util.Random;
import com.jcraft.jorbis.Block;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
public class RubyGeneration 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, chunkZ);
break;
case 0:
generateOverworld(world, random, chunkX, chunkZ);
break;
case 1:
generateEnd(world, random, chunkX, chunkZ);
break;
}
}
public void generateNether(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}// And example here is Test.RubyOre for above
public void generateOverworld(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 20, Blocks.stone);
}// Change around the 2 and 16, 2 is min vein size, and 16 is max. 10 is how common it is, you just have to mess around with that, I'm not sure how it works. The 0 and 20 are standing for min Y level and max.
public void generateEnd(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}
public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateIn) {
int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block, vienSize, generateIn);
for(int i = 0; i< chance; i++){
int xRand = chunkX * 16 + random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + random.nextInt(16);
gen.generate(world, random, xRand, yRand, zRand);
}
}
}
//In PreInit, put GameRegistry.registerWorldGenerator(new RubyGeneration(), 0);
My main issue with this is the WorldGenMinable(block, vienSize, generateIn);. It is saying the constructor WorldGenMinable(int, Block, Int) is not found. Vien is spelled that way on purpose. I am also posting this on the general chat forums, so you may also see it there.
package Test2;
import java.util.Random;
import com.jcraft.jorbis.Block;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
public class RubyGeneration 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, chunkZ);
break;
case 0:
generateOverworld(world, random, chunkX, chunkZ);
break;
case 1:
generateEnd(world, random, chunkX, chunkZ);
break;
}
}
public void generateNether(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}// And example here is Test.RubyOre for above
public void generateOverworld(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 20, Blocks.stone);
}// Change around the 2 and 16, 2 is min vein size, and 16 is max. 10 is how common it is, you just have to mess around with that, I'm not sure how it works. The 0 and 20 are standing for min Y level and max.
public void generateEnd(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}
public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateIn) {
int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block, vienSize, generateIn);
for(int i = 0; i< chance; i++){
int xRand = chunkX * 16 + random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + random.nextInt(16);
gen.generate(world, random, xRand, yRand, zRand);
}
}
}
//In PreInit, put GameRegistry.registerWorldGenerator(new RubyGeneration(), 0);
My main issue with this is the WorldGenMinable(block, vienSize, generateIn);. It is saying the constructor WorldGenMinable(int, Block, Int) is not found. Vien is spelled that way on purpose. I am also posting this on the general chat forums, so you may also see it there.