Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.16.5] Crashing on launch. #190

Closed
Possibly-Pos opened this issue Feb 16, 2021 · 14 comments · Fixed by #226
Closed

[1.16.5] Crashing on launch. #190

Possibly-Pos opened this issue Feb 16, 2021 · 14 comments · Fixed by #226
Assignees
Labels
enhancement New feature or request

Comments

@Possibly-Pos
Copy link

Game is crashing on launch. java 8 used.

https://paste.ee/p/wvLGq

image

Forge 36.0.15
FD 0.3.2

@vectorwing
Copy link
Owner

Weird. Did you get this just once, or have you tried booting again? Sometimes Forge can be temperamental.
Anyway, I'll need your latest.log to debug it.

@Possibly-Pos
Copy link
Author

Every time I launch.

https://paste.ee/p/hVBC5

@TrialDragon
Copy link

TrialDragon commented Feb 18, 2021

Sorry to dirty up the comments, but I'm having the same issue when I launch my server, though not on clientside.
Forge Ver: forge-1.16.5-36.0.42
FarmersDelight Ver: FarmersDelight-1.16.3-0.3.2
PasteBin crash report: https://pastebin.com/q482h1KB
PasteBin latest.log: https://pastebin.com/KnpAtRj0

@Hubry
Copy link

Hubry commented Feb 18, 2021

This is extremely likely to be caused by your choice of a JVM to run the game being OpenJ9. Please try with HotSpot?
(Also note that ModLauncher is supposed to stop the game from even attempting to start on OpenJ9, but the check is broken)

@TrialDragon
Copy link

Hey, @Hubry , thanks for the solution. Hotspot works for me and my server is up and running. Can you explain why J9 would cause such an issue btw? Or a link that can clarify this.

@Hubry
Copy link

Hubry commented Feb 19, 2021

Well, the cause of the crash is simply that typetools (a library that Forge's event bus is using) uses JVM internals for a few things, and these internals are different on OpenJ9, which makes it fail a lookup it is doing when a mod subscribes to events manually. See the issue above your comment.

This JVM was blacklisted in modlauncher apparently because of some ASM transformation weirdness (see commit message here), but there are other problematic spots like around runtime enum changes.

@ZekerZhayard
Copy link

MinecraftForge/typetools#3
I recommend that move CropPatchGeneration.onBiomeLoad method to another class.

@3TUSK
Copy link

3TUSK commented Feb 21, 2021

It is also worth pointing out that, by relying on static initializer, you are accidentally accessing your RegistryObjects too early. The following stacktrace are from the linked issue ticket above:

Caused by: java.lang.NullPointerException: Registry Object not present: farmersdelight:wild_cabbages
	at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_281] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge:?] {re:mixin,re:classloading}
	at vectorwing.farmersdelight.world.CropPatchGeneration.<clinit>(CropPatchGeneration.java:22) ~[farmersdelight:1.16.3-0.3.2] {re:classloading}
	... 14 more

This was in turn occured during

java.lang.ExceptionInInitializerError: null
	at vectorwing.farmersdelight.FarmersDelight.<init>(FarmersDelight.java:35) ~[farmersdelight:1.16.3-0.3.2] {re:classloading}

Of course your ModBlocks won't be ready when your mod is still constructing, and the registry events have not been dispatched yet.

Please consider migrating your Feature<?> registration, i.e. these

public static final ConfiguredFeature<?, ?> PATCH_WILD_CABBAGES = register("patch_wild_cabbages", Feature.RANDOM_PATCH.withConfiguration(CABBAGE_PATCH_CONFIG)
.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).chance(Configuration.CHANCE_WILD_CABBAGES.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_ONIONS = register("patch_wild_onions", Feature.RANDOM_PATCH.withConfiguration(ONION_PATCH_CONFIG)
.withPlacement(Features.Placements.PATCH_PLACEMENT).chance(Configuration.CHANCE_WILD_ONIONS.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_TOMATOES = register("patch_wild_tomatoes", Feature.RANDOM_PATCH.withConfiguration(TOMATO_PATCH_CONFIG)
.withPlacement(Features.Placements.PATCH_PLACEMENT).chance(Configuration.CHANCE_WILD_TOMATOES.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_CARROTS = register("patch_wild_carrots", Feature.RANDOM_PATCH.withConfiguration(CARROT_PATCH_CONFIG)
.withPlacement(Features.Placements.PATCH_PLACEMENT).chance(Configuration.CHANCE_WILD_CARROTS.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_POTATOES = register("patch_wild_potatoes", Feature.RANDOM_PATCH.withConfiguration(POTATO_PATCH_CONFIG)
.withPlacement(Features.Placements.PATCH_PLACEMENT).chance(Configuration.CHANCE_WILD_POTATOES.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_BEETROOTS = register("patch_wild_beetroots", Feature.RANDOM_PATCH.withConfiguration(BEETROOT_PATCH_CONFIG)
.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).chance(Configuration.CHANCE_WILD_BEETROOTS.get()));
public static final ConfiguredFeature<?, ?> PATCH_WILD_RICE = register("patch_wild_rice", ModBiomeFeatures.RICE.get().withConfiguration(RICE_PATCH_CONFIG)
.withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT).chance(Configuration.CHANCE_WILD_RICE.get()));

to DeferredRegister as well. Edit: for ConfiguredFeature you apparently cannot use registry event, see below

@vectorwing
Copy link
Owner

I wasn't aware there was a DeferredRegister for Features, that's good to know. Glad to know people are spotting these details! 😄
Gonna put a marker on this to enhance the code as suggested.

@vectorwing vectorwing self-assigned this Feb 26, 2021
@vectorwing vectorwing added the enhancement New feature or request label Feb 26, 2021
@ZekerZhayard
Copy link

@3TUSK
Copy link

3TUSK commented Mar 12, 2021

@vectorwing A quick correction on my previous statement: apparently you cannot use DeferredRegister on ConfiguredFeature<?, ?>; you have to use vanilla Registry.register for ConfiguredFeature. @ZekerZhayard was correct on separating out the event listener to a new class because doing so avoids the accidental class initialization.

For regular Feature, DeferredRegister seems viable and should be preferred when possible.

An example may be found at here: https://github.com/MysticMods/Traverse/blob/1.16/src/main/java/epicsquid/traverse/init/ModFeatures.java
Notice the empty load() method at the end of the class, which is for triggering class initialization; call it within a registry event.

@vectorwing
Copy link
Owner

vectorwing commented Mar 13, 2021

Finally got some time to look at this properly. 🤦‍♂️

OK, so I already use DeferredRegister for my RiceCropFeature, and seems I won't need to change the ConfiguredFeature registers. So just to make sure I understood it correctly: ideally, I should separate onBiomeLoad from CropPatchGeneration into its own class? Perhaps the usual CommonEventHandler I already use?

Also, good to know the surrounding OpenJ9 issues are resolved! 👍

@3TUSK
Copy link

3TUSK commented Mar 13, 2021

ideally, I should separate onBiomeLoad from CropPatchGeneration into its own class

That is correct.

@vectorwing
Copy link
Owner

I pushed a branch with the proposed changes, after chatting a bunch on Discord as well. Gonna open a PR for it soon; to anyone here, feel free to look over it and review whether I understood what was meant here, as I'm a bit new to some of this. x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants