Jump to content

Generate Custom Flower like Block


Mightydanp

Recommended Posts

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

 

 

Link to comment
Share on other sites

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));
	}
}

}

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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:?]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:?]

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.