Jump to content

Recommended Posts

Posted

Hello.

 

I'm currently updating my mod to 1.7.2, but now I'm getting the following error every time if I create a new world or if I load a world:

 

 

  Reveal hidden contents

Developer of Primeval Forest.

Posted

Hi

 

My guess: one of these is not initialised properly (is still null)

        PFBiomeBase.magicalforest,

        PFBiomeBase.mountains,

        PFBiomeBase.pineForest,

        PFBiomeBase.primevalforest,

        PFBiomeBase.silverwood

 

If that doesn't work, you could try setting your debugger to break on NullPointerException, and see which object is causing the problem.  That will give you a clue on where to look next.

 

-TGG

 

Posted

Ok, I checked if some ot the biomes is not initialised and all biomes are initialised.

The Debug thing returns this line in the Minecraft ClassLoader class:

 

final Class<?> clazz = defineClass(transformedName, transformedClass, 0, transformedClass.length, codeSource);

Developer of Primeval Forest.

Posted
  On 6/3/2014 at 2:16 PM, Bektor said:

Ok, I checked if some ot the biomes is not initialised and all biomes are initialised.

The Debug thing returns this line in the Minecraft ClassLoader class:

 

final Class<?> clazz = defineClass(transformedName, transformedClass, 0, transformedClass.length, codeSource);

Yes, Forge triggers several Null Pointer Exceptions during startup.  Just keeping resuming until it stops with a NullPointerException on your code PFGenLayerBiomes.java:41.  Then look to see which variable is null.

 

-TGG

Posted

Ok, it tested it and with every of my biomes it crashs the game and I tested biome for biome and didn't test if it will work with "Mojang biomes".

 

So here are my biome classes:

BiomeSilverWood

 

  Reveal hidden contents

 

PFBiomeBase

 

  Reveal hidden contents

 

 

Oh and I post here only one biome class, because the other biome classes are exact the same, because I copied and renamed them only for testing if the code works.

 

The biome ids are 200, 201, 202, 203, 204.

I hope that this helps.

 

Bektor

Developer of Primeval Forest.

Posted

Hi

 

Did you try this?

  Quote

Yes, Forge triggers several Null Pointer Exceptions during startup.  Just keeping resuming until it stops with a NullPointerException on your code PFGenLayerBiomes.java:41.  Then look to see which variable is null.

Which variable on that line was null?

 

Are you sure your PFBiomeBase.init() is called?  You seem to have some strange recursive initialisation thing happening where the constructor of PFBiomeBase creates a number of other PFBiomeBase objects.  As a general rule that is asking for trouble. 

 

-TGG

Posted

Yes, I'm sure that PFBiomeBase.init() is called, if not then  my mod in 1.6 won't work too, but there everything works.

 

Well, but I'm on some part confused. The WorldChunkManager says the Biome isn't null and the Main-Class says the biome is null.

And then there is an error that says if I change the order what should be loaded first that there is a packet handling problem a few lines over it the nullpointerexception.

 

 

  Reveal hidden contents

 

 

Heres the second crash I get in this order in that the things will be loaded currently and the other order, well you see it in the comments :P

 

  Reveal hidden contents

 

And what eclipse says to that (a bit more detailed...)

 

  Reveal hidden contents

 

 

Developer of Primeval Forest.

Posted

Did you see that:

 

        PFBiomeBase.magicalforest,

        PFBiomeBase.mountains,

        PFBiomeBase.pineForest,

        PFBiomeBase.primevalforest,

        PFBiomeBase.silverwood

 

is whether null or not when the getInts function called?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Yes

        
PFBiomeBase.magicalforest,
       PFBiomeBase.mountains,
        PFBiomeBase.pineForest,
        PFBiomeBase.primevalforest,
        PFBiomeBase.silverwood

its null when the getInts() function is called, but I'm don't know how to fix it (if I load the Biome class in my main class I need to set an biome ID and to put every biome in the main class is not that what I want, only if there is no other way)

 

Developer of Primeval Forest.

Posted

I think you should call the PFBiome.init() method in the main class, not in the constructor of the biome.

It seems that the method is not called when the PFGenLayerBiomes is initialized.

 

* Be careful when you just uses static reference of a class. it might be null, especially when its methods are till not called.

Instead, static method would be better.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
  On 6/5/2014 at 2:31 PM, Abastro said:

I think you should call the PFBiome.init() method in the main class, not in the constructor of the biome.

It seems that the method is not called when the PFGenLayerBiomes is initialized.

 

* Be careful when you just uses static reference of a class. it might be null, especially when its methods are till not called.

Instead, static method would be better.

 

That gives me this error:

 

  Reveal hidden contents

 

 

In line 70 of PrimevalForest.class the PFBiomeBase.init() will be called and its crashs with

public static void init()
public void init()

Developer of Primeval Forest.

Posted

I think your static init() method is colliding with the another init() which is not static..

Try change the name of the method.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Then please show your current code.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
  On 6/6/2014 at 1:54 AM, Abastro said:

Then please show your current code.

 

Ok. Oh and a small notice to it, now it worked, because I moved the biomes in the main class, that I can work on other parts of this mod, but well, thats not so nice.

Here it is:

 

PrimevalForest

 

  Reveal hidden contents

 

WorldChunkMangerPrimevalForest

 

  Reveal hidden contents

 

PFGenLayerBiomes

 

  Reveal hidden contents

 

PFBiomeBase

 

  Reveal hidden contents

 

 

I hope that this code will you to find out how I can fix it, so that I can move the biomes back into the PFBiomeBase class.

Bektor

Developer of Primeval Forest.

Posted
  On 6/6/2014 at 12:05 PM, Bektor said:

Ok. Oh and a small notice to it, now it worked, because I moved the biomes in the main class, that I can work on other parts of this mod, but well, thats not so nice.

Here it is:

[..]

I hope that this code will you to find out how I can fix it, so that I can move the biomes back into the PFBiomeBase class.

Bektor

I would say - it looks fine.  If it works, leave it like that. 

 

I think it works because the order of object creation is now correct, i.e. the BiomeGenBase are initialised before you use them.  If you really want to move them, you need to make sure that they are not null when you use them.  You could consider an initialisation-on-first-use method if you're having trouble, i.e. check if it is null (never used before) and if so, initialise them.

 

But honestly, unless you're making a complicated mod I wouldn't bother.

 

-TGG

Posted

I think this problem is related with the PFBiomeBase.init() is called after the PFGenLayerBiomes is constructed.

Where is the "new PFGenLayerBiomes()"?

and where was the init() method and how did you call it?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

I called the init() method over the constructor of the PFBiomeBase.class and this class is first called in postInit() [but there only the method inside the PFBiomeBase.class that checks for ID-conflicts].

Later its called in WorldChunkMangerPrimevalForest.class, but there only one biome and not the class itself (only the PFBiomeBase.primevalforest). Oh and I only checked if its called in any world classes and if its called in the main class, because I didn't think that its called in any other class, because the rest is mostly Entity, Items, Blocks...

 

And the PFGenLayerBiomes.class is called inside the abstract class PFGenLayer in this method: GenLayer[] makeTheWorld

[GenLayer biomes = new PFGenLayerBiomes(1L);]

 

Well I checked this out in the 1.6 version of my mod, because in which directiony and where the classes will be loaded, there is no difference between 1.6 and 1.7 of my mod and in the class PFGenLayerBiomes and PFGenLayer is no difference between that versions too.

Developer of Primeval Forest.

Posted

Then where the PFGenLayerBiomes.makeTheWorld() is called?

The overall code about that part would be needed i think.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.