Posted February 24, 20169 yr Okay, so I have come to the conclusion that watching a 1.7 tutorial is bad for 1.8, so does anyone know any tutorials for custom structures for 1.8? I created a custom structure for Minecraft 1.8 and used MCEdit to get the schematic, and then Jajo_11's Schematic to Structure Converter. My main problem is that inside the structure's class, the .getBlock it used many times, giving me an error. Structure's Class public class SwirlRock extends WorldGenerator { protected Block[] GetValidSpawnBlocks() { return new Block[] { Blocks.grass, }; } public boolean LocationIsValidSpawn(World world, int x, int y, int z) { >>>> Block checkBlock = world.getBlock(x, y - 1, z); >>>> Block blockAbove = world.getBlock(x, y , z); >>>> Block blockBelow = world.getBlockstate(x, y - 2, z); for (Block i : GetValidSpawnBlocks()) { if (blockAbove != Blocks.air) { return false; } if (checkBlock == i) { return true; } else if (checkBlock == Blocks.snow_layer && blockBelow == i) { return true; } else if (checkBlock.getMaterial() == Material.plants && blockBelow == i) { return true; } } return false; } public boolean generate(World world, Random rand, int x, int y, int z) { int i = rand.nextInt(1); if(i == 0) { generate_r0(world, rand, x, y, z); } return true; } public boolean generate_r0(World world, Random rand, int x, int y, int z) { if(!LocationIsValidSpawn(world, x, y, z) || !LocationIsValidSpawn(world, x + 0, y, z) || !LocationIsValidSpawn(world, x + 0, y, z + 0) || !LocationIsValidSpawn(world, x, y, z + 0)) { return false; } >>> > world.setBlock(x + 0, y + 0, z + 0, ModBlocks.swirl_rock, 1, 3); return true; } }
February 25, 20169 yr World#getBlock and World#setBlock were replaced by World#getBlockState and World#setBlockState , respectively. These take a BlockPos instead of individual coordinates and take/return an IBlockState instead of a Block . Use IBlockState#getBlock to get the Block represented by a state. Use Block#getDefaultState to get the default state of a block, then chain IBlockState#withProperty calls to get an IBlockState with the specified property values. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.