Jump to content

WorldGen requirements


traxys

Recommended Posts

I want to add a particular WorldGen , a block in the nether surronded by blocks or lava , no air block arround.

 

So for generating in the nether I use the code found in the wiki :

 

BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ);

 

if(b.biomeName.equals("Hell")){

    //Generate the block

}

 

But I don't know how to test what blocks are around , so I am asking if someone would help me in giving a method , a piece of code , or anything that could help me figuring it out.

 

Thanks to anyone looking tis post , and even a greater Thanks to anyone helping me !

Link to comment
Share on other sites

But I don't know how to test what blocks are around , so I am asking if someone would help me in giving a method , a piece of code , or anything that could help me figuring it out.

 

world.getBlock(x, y, z) ?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

How can I degine x, y and z ?

 

Because the worldGen method takes those coordonates parameters : chunkX , chunkZ and chunkY

 

That I define in my setBlock as "chunkX*16 + random.nextInt(16), 50, chunkZ*16 + random.nextInt(16)"

 

but because there is a random , if I take it a second time , is taht random changed , or because it is the same exuction of the function the random has not changed ?

 

But thak you :) Cause I think I can manage something still :)

 

 

 

Link to comment
Share on other sites

HOLY CRAP YOU CAN USE VARIABLES TO SAVE THE RESULTS OF A CALL TO RANDOM.

 

Yes, I'm mocking you:

Modder Support

 

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

public class InfernalBlockGenerator implements IWorldGenerator{

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ);

int X = chunkX*16 + random.nextInt(16);

int Y = random.nextInt(31);

int Z = chunkZ*16 + random.nextInt(16);

 

if(b.biomeName.equals("Hell") &&

world.blockExists(X+1, Y, Z+1) && world.blockExists(X, Y, Z-1) &&

world.blockExists(X, Y-1, Z) && world.blockExists(X, Y+1, Z) &&

world.blockExists(X-1, Y, Z) && world.blockExists(X+1, Y, Z)){

world.setBlock(X, Y, Z, IdList.INFERNAL_BLOCK_ID);

}

}

 

}

 

I did this code , but I don't think I can check it , because of the fact that the block is surounded by blocks , so does someone know if it works ?

Link to comment
Share on other sites

That was not the method call mentioned above, but anyways you should probably head back to your programming studies for a little while. Learning the fundamentals and then the basics is not only recommended, it's a requirement :)

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Sorry, it should be world.getBlockId(x,y,z)

 

But if you can't use your javadoc and Eclipse codehinting properly I'm not going to help you.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

So for generating in the nether I use the code found in the wiki :

 

BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ);

     

if(b.biomeName.equals("Hell")){

    //Generate the block

}

"Hell" is the biome.

I'd suggest to generate in the Nether (the dimension) with this check:

world.provider.dimensionId==-1

Because you don't know if someone uses the "Hell" biome in its world or not.

Of course, you can do both checks, if you also want to be biome-specific.

Link to comment
Share on other sites

"Hell" is the biome.

I'd suggest to generate in the Nether (the dimension) with this check:

world.provider.dimensionId==-1

Because you don't know if someone uses the "Hell" biome in its world or not.

Of course, you can do both checks, if you also want to be biome-specific.

 

Do consider mods like Mystcraft which can created extra dimensions using any biome (including Sky and Hell).  If you're doing something like Nether Ore generation, your ores should generate in these dimensions.  Especially as some users wish to create "Nether Analogs" for their Ages.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.