Jump to content

[1.7.10][SOLVED] java.lang.NoClassDefFoundError: net/minecraft/world/World$2


Recommended Posts

SOLVED: The issue was that a Block in my mod ended up causing a infinite loop of notifyBlockOfNeighborChange, which seems to cause it to fall back to the original call(Thus not showing a correct stacktrace) with a "java.lang.NoClassDefFoundError: net/minecraft/world/World$2" exception.




I have been working on my mod for quite a while now, and decided to do the first test run outside the Development environment.

We are all able to start up a new world and run around using the mod, but at some point we all get a crash due to

java.lang.NoClassDefFoundError: net/minecraft/world/World$2


The Setup:

New install of Forge 1.7.10 -

No other mods installed except mine


I have two crash logs, the first one we hit happens randomly when we open a Chest:



The second one happens for me every time I open a specific world(Which did not crash on first open, and was closed normally)



Both crashes happen at:

java.lang.NoClassDefFoundError: net/minecraft/world/World$2
at net.minecraft.world.World.func_147460_e(World.java:690)

Where func_147460_e is notifyBlockOfNeighborChange.

I have really no idea why this crash happens. Nothing in my mod changes base files in any way!


The code from my mod that is called in the second crash log is simply this:

	public void entryUpdated() {
215		redstoneManager.update();
216		inventoryManager.update();
217		//TODO: Call onNeighborUpdate(tile)
218		worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
219		worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);


This only happens in the Release build, and not when I'm running from Eclipse, so I have no way to debug this.

I'd really appreciate it if anyone could help me with this. :)

Link to comment
Share on other sites



Perhaps your build environment has been corrupted or has a (de)obfuscation problem.  That error shows up when a class is present during compile time but not during run time, and since it's a vanilla class, I'm struggling to think of any way your mod might cause that.  Unless GotoLink is right and you are doing something wrong with the world Object.  Where does worldObj come from?


Interestingly, my World.java:690 is not in that function at all, even though I have 1.7.10 - installed same as you.  Maybe that means something, maybe not.


     * The block type change and need to notify other systems  Args: x, y, z, blockID
    public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_)
        this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_);

     * marks a vertical line of blocks as dirty
    public void markBlocksDirtyVertical(int p_72975_1_, int p_72975_2_, int p_72975_3_, int p_72975_4_)
        int i1;

        if (p_72975_3_ > p_72975_4_)
        {                                                          // line 690 here
            i1 = p_72975_4_;



Link to comment
Share on other sites

Thank you all for taking the time to answer =)


@Ewe Loon

It all works in the development environment, and all of those you mention would give a different error at a different time. I'm able to start up and use my mod normally, until a random point where it just crashes.



I'm using ServerTickEvent to do a single shot initialization of certain Tile Entities after they are first loaded. When they are loaded they register themself to do a pre-tick which requires access to the chunk they are on(Which is not available just as they are loaded most of the time). Essentially a onTileEntityLoaded.

And again, if that was the cause, it would give a totally different crash message!



That was my thought too, but I have tried cleaning, starting from scratch an copying over my sources and everything, nothing seems to work =/

The second crash happens in a TileEntity, which has worldObj set when it's loaded/placed.

Also, my World.java:690 doesn't point to notifyBlockOfNeighborChange either, but that's what the crash log say it's currently inside. I'm assuming that Forge does some kind of binary patching that moves the lines?



Had it simply been that my code did something weird with the World, it should just crash on Null pointer or some illegal operation, not throw a NoClassDefFoundError, that is what is confusing me.


It might be that I somehow screw something up so it throws inside the try block in notifyBlockOfNeighborChange. Could something inside the Catch not be (de)obfuscated correctly?

Link to comment
Share on other sites

~4days ago, I accidentally cause an infinite notifyBlockOfNeighborChange loop.

The error I was getting was exactly the same as you posted.


My block was receiving a neighbor change event doing some logic, updating and telling neighbors it changed.

When I placed two beside each other and the conditions where right the one would update and tell the other, who would then update and tell the first one, who would update again and this continued forever.

Link to comment
Share on other sites

Whoa, I didn't even think of that.

If that was the case the stack trace should show that, but just to test I made my entryUpdated(The one who calls notifyBlockOfNeighborChange) print out a string before and after.

It starts to call notifyBlockOfNeighborChange 34 times in a row(Without calling end) before it crashes, so it does indeed seem to be an infinite loop.


Thank you so much for pointing out the problem =D

I will have to rethink my logic a bit.

Still strange that it would give out a NoClassDefFoundError error in this case tho.

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.

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.


  • Create New...

Important Information

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