SapphireSky Posted April 4, 2017 Posted April 4, 2017 (edited) I'm trying to make a generic method to more easily add a vein of ore to generation. But for some reason it's totally ignoring the block it's supposed to replace and filling the above-ground air with tons of randomly placed ores. From my understanding, using BlockStateMatcher.forBlock(block) as the last parameter in WorldGenMineable() is supposed to make it only generate in that block, instead of the default Stone, right? Well that's not working at all. So why is this happening? @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.getDimension()) { case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateSurface(World world, Random random, int blockX, int blockZ) { generateOre(world, random, blockX, blockZ, Registry.quickSilverOre, Blocks.STONE, 5, 60, 5, 4); generateOre(world, random, blockX, blockZ, Registry.bloodstoneOre, Blocks.GRAVEL, 5, 128, 12, 1); } private void generateOre(World world, Random random, int chunkX, int chunkY, Block oreToGenerate, Block blockToReplace, int minHeight, int maxHeight, int amountPerChunk, int veinSize) { for (int i = 0; i < amountPerChunk; i++) { int x = chunkX + random.nextInt(16); int y = minHeight + random.nextInt(maxHeight - minHeight); int z = chunkY + random.nextInt(16); world.setBlockState(new BlockPos(x, y, z), Registry.quickSilverOre.getDefaultState()); WorldGenMinable wg = new WorldGenMinable(oreToGenerate.getDefaultState(), veinSize, BlockStateMatcher.forBlock(blockToReplace)); wg.generate(world, random, new BlockPos(x, y, z)); } } Edited April 4, 2017 by SapphireSky Quote
SapphireSky Posted April 4, 2017 Author Posted April 4, 2017 Just now, diesieben07 said: Why? And unless you need property matching you want to use BlockMatcher, not BlockStateMatcher, it's faster. Wow, I didn't even realise I had put that there. Now I feel like an idiot. But thanks. Quote
Recommended Posts
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.