Posted August 12, 20169 yr I am trying to Generate a flower like block. right now it extends Blockbush. i seem to be having trouble with this line if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.getBlock.canBlockStay(worldIn, blockpos, this.state)) this part makes my game crash this.getBlock.canBlockStay(worldIn, blockpos, this.state) http://pastebin.com/ZpERMRM6 http://pastebin.com/X1TpkUcM
August 12, 20169 yr I have this and this works fine: public WorldGenerator BUSH= new WorldGenBush((BlockBush) BlockClass.BLOCK); @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.getDimension()) { case -1: break; case 0: runGenerator(BUSH, world, random, chunkX, chunkZ, 7, 50, 120); break; case 1: break; } } private void runGenerator(WorldGenerator generator, World world, Random random, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight){ if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight){ throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator"); } int heightDiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i++); { int x = chunk_X * 16 + random.nextInt(16); int y = minHeight + random.nextInt(heightDiff); int z = chunk_Z * 16 + random.nextInt(16); generator.generate(world, random, new BlockPos(x, y, z)); } } } http://i.imgur.com/J4rrGt6.png[/img]
August 13, 20169 yr Please actually post your crash-log. Without that, we have no clue what's actually happening. Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
August 13, 20169 yr Author Encountered an unexpected exception java.lang.NullPointerException at net.minecraft.block.BlockBush.canBlockStay(BlockBush.java:80) ~[blockBush.class:?] at com.mightydanp.eot.api.common.world.gen.feature.IWorldGenTwigs.generate(IWorldGenTwigs.java:31) ~[iWorldGenTwigs.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.spawnTwigs(IWorldGen.java:57) ~[iWorldGen.class:?] at com.mightydanp.eot.common.world.gen.WorldGen.generateSurface(WorldGen.java:51) ~[WorldGen.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.generate(IWorldGen.java:28) ~[iWorldGen.class:?] http://pastebin.com/A5Fiq6uA http://pastebin.com/36390A3G spawnTwigs(ModBlocks.twigs, world, random, chunkX, chunkZ, 7);
August 13, 20169 yr You never assign a value to IWorldGenTwigs#state, so it is null and Java throws an NPE when it is referenced. While not the cause of the problem IWorldGenTwigs should be called WorldGenTwigs, as it is a class, not an interface.
August 13, 20169 yr Author i have tried to set the blocks state with this.getBlock.getDefaultState() and this.getBlock.canBlockStay(worldIn, blockpos, this.getBlock.getStateFromMeta(0) neither of them work and it gives the same exact crash
August 13, 20169 yr Author if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.getBlock.canBlockStay(worldIn, blockpos,this.getBlock.getDefaultState() ))
August 13, 20169 yr Author Any help ? i registed my block state of my block already. it still gave me the error
August 14, 20169 yr Author at com.mightydanp.eot.api.common.world.gen.feature.IWorldGenTwigs.generate(IWorldGenTwigs.java:23) ~[iWorldGenTwigs.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.spawnTwigs(IWorldGen.java:57) ~[iWorldGen.class:?] at com.mightydanp.eot.common.world.gen.WorldGen.generateSurface(WorldGen.java:51) ~[WorldGen.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.generate(IWorldGen.java:28) ~[iWorldGen.class:?] at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:120) ~[GameRegistry.class:?] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1070) ~[Chunk.class:?] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1033) ~[Chunk.class:?]
August 14, 20169 yr at... Dude, seriously. The first line is the most important one: it tells us/you what the error is. The second line is the second most important: it tells us/you where the error is. We need both. 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.
August 14, 20169 yr Author In my Console in eclipse i get this at com.mightydanp.eot.common.block.BlockTwigs.canBlockStay(BlockTwigs.java:50) ~[blockTwigs.class:?] at com.mightydanp.eot.api.common.world.gen.feature.IWorldGenTwigs.generate(IWorldGenTwigs.java:23) ~[iWorldGenTwigs.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.spawnTwigs(IWorldGen.java:57) ~[iWorldGen.class:?] at com.mightydanp.eot.common.world.gen.WorldGen.generateSurface(WorldGen.java:51) ~[WorldGen.class:?] at com.mightydanp.eot.api.common.world.gen.IWorldGen.generate(IWorldGen.java:28) ~[iWorldGen.class:?] at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:120) ~[GameRegistry.class:?] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1070) ~[Chunk.class:?] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1033) ~[Chunk.class:?] at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:160) ~[ChunkProviderServer.class:?] at net.minecraft.world.World.getChunkFromChunkCoords(World.java:349) ~[World.class:?]
August 19, 20169 yr Author i removed && this.twig.canBlockStay(worldIn, blockpos, this.state and it still game me the same errors i showed you above
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.