public class DishonoredWorldGen implements IWorldGenerator{[/p]
@Override[/p]
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {[/p]
switch (world.provider.getDimensionId()) {[/p]
case 0: //Overworld[/p]
this.runGenerator(this.gen_TyvianOre, world, random, chunkX, chunkZ, 20, 0, 89);[/p]
[/p]
break;[/p]
case -1: //Nether[/p]
break;[/p]
case 1: //End[/p]
break;}[/p]
}[/p]
private WorldGenerator gen_TyvianOre;[/p]
public DishonoredWorldGen() {[/p]
this.gen_TyvianOre = new WorldGenMinable(DishonoredBlocks.TyvianOre.getDefaultState(), 10);[/p]
}[/p]
private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {[/p]
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)[/p]
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");[/p]
int heightDiff = maxHeight - minHeight + 1;[/p]
for (int i = 0; i < chancesToSpawn; i ++) {[/p]
int x = chunk_X * 16 + rand.nextInt(16);[/p]
int y = minHeight + rand.nextInt(heightDiff);[/p]
int z = chunk_Z * 16 + rand.nextInt(16);[/p]
generator.generate(world, rand, new BlockPos(x, y, z));[/p]
[/p]
}[/p]
}[/p]
}[/p]
[p]package enderthegamer01.dishonoredmod.blocks;[/p] [p]import java.util.Random;[/p] [p]import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;[/p] [p]public class TyvianOre extends Block{
private Item drop;
private int meta;
private int least_quantity;
private int most_quantity;
protected TyvianOre(String unlocalizedName, Material material, Item drop, int meta, int least_quantity, int most_quantity){
super(material);
this.drop = drop;
this.meta = meta;
this.least_quantity = least_quantity;
this.most_quantity = most_quantity;
this.setUnlocalizedName("TyvianOre");
this.setCreativeTab(enderthegamer01.dishonoredmod.DishonoredMod.tabDishonored);
this.setHardness(2.0F);
this.setResistance(11.0F);
this.setHarvestLevel("pickaxe", 1);
this.setStepSound(soundTypeStone);
}
protected TyvianOre(String unlocalizedName, Material mat, Item drop, int least_quantity, int most_quantity) {
this(unlocalizedName, mat, drop, 0, least_quantity, most_quantity);
}[/p] [p]protected TyvianOre(String unlocalizedName, Material mat, Item drop) {
this(unlocalizedName, mat, drop, 1, 1);
}
@Override
public Item getItemDropped(IBlockState blockstate, Random random, int fortune) {
return this.drop;
}[/p] [p]@Override
public int damageDropped(IBlockState blockstate) {
return this.meta;
}[/p] [p]@Override
public int quantityDropped(IBlockState blockstate, int fortune, Random random) {
if (this.least_quantity >= this.most_quantity)
return this.least_quantity;
return this.least_quantity + random.nextInt(this.most_quantity - this.least_quantity + fortune + 1);
}
}
[/p]
package enderthegamer01.dishonoredmod.world;[/p]
import java.util.Random;[/p]
import net.minecraft.block.state.IBlockState;[/p]
import net.minecraft.util.BlockPos;[/p]
import net.minecraft.world.World;[/p]
import net.minecraft.world.chunk.IChunkProvider;[/p]
import net.minecraft.world.gen.feature.WorldGenMinable;[/p]
import net.minecraft.world.gen.feature.WorldGenerator;[/p]
import net.minecraftforge.fml.common.IWorldGenerator;[/p]
import enderthegamer01.dishonoredmod.blocks.DishonoredBlocks;[/p]
public class DishonoredWorldGen implements IWorldGenerator{[/p]
@Override[/p]
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {[/p]
switch (world.provider.getDimensionId()) {[/p]
case 0: //Overworld[/p]
this.runGenerator(this.gen_TyvianOre, world, random, chunkX, chunkZ, 20, 0, 89);[/p]
[/p]
break;[/p]
case -1: //Nether[/p]
break;[/p]
case 1: //End[/p]
break;}[/p]
}[/p]
private WorldGenerator gen_TyvianOre;[/p]
public DishonoredWorldGen() {[/p]
this.gen_TyvianOre = new WorldGenMinable(DishonoredBlocks.TyvianOre.getDefaultState(), 10);[/p]
}[/p]
private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {[/p]
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)[/p]
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");[/p]
int heightDiff = maxHeight - minHeight + 1;[/p]
for (int i = 0; i < chancesToSpawn; i ++) {[/p]
int x = chunk_X * 16 + rand.nextInt(16);[/p]
int y = minHeight + rand.nextInt(heightDiff);[/p]
int z = chunk_Z * 16 + rand.nextInt(16);[/p]
generator.generate(world, rand, new BlockPos(x, y, z));[/p]
[/p]
}[/p]
}[/p]
}[/p]
[p]Any idea why my ore wont spawn???[/p]