Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MWorld.Java:
- public class MWorld {
- public static void mainRegistry () {
- initializeWorldGen();
- }
- public static void initializeWorldGen() {
- registerWorldGen(new Ores(), 1);
- }
- public static void registerWorldGen(IWorldGenerator worldGenClass, int weightedProbability) {
- GameRegistry.registerWorldGenerator(worldGenClass, weightedProbability);
- }
- }
- Ores.java:
- public class Ores 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(random, chunkX * 16, chunkZ * 16, world);
- break;
- case 0:
- generateOverworld(random, chunkX * 16, chunkZ * 16, world);
- break;
- case 1:
- generateEnd(random, chunkX * 16, chunkZ * 16, world);
- break;
- }
- }
- private void addOre(Block block, Block blockspawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minVein, int maxVein, int spawnChance) {
- for (int i = 0; i > spawnChance; i++) {
- int defaultChunkSize = 16;
- int xPos = posX + random.nextInt(defaultChunkSize);
- int yPos = minY + random.nextInt(maxY - minY);
- int zPos = posZ + random.nextInt(defaultChunkSize);
- new WorldGenMinable(block, (minVein + random.nextInt(maxVein - minVein)), blockspawn ).generate(world, random, xPos, yPos, zPos);
- }
- }
- private void generateEnd(Random random, int chunkX, int chunkZ, World world) {
- }
- private void generateOverworld(Random random, int chunkX, int chunkZ, World world) {
- addOre(ROre.blueOre, Blocks.stone, random, world, chunkX, chunkZ, 15, 100, 10, 40, 40);
- }
- private void generateNether(Random random, int chunkX, int chunkZ, World world) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment