This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
This is my Block Class
package enderthegamer01.dishonoredmod.blocks;
import java.util.Random;
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;
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); }
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; }
@Override public int damageDropped(IBlockState blockstate) { return this.meta; }
@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); } }
My World Gen Class
Any idea why my ore wont spawn???
Take a look at my generator code. It works for me, and I do it in 1.8.
https://github.com/BlackHyp3r/GnC/blob/master/OreGeneration
If you want the ore in another dimension, move the generateYourOre to the correct dimension
I figured out what I did wrong. I forgot to register the world with the "GameRegistry"
This is my Block Class
package enderthegamer01.dishonoredmod.blocks;
import java.util.Random;
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;
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);
}
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;
}
@Override
public int damageDropped(IBlockState blockstate) {
return this.meta;
}
@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);
}
}
My World Gen Class
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;
import enderthegamer01.dishonoredmod.blocks.DishonoredBlocks;
public class DishonoredWorldGen implements IWorldGenerator{
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch (world.provider.getDimensionId()) {
case 0: //Overworld
this.runGenerator(this.gen_TyvianOre, world, random, chunkX, chunkZ, 20, 0, 89);
break;
case -1: //Nether
break;
case 1: //End
break;}
}
private WorldGenerator gen_TyvianOre;
public DishonoredWorldGen() {
this.gen_TyvianOre = new WorldGenMinable(DishonoredBlocks.TyvianOre.getDefaultState(), 10);
}
private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
int heightDiff = maxHeight - minHeight + 1;
for (int i = 0; i < chancesToSpawn; i ++) {
int x = chunk_X * 16 + rand.nextInt(16);
int y = minHeight + rand.nextInt(heightDiff);
int z = chunk_Z * 16 + rand.nextInt(16);
generator.generate(world, rand, new BlockPos(x, y, z));
}
}
}
Any idea why my ore wont spawn???
Take a look at my generator code. It works for me, and I do it in 1.8.
https://github.com/BlackHyp3r/GnC/blob/master/OreGeneration
If you want the ore in another dimension, move the generateYourOre to the correct dimension
I figured out what I did wrong. I forgot to register the world with the "GameRegistry"