Jump to content

Minecraft Strukturen-Generation Problem


Mika
 Share

Recommended Posts

Hallo, ich habe da ein Problem: Ich versuche, eine Struktur zu Minecraft hinzuzufügen, die dann halt in der Welt generiert wird. Ich habe bereits einen Code, der eigentlich auch funktioniert. Aber: Die Struktur wird nur um den Spawn-Punkt der Welt generiert und NICHT in der kompletten Welt. Außerdem wird sie unregelmäßig und manchmal auch aufeinandergestapelt generiert. Hier ist der Code:


package de.mod.minecraft.generators;


import java.util.Random;


import cpw.mods.fml.common.IWorldGenerator;

import net.minecraft.block.Block;

import net.minecraft.init.Blocks;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

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


public class Test implements IWorldGenerator{



	@Override

	public void generate(Random random, int i2, int k2, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

			boolean place = false;

			int i = i2 + random.nextInt(15);

			int k = k2 + random.nextInt(15);


			int j = world.getHeightValue(i,k)-1;


			if((random.nextInt(1000000)+1)<=10000){

			place = true;

			}

			if(place){

				System.err.println("GENERIERT!!!");

			world.setBlock(i+0, j+0, k+0, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+0, k+0, Block.getBlockById(44), 3, 2);

			world.setBlock(i+2, j+0, k+0, Block.getBlockById(44), 3, 2);

			world.setBlock(i+3, j+0, k+0, Block.getBlockById(44), 3, 2);

			world.setBlock(i+4, j+0, k+0, Block.getBlockById(44), 3, 2);

			world.setBlock(i+0, j+0, k+1, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+0, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+0, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+0, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+4, j+0, k+1, Block.getBlockById(44), 3, 2);

			world.setBlock(i+0, j+0, k+2, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+0, k+2, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+0, k+2, Block.getBlockById(9), 0, 2);

			world.setBlock(i+3, j+0, k+2, Block.getBlockById(4), 0, 2);

			world.setBlock(i+4, j+0, k+2, Block.getBlockById(44), 3, 2);

			world.setBlock(i+0, j+0, k+3, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+0, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+0, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+0, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+4, j+0, k+3, Block.getBlockById(44), 3, 2);

			world.setBlock(i+0, j+0, k+4, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+0, k+4, Block.getBlockById(44), 3, 2);

			world.setBlock(i+2, j+0, k+4, Block.getBlockById(44), 3, 2);

			world.setBlock(i+3, j+0, k+4, Block.getBlockById(44), 3, 2);

			world.setBlock(i+4, j+0, k+4, Block.getBlockById(44), 3, 2);

			world.setBlock(i+1, j+1, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+1, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+1, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+1, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+2, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+2, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+2, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+2, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+3, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+3, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+3, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+3, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+4, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+4, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+4, k+1, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+4, k+2, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+4, k+2, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+4, k+2, Block.getBlockById(4), 0, 2);

			world.setBlock(i+1, j+4, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+2, j+4, k+3, Block.getBlockById(4), 0, 2);

			world.setBlock(i+3, j+4, k+3, Block.getBlockById(4), 0, 2);

			}

	}

}

Ok und in der main-Klasse habe ich einmal


public static IWorldGenerator Test = new de.mod.minecraft.generators.Test(); //Das ist die Klasse, dir oben drüber steht!

und


GameRegistry.registerWorldGenerator(Test, 1);

Wo liegt das Problem? Hat vielleicht jemand einen alternativen und funktionierenden Code?

Ich wäre euch sehr dankbar!!! :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...
B
B