Posted April 5, 201510 yr package com.Floey.Core; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import java.util.Random; public class IWorldGen extends WorldGenerator { @Override public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { for (int l = 0; l < 10; ++l) { int i1 = p_76484_3_ + p_76484_2_.nextInt[nobbc]([/nobbc] - p_76484_2_.nextInt[nobbc]([/nobbc]; int j1 = p_76484_4_ + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4); int k1 = p_76484_5_ + p_76484_2_.nextInt[nobbc]([/nobbc] - p_76484_2_.nextInt[nobbc]([/nobbc]; if (p_76484_1_.isAirBlock(i1, j1, k1)) { int l1 = 1 + p_76484_2_.nextInt(p_76484_2_.nextInt(1) + 1); for (int i2 = 0; i2 < l1; ++i2) { if (Registry.blockSharpStone.canBlockStay(p_76484_1_, i1, j1 + i2, k1)) { p_76484_1_.setBlock(i1, j1 + i2, k1, Registry.blockSharpStone, 0, 2); } } } } return true; } }
April 5, 201510 yr Author Thanks I would like my block in the world Spawns but I have no idea how to do it
April 5, 201510 yr alt-shift-r does wonders. 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.
April 6, 201510 yr Author package com.Floey.Core; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import java.util.Random; public class IWorldGen extends WorldGenerator { @Override public boolean generate(World Chunk, Random Random, int BlockX, int BlockY, int BlockZ) { for (int l = 0; l < 10; ++l) { int i1 = BlockX + Random.nextInt( - Random.nextInt(; int j1 = BlockY + Random.nextInt(4) - Random.nextInt(4); int k1 = BlockZ + Random.nextInt( - Random.nextInt(; if (Chunk.isAirBlock(i1, j1, k1)) { int l1 = 1 + Random.nextInt(Random.nextInt(1) + 1); for (int i2 = 0; i2 < l1; ++i2) { if (Registry.blockSharpStone.canBlockStay(Chunk, i1, j1 + i2, k1)) { Chunk.setBlock(i1, j1 + i2, k1, Registry.blockSharpStone, 0, 2); } } } } return true; } } Better ?
April 6, 201510 yr What are i1, j1 and k1? (Tip: you can disable smileys by clicking on "Attachments and other options" before posting.)
April 6, 201510 yr You still have those i1 , j1 and k1 variables. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
April 6, 201510 yr You should find a tutorial which explains things thoroughly, and make sure you actually read everything else, not just the code. You clearly didn't write that yourself, or else you would know what those variables are.
April 6, 201510 yr Giving the topic a nicer (more descriptive) name would be helpful as well. just you wait!
April 6, 201510 yr Author package com.Floey.Core; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import java.util.Random; public class IWorldGen extends WorldGenerator { @Override public boolean generate(World world, Random Random, int BlockX, int BlockY, int BlockZ) { for (int l = 0; l < 10; ++l) { int x = BlockX + Random.nextInt( - Random.nextInt(; int y = BlockY + Random.nextInt(4) - Random.nextInt(4); int z = BlockZ + Random.nextInt( - Random.nextInt(; if (world.isAirBlock(x, y, z)) { int l1 = 1 + Random.nextInt(Random.nextInt(1) + 1); for (int i2 = 0; i2 < l1; ++i2) { if (Registry.blockSharpStone.canBlockStay(world, x, y + i2, z)) { world.setBlock(x, y + i2, z, Registry.blockSharpStone, 0, 2); } } } } return true; } } but now
April 6, 201510 yr int l1 = 1 + Random.nextInt(Random.nextInt(1) + 1); l1 (which is a bad variable name) will always be 1. A random number from 0 (inclusive) to 1 (exclusive) will always be 0. 0 + 1 = 1, rand(1) again will always be 0. 0 + 1 = 1, l1 is 1. And I don't know what the problem is. You didn't say. That said, BlockX, BlockY, and BlockZ are not block locations, they're chunk locations. You need to multiply them by 16 before you do anything with them. 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.
April 7, 201510 yr Can't they just give me the right code? pls Nope. 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.
April 7, 201510 yr Can't they just give me the right code? pls That's not what modding is about. We can guide you but you do all the stuff by yourself. If my post helped you, please press that "Thank You"-button to show your appreciation. Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding! Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.
April 7, 201510 yr Modding requires basic programming knowledge. If you are not willing to spend some time learning at least the basics, you should not make a mod. Nobody will write your mod for you. Well they could. Bud you'd have to pay them. I get paid about $25 an hour for my workjob, but freelance I'd charge $250/hr. 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.
April 7, 201510 yr Author public class IWorldGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int xMin = chunkX << 4; int zMin = chunkZ << 4; int startX = xMin + random.nextInt(16); int startZ = zMin + random.nextInt(16); int tries = random.nextInt(2); for (int i = 0; i < tries; i++) { int x = startX + random.nextInt( - random.nextInt(; int z = startZ + random.nextInt( - random.nextInt(; int y = world.getHeightValue(x, z); if ((world.isAirBlock(x, y, z) || (world.getBlock(x, y, z) == Blocks.snow)) && Registry.blockSharpStone.canBlockStay(world, x, y, z)) { if (random.nextInt(50) > 1) continue; world.setBlock(x, y, z, Registry.blockSharpStone, 0, 0); } } } } For the code? 0.0
April 7, 201510 yr Your second set of randoms, inside the for-loop, can cause (almost certainly will cause) the "I am generating in this chunk" to decide "nope, I'm generating in the next chunk." Drop the +random(16) from the definition of startX and startZ and instead put them in place of the rand(8 ) - rand(8 ) Secondly, your maximum number of tries shouldn't be random if you're just going to discard 98% of the valid positions (and a countless number of invalid ones). To boot, you're trying "at most one time." 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.
April 7, 201510 yr Author public class IWorldGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int xMin = chunkX << 4; int zMin = chunkZ << 4; int startX = xMin- random.nextInt(; int startZ = zMin - random.nextInt(; int tries = random.nextInt(2); for (int i = 0; i < tries; i++) { int x = startX + random.nextInt( - random.nextInt(; int z = startZ + random.nextInt( - random.nextInt(; int y = world.getHeightValue(x, z); if ((world.isAirBlock(x, y, z) || (world.getBlock(x, y, z) == Blocks.snow)) && Registry.blockSharpStone.canBlockStay(world, x, y, z)) { if (random.nextInt(50) > 1) continue; world.setBlock(x, y, z, Registry.blockSharpStone, 0, 0); } } } } is it ok ?
April 7, 201510 yr No 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.
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.