Posted February 17, 201312 yr 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.
February 17, 201312 yr Author I will try that, but I am quite inexperienced, where would I put that and what would the full coding for making it only in oceans and rivers be like?
February 17, 201312 yr Author 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; } }
February 17, 201312 yr Author well, then how do I make it so it spawns anywhere in an ocean biome? ;\ And no, with this I don't have a clue what I am doing so it would help if you showed me
February 17, 201312 yr 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.
February 17, 201312 yr @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.
February 17, 201312 yr 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...
February 17, 201312 yr 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...
February 17, 201312 yr 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.
February 17, 201312 yr 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...
February 17, 201312 yr geez man i was just trying to help Also, I should have you know that you are reading my signature.
February 17, 201312 yr 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...
February 19, 201312 yr 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!
February 19, 201312 yr 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. http://www.minecraftforum.net/topic/1937703-162smpforge-pet-mastery-hatch-level-battle/
February 21, 201312 yr BiomeGenBase biome = world.getChunkManager().getBiomeAt(xCoord ,yCoord); if(biome instanceof BiomeGenOcean){ //do stuff // if worked, say thanks to me }
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.