Jump to content

Recommended Posts

Posted

Hey guys,

 

I have made an "Ore" which is a clam and I only want it to spawn at the bottom of oceans and rivers. How can I make it so it only spawns in these biomes. Here is my code:

for(int i = 0; i < 4; i++){
		int xCoord = chunkX + random.nextInt(16);
		int yCoord = random.nextInt(64);
		int zCoord = chunkZ + random.nextInt(16);

		(new WorldGenMinable(gemcraft.Clam.blockID, 4)).generate(world, random, xCoord, yCoord, zCoord);
	}

 

I am aware that for it to spawn at the bottom of the oceans I would need to make a custom WorldGenMinable, to make it spawn in dirt.

Posted

I am really confused. Could you not just paste in an example of how to use it?

This is what I have, is this right?

for(int i = 0; i < 4; i++){
		int xCoord = chunkX + random.nextInt(16);
		int yCoord = random.nextInt(64);
		int zCoord = chunkZ + random.nextInt(16);

		int x = 0;
		int z = 0;

		if(world.getBiomeGenForCoords(x, z) != BiomeGenBase.ocean){

			(new WorldGenMinable(gemcraft.Clam.blockID, 4)).generate(world, random, xCoord, yCoord, zCoord);

		}
		else {

			z = z + 10;
			x = x + 10;

		}
	}

Posted

i have no background code here, but i have edited it a small bit

also, dig round in the file for the clay block, i bet that will welp you a bit.

int x = 0;
int z = 0;//outside the for loop
for(int i = 0; i < 4; i++){
int xCoord = chunkX + random.nextInt(16);
   int yCoord = random.nextInt(64);
   int zCoord = chunkZ + random.nextInt(16);


      if(world.getBiomeGenForCoords(x, z) = BiomeGenBase.ocean){ // NO ! mark
    
    (new WorldGenMinable(gemcraft.Clam.blockID, 4)).generate(world, random, xCoord, yCoord, zCoord);
    
   }
   else {
    
    z = z + 16; //16 because a chunk is 16x16
    x = x + 16;
    
   }

}







Also, I should have you know that you are reading my signature.

Posted

@tuskiomi: that is not right either.

Please all you guys, stop the speculations. If you want to make a mod you have to learn java. Period. And I mean learn it. Not read 2 Modding tutorials.

lmao!

he speculates that my code is wrong and then tells everyone to stop!

 

Also, I should have you know that you are reading my signature.

Posted

hes right, there's nothing to speculate about the code posted won't work and if you want proof either run the code or learn basics of programming.

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

Posted

I think you are missing the point, did you test the code? no, I guess not because then you would have tried to figure out why it won't work instead of responding like that.

 

Have you read the code? do you understand what the code is actually doing?

 

 

 

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

Posted

I think you are missing the point, did you test the code? no, I guess not because then you would have tried to figure out why it won't work instead of responding like that.

 

Have you read the code? do you understand what the code is actually doing?

you're right, last post was uncalled for. but im half in half with my code, i have yet to learn how the ore generation methods work, much less what the xcoord and ycoord are for.

Also, I should have you know that you are reading my signature.

Posted

Which was the point made above. How can code which you don't understand help solve the problem?

The whole code is just speculation without any idea on how programming works at all.

 

If you don't know why x and xcoord is different or what xcoord is, then how can you write code using them to solve a problem involving them?

 

The whole point here was that the problems inn this thread and with the answers is that they lack understanding of what the code is doing, not due to being unfamiliar with the way Forge handles generation but with understanding the basics of programming.

Even just the basics of any language like C++ or Java or C# would have shown why the code above won't work at all regardless of how the Forge API and minecraft code works.

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

Posted

So are we!

It's not only you, but a lot of people here are talking about things they don't understand. it's fine to help people but when someone points out that you are wrong yourself. Then check your statements, test your code and see that it works before you turn around to yell back at them.

 

What was said above was in simple terms:

The problems here are with the basics, please everyone go learn some more java and this will be solved.

 

For you tuskiomi:

I'm sorry if you feel that I'm being rude towards you, that was not my intention. My intentions was to tell you that you need to learn a few things about the basics inn order for you to understand what you are doing when you are modding or talking about code at all :)

 

 

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

Posted

If you want to know how to spawn look how an emerald spawns. Because it spawns in a hillsbiom.

 

Try to make it the same way without touching the classes.

 

if its wrong. It was an idea. This is the way how i make something! Look at other mods/In the core classes (minecraft) and learn!

 

Posted

just a tip to get you going in the right direction.

look at x and z variable.

you defined it to be 0.

so it only checks what the biome is at 0,0.

hope this helps you.

 

also you removed the ! mark from the if statement and left it at this.

 if(world.getBiomeGenForCoords(x, z) = BiomeGenBase.ocean){ // NO ! mark

when you put only one = it try's to set the left hand variable to the right hand variable.

and you dont want that to happen.

so if you want to compare those variables you have to put a double =  instead of a single one.

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.