Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

CrusoCraruso

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

CrusoCraruso's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Works great thx. Will use this is the future! Solved. Mod pls close
  2. Can you give me an example? And: This block placement is just a test. Do you know a easier way to get the java code of the structure than writing it down block after block?
  3. ok guys I got it now. I post the code so maybe I can help someone. WorldGenerator: package "package"; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.IWorldGenerator; public class WorldGeneratorSurface implements IWorldGenerator { 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*16, chunkZ*16); case 0: generateSurface(world, random, chunkX*16, chunkZ*16); } } private void generateSurface(World world, Random rand, int l, int j) { for(int i =0; i<40; i++){ int Xcoord = l + rand.nextInt(16); int Zcoord = j + rand.nextInt(16); int Ycoord = rand.nextInt(16); (new WorldGenMinable(Main.someore.blockID, 4)).generate(world, rand, Xcoord, Ycoord, Zcoord); for(int k = 0; k < 1; k++) { int RandPosX = l + rand.nextInt(16); int RandPosY = rand.nextInt(128); int RandPosZ = j + rand.nextInt(16); (new teststructure()).generate(world, rand, RandPosX, RandPosY, RandPosZ); }}}} teststructure: package""package; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class teststructure extends WorldGenerator { public teststructure() { } public boolean generate(World world, Random rand, int x, int y, int z) { if(world.getBlockId(x, y, z)!= Block.sand.blockID || world.getBlockId(x, y + 1, z)!= 0) { return false; } world.setBlock(x, y + 1, z, Main.someblock.blockID); world.setBlock(x + 1, y + 1, z, Main.someblock.blockID); world.setBlock(x, y + 2, z, Main.someblock.blockID); world.setBlock(x + 1, y + 2, z, Main.someblock.blockID); world.setBlock(x + 2, y + 2, z, Main.someblock.blockID); world.setBlock(x - 1, y + 2, z, Main.someblock.blockID); world.setBlock(x + 3, y + 3, z, Main.someblock.blockID); world.setBlock(x - 2, y + 3, z, Main.someblock.blockID); world.setBlock(x + 2, y + 3, z, Main.someblock.blockID); world.setBlock(x - 1, y + 3, z, Main.someblock.blockID); world.setBlock(x + 3, y + 4, z, Main.someblock.blockID); world.setBlock(x - 2, y + 4, z, Main.someblock.blockID); world.setBlock(x + 2, y + 4, z, Main.someblock.blockID); world.setBlock(x - 1, y + 4, z, Main.someblock.blockID); world.setBlock(x + 3, y + 5, z, Main.someblock.blockID); world.setBlock(x - 2, y + 5, z, Main.someblock.blockID); world.setBlock(x + 2, y + 5, z, Main.someblock.blockID); world.setBlock(x - 1, y + 5, z, Main.someblock.blockID); world.setBlock(x + 2, y + 6, z, Main.someblock.blockID); world.setBlock(x - 1, y + 6, z, Main.someblock.blockID); world.setBlock(x, y + 7, z, Main.someblock.blockID); world.setBlock(x + 1, y + 7, z, Main.someblock.blockID); world.setBlock(x, y + 6, z, Main.someblock.blockID); world.setBlock(x + 1, y + 6, z, Main.someblock.blockID); world.setBlock(x, y + 3, z, Main.someblock.blockID); return true; } } Code: "k < 1" 1 is the rarity. I placed 1 so I could find it fast when it spawns. With 1 you have min 1 of your structure per chunk. "if(world.getBlockId(x, y, z)!= Block.sand.blockID || world.getBlockId(x, y + 1, z)!= 0)" Block.sand.blockID is on what block it spawns. In this case sand
  4. changed it now to this: package ""; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.IWorldGenerator; public class WorldGeneratorSurface 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*16,chunkZ*16); case 0 : generateSurface(world, random,chunkX*16,chunkZ*16); } } private void generateSurface(World world, Random random, int BlockX, int BlockZ) { for(int i =0; i<40;i++){ int Xcoord = BlockX + random.nextInt(16); int Zcoord = BlockZ + random.nextInt(16); int Ycoord = random.nextInt(16); (new WorldGenMinable(Main."".blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord); for(int k = 0; k<1; k++) { int Xcoord1 = BlockX + random.nextInt(16); int Ycoord1 = random.nextInt(60); int Zcoord1 = BlockZ + random.nextInt(16); (new teststructure()).generate(world, random, Xcoord1, Ycoord1, Zcoord1); } } }} still cant find it. Do you notice something else wrong?
  5. Well the IWorldGenerator is in my "Main" class registered. This should be enaugh. But thats not the problem! My ore generates very well and its method generateSurface() is called!
  6. Well its a lot easier when you model a structure in mcedit and convert that to java. Big castle would take impossible long. So dont you have another idea?
  7. Hey guys! I have some problems spawning a test structure in the overworld. WorldGenerator for the structure package "mypackage"; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.IWorldGenerator; public class WorldGeneratorSurface 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*16,chunkZ*16); case 0 : generateSurface(world, random,chunkX*16,chunkZ*16); } } private void generateSurface(World world, Random random, int BlockX, int BlockZ) { for(int i =0; i<40;i++){ int Xcoord = BlockX + random.nextInt(16); int Zcoord = BlockZ + random.nextInt(16); int Ycoord = random.nextInt(16); (new WorldGenMinable(Main."someore".blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord); } } private void generateSurface1(World world, Random rand, int i, int j) { for(int k = 0; k<1; k++) { int RandPosX = i + rand.nextInt(16); int RandPosY = rand.nextInt(128); int RandPosZ = j + rand.nextInt(16); (new teststructure()).generate(world, rand, RandPosX, RandPosY, RandPosZ); } } } And in my main file: GameRegistry.registerWorldGenerator(new WorldGeneratorSurface()); I get no errors, but I cant find this structure anywhere. Does anybody know what I did wrong?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.