Farmer's Delight

Farmer's Delight

95M Downloads

[1.16.5] NoClassDefFoundError vectorwing/farmersdelight/blocks/TomatoesBlock, Ticking Block Entity

Raidobw2 opened this issue ยท 5 comments

commented

Description
FTB OceanBlock's version got updated from 1.3.0 to 1.4.0 and a NoClassDefFoundError happened for some of our users after the loading and playing the pack.
Your mod's version went from FarmersDelight-1.16.5-0.4.6.jar to FarmersDelight-1.16.5-0.5.0.jar in those modpack versions.

I see that browsing the files of commit 0402a2f the class is there as intended. I believe this to be the version you pushed to CurseForge on the same day, August 7 2021 (FarmersDelight-1.16.5-0.4.6.jar).

Then, by browsing the files of commit 64b5b70 the file is no longer at that location. This was committed the day after, or August 8 2021 and in-dev for the next update. By going to vectorwing/farmersdelight/blocks/crops/TomatoesBlock we can find that class, so it's been moved, which is fine. Clicking on description and last modifications of that class reorganisation brings us to commit f1fede5, which was done on June 16 2021. So it's definitely a bit confusing! Maybe that was on another branch?

Steps to reproduce:

  1. Play OceanBlock 1.3.0, use a HydroponicBedTile to plant a TomatoesBlock.
  2. Close the game.
  3. Update to 1.4.0, acquire FarmersDelight-1.16.5-0.5.0.jar and load the game.
  4. Crashes because NoClassDefFound.

Expected behavior:
Not crash, or that this change be listed in the changelog, unless I've missed it then I'm sorry.
I see it says "Breaking Changes" although I've not seen that class reorganisation in there.
Our modpack dev usually checks the changelog but that change seems to have been subtile.
You document at https://github.com/vectorwing/FarmersDelight/wiki/0.5-Breaking-Changes states the following:

In version 0.5, the old form of Rice has been removed from the game. This means that, if your world still has the old form planted somewhere, these blocks will be erased permanently on world load! So make sure your Rice has been replanted before updating an old save, or else you'll lose your Rice crops!

Blocks would normally be erased as told here but they just crash instead with a Ticking Block Entity. The intended behavior would be that the crops disappear, not crash. If that's not possible after all, read below, Questions section.

Logs
Same error for 3 logs, 3 people
https://paste.feed-the-beast.com/view/695ec96c
https://paste.feed-the-beast.com/view/b21b0667
https://hastebin.com/yebelimuye.rust

Screenshots
Ticking Block Entity, game crashes, no screenshots.

Mod list:
FTB OceanBlock 1.3.0 works fine. vectorwing.farmersdelight.blocks.TomatoesBlock and FarmersDelight-1.16.5-0.4.6.jar.
FTB OceanBlock 1.4.0 breaks if it contained blocks from 1.3.0. Class def changed to vectorwing.farmersdelight.blocks.crops.TomatoesBlock and FarmersDelight-1.16.5-0.5.0.jar.

Questions
Do you have a solution for our players, since creating a new world with your new version works as intended.
The problem is due to how the class is stored, got moved with the update, and won't load correctly since it no longer exists at that location.
I understand this reorganisation is useful to your mod, but if you have any tips as to prevent/repair this error during transition, please let me know.
Forge's ability to delete Ticking block entities worked for one of our users and your mod's classes will start fresh on that instance. They do lose every Hydroponic Bed that contains the crop though.

commented

Oof! That's a conflict... ๐Ÿ˜…

Looking at the logs, it seems that Industrial Foregoing implemented a custom plugin to interface with FD a while ago, likely to manage their states in hydroponic beds. Since the classes were reordered in 0.5, the existing hydroponic beds failed to find them.

In hindsight, I should have remembered to add that to the Breaking Changes document, so that's my bad. Development was rough, and it passed by my radar. :(

Yes, some classes did run through some package reordering in the major version increase. Legacy rice being removed is not related; their integration plugin has code that specifically interfaces with TomatoesBlock and RiceBlock, hence why both are reference in the crash.

In order to fix this, either IF would have to update their FD integration to the new class structure, or I would need to rollback the package changes, and only do them in the 1.17 port. I'm leaning towards just rolling them back in a 0.5.1 update, since there's another bug to fix. Also, given the increasing interest from other mods to interact with FD in-code, it might be prudent for me to make an api package as well.

commented

The api would definitely help as your mod is growing in popularity! IF is doing an import to the old class at https://github.com/InnovativeOnlineIndustries/Industrial-Foregoing/blob/22bc8f2ed919f70ef90f1f530ef64857f41574f1/src/main/java/com/buuz135/industrial/plugin/FarmersDelightPlugin.java#L39 which might be what is messing it up, so that shouldn't be hard for them to fix.

What would be interesting to know is which path you'll want to take, but I don't mind taking it the harder way and ask IF about it because that will help you progress with your mod quicker and have it already organized for 1.17.

The solution for us in either case is to rollback FD, which is what we're going to do. So I can ask IF and wait, and once it's patched we can update both in one shot in the modpack, that's no problem for us.

I can make the request to IF and handle it from there, but I have to ask to be sure, would that be benificial for you?

commented

Commit 9ab4a8b rolls back the package reordering, and should hopefully fix this conflict. I'll leave the code cleanup for 1.17, as it wasn't critical.

This should be out on version 0.5.1 pretty soon. If this version doesn't fix the problem, feel free to reopen. ๐Ÿ‘

commented

As a side note: I assume you rolled back to 0.4.6, but if you didn't, this change might cause this error again. I highly advise making and using backups from before it happened.

commented

Yes we did roll back asap. Thank you for the quick reply and fix, according to your comments we will test and port 0.4.6 to 0.5.1 directly once it comes out.
We're happy to have your mod in our modpack!