FancyMenu [Fabric] [MOVED TO NEW PROJECT]

FancyMenu [Fabric] [MOVED TO NEW PROJECT]

17M Downloads

FancyMenu loads dynamicregistries too early

koderian opened this issue · 17 comments

commented

Describe the bug
FancyMenu loads dynamicregistries too early

To Reproduce
Steps to reproduce the behavior:

  1. Have FancyMenu + any world gen mod that take advantage of dynamic registrys
  2. launch game

Expected behavior
FancyMenu loads Dynamic Registries properly with other mods
Crash Log
https://gist.github.com/koderian/aa2781e01fc0c16b30cd90eb0fa1d637

Screenshots
If applicable, add screenshots to help explain your problem.

Basic Informations (please complete the following information):

  • OS: [e.g. Windows]
    Windows
  • FancyMenu Version [e.g. 0.2]
    1.7.1
  • Forge/Fabric Version [e.g. 31.2.24]
    Forge 36.0.22
  • Minecraft Version [e.g. 1.15.1]
    1.16.5
  • Active Mods [e.g. Optifine, 5zig, TooManyItems]
    Note: NOT using Optifine.
commented

Fyi, Optifine G5, CraftPresence, and a few other mods accidentally classloaded the dynamicregistries in the past and every time, worldgen just straight up went corbed for other mods. Stuff like BoP biomes missing trees and ores, byg losing everything, etc. It never ends well lol

commented

Will be fixed in the next update! :) Thank you for telling me!

commented

@koderian how did you trigger that dynamicregistry message? What were you doing with FancyMenu before you opened a world? I can't seem to trigger the same message myself

commented

I think I remember adding a player entity to the pause menu (in game) The way I believed I triggered the dynamic registry message was when I connected into my server, as soon as it said loading terrain, it CTD'd. I have some worldgen mods. @Tfarcenim was the one who helped me find the mod that was causing the errors, it was FancyMenu.

commented

To add a player entity to a menu: Click on "Customize" in the top-right screen corner -> Create Layout -> Add -> Player Entity

commented

ok adding the player entity to the main menu triggered the message. Optifine triggered it when clicking "single player" on the main menu and that's what killed a lot of mods. This is definitely earlier than optifine which means it is too early.

I asked a friend how they were able to instantiate objects without a serverworld and this is how. This might work if passing null for the world doesn't work.

"just remember, every single field will be null or 0 for ints/longs/floats/doubles and false for booleans"
image

commented

Thank you very much! Hope I can fix it with this ^^

commented

Thank you @Keksuccino @TelepathicGrunt for your progress in this issue development. I appreciate the quick updates.

commented

Well, I was just very dumb and found an easy fix for my problem now.. Fix will be part of the next update!
Thank you @TelepathicGrunt for helping me and sorry for kind of wasting your time >.<

commented

Nice work! And don’t worry about the time part. I’m always glad to help!

commented

Fyi, Optifine G5, CraftPresence, and a few other mods accidentally classloaded the dynamicregistries in the past and every time, worldgen just straight up went corbed for other mods. Stuff like BoP biomes missing trees and ores, byg losing everything, etc. It never ends well lol

@TelepathicGrunt Well, I googled all that DynamicRegistry stuff a bit and saw you have experience with it and I'm a total noob when it comes to world gen stuff, so I hope you can maybe help me a bit here:
I need to create a dummy world for my player entities in menus. So it's not really possible to do this after a real world got loaded :/ But most of the people should register all it's biome stuff in init, right? So would it be okay to create the dummy world right before the first real GUI screen (main menu) gets displayed? Most of the stuff should already be registered at that point, or am I just dumb here? >.<

commented

Vampirism had to do a check in the dynamicregistry in order to tell when optifine was init it too early and nuking their biome out of the registry:
TeamLapen/Vampirism@09ed86b#diff-04dc29ef3a79f170aa5f0ac4fcd0ec0f0a293f079bb65008b67eeb7aec6db6a7L157

This was done just before the world is create and their check actually init the dynamicregistry itself. However, we tested it and it seemed to be fine and so I put an exception into blame to ignore their initialization. if you do the same and only run your dynamic registry init code at event.getGui() instanceof WorldSelectionScreen), then let me know and I'll make blame ignore your mod's init as well. Basically registration should be done by the time the user gets to the create world screen. Hopefully lol

commented

@TelepathicGrunt Thank you for the quick reply!
You mean all stuff should be loaded in CreateWorld because the last thing you know of gets registered in WorldSelection, right? :D
Well, I can't really create the dummy world after the user clicks on the Singleplayer button, I need it before :/ But it should trigger Vampirism's registry stuff when I init a WorldSelectionScreen before the main menu gets loaded, right? I know, that's damn hacky and I hate it so much, but I really don't want to remake the whole PlayerEntity just to get rid of that damn world argument it uses.. Sooo, if I init a SelectionScreen and load my dummy world there, it should all be fine, right? Oof, all that just for a frickin entity in the menu..

commented

I'll test later and try and see exactly when you're classloading the dynamic registry. It might be late enough to be safe but I'll have to see

commented

Thank you so much! You're helping me a lot here.

commented

how they were able to instantiate objects without a serverworld

I was actually initializing the serverworld itself withtout the things required for initializing the serverworld, as it was either that or deadlock the server
But also, theUnsafe should be used as a last ditch (which is what I used it as), so it kinda is good that you found another way

commented

Fixed in FancyMenu v2.0.0! Thank you for your report!