Jump to content

Recommended Posts

Posted

Hello!

 

I have been working on a custom biome. I edited the WorldChunkManager.java (a vanilla MC file) temporarily so find my biome easier (not sure if this was relevant to my issue or not so I decided to mention it anyways)

public static ArrayList<BiomeGenBase> allowedBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(Base.blight));

I have no errors starting up but am getting a crash when I make a new world (link to full report below). It's a NullPointerException and none of the traceback passes through any of my files so I do not even know where to begin..

Any help is greatly appreciated!

 

Full Crash Report: http://pastebin.com/qGPA80Lr

Posted

Hi

 

Although my line numbers don't link up with yours, I'm guessing the crash is on this line in getTopSolidOrLiquidBlock

 

            if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement() && Block.blocksList[l].blockMaterial != Material.leaves && !Block.blocksList[l].isBlockFoliage(this, x, k, z))

 

Probably this means that your custom biome has added a new block but you've forgotten to initialise it, so Block.blocksList[l] is still null.

 

-TGG

Posted

Alright, I checked everything and I am positive all the blocks are initialized and I tried to run it again (having made no changes) and I get a different report.

 

Report: http://pastebin.com/KA3vBuz8

 

Exception getting block type in world. I am not sure what exactly that points to considering I have declared a type and have had no problem with bonemealing my saplings into full trees with wondrous results. Something with my WorldGenInfectedTree file has the world gen angry but I don't know what.

Posted

Hi

 

Looks like a same problem i.e. Blocks.blocksList is null

    public Material getBlockMaterial(int par1, int par2, int par3)
    {
        int l = this.getBlockId(par1, par2, par3);
        return l == 0 ? Material.air : Block.blocksList[l].blockMaterial;
    }

 

I seem to remember something that world generation must not use blocks with an ID >= 256, perhaps it is related to that (I'm really not sure).

 

Do you know how to use breakpoints in your debugger?  You could add a breakpoint on Null Pointer Exception, and when it pauses at that line, inspect which block it is trying to access.  That will probably give useful clues.

 

-TGG

Posted

I seem to remember something that world generation must not use blocks with an ID >= 256, perhaps it is related to that (I'm really not sure).

 

I knew that biome top/filler blocks were not allowed above 255, I believe it is 255 and lower because Java starts the counting at 0, 0-255 is that range of 256 ids still though. I haven't had my trees gen regularly in the overworld regularly yet (I need to do some digging because I am pretty sure they should NOT be generating in the first place lol), maybe that is what is crashing. I'll test a bit and see what I can come up with.

Posted

So I figured out what is causing the issue but why is it causing it is beyond me.

 

If I comment out

this.topBlock = (byte)Base.blockInfectedGrass.blockID;
this.fillerBlock = (byte)Base.blockInfectedDirt.blockID;

I get rid of the problem and the biome spawns without any problems. If the two lines above are incorrect slightly, it's because I manually wrote them as my laptop running eclipse is low on battery (that's what I get for not charging it)

 

The block ids are 250 (BlockInfectedGrass) and 251 (BlockInfectedDirt) so their ids are not the issue here. Somewhere while generating the world and biome with these two blocks as the top/filler blocks I am getting a null pointer. Why? I'd prefer stubbing my toe over dealing with a null pointer exception.

 

Any ideas anybody?

Posted

I am fairly certain they are but I will link a pastebin to my Base class (where I register everything).

 

Base File: http://pastebin.com/GJr0jrM1

 

A sort of long file that houses all registration and what-not. Around line 700 the block registration starts (if there are line numbers in that link that is...) and after blocks I register my biome.

 

I tried moving my registrations to my Pre Init, but had no different in my error (it seems to be giving different tracebacks each time though).

Posted

@Kriki98,

 

Because of the way vanilla biomes work, you are required to use a byte value for those two blocks. My initialization for my config declares the id of them as an integer but because of the way the BiomeGenBase class is written, the top and filler blocks are required to be byte values therefore the casting from int to byte is required.

Posted

The first thing I would suggest is: Update to 1.7 (preferably 1.7.10), It's long enough out for you to update, which also brings 2 Benefits:

- No worrying for item/block IDs as they're now handled internally.

- Biome blocks can now have an ID higher than 255

 

For figuring out how to register a biome in 1.7: http://www.minecraftforge.net/forum/index.php/topic,21466.msg108900.html#msg108900

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I'd love to update, although this doesn't solve my problem directly. My modding partner isn't too inclined to want to update because we have a lot of work already done in 1.6.4.

 

Although with this information about biomes in 1.7 I may be able to convince him. I appreciate the suggestion as I was not aware that biomes accepted (although I had a hunch) above a byte size in 1.7. Thanks! I'll look into it and I appreciate the link!

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.