quiqueck / BetterNether

BetterNether Mod
https://modrinth.com/mod/betternether
Other
20 stars 27 forks source link

[Bug] Game crash on creating new world when using Biolith #138

Open Kasardas opened 1 year ago

Kasardas commented 1 year ago

What happened?

On creating new world, a crash occur

BetterNether

9.0.4 and 9.0.5

BCLib

3.0.5 and 3.0.6

Fabric API

0.83.1

Fabric Loader

0.14.21

Minecraft

1.20.0

Relevant log output

[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/skull}.pools[0].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/skull}.pools[1].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/naga}.pools[2].entries[0].condition[0]: Parameters [<parameter minecraft:last_damage_player>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/naga}.pools[2].entries[0].condition[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/jungle_skeleton}.pools[0].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:wilderwild:blocks/display_lantern_fireflies}.pools[0].entries[0]: Unreachable entry!
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/firefly}.pools[0].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/jungle_skeleton}.pools[1].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/naga}.pools[0].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/skull}.pools[2].entries[0].condition[0]: Parameters [<parameter minecraft:last_damage_player>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/skull}.pools[2].entries[0].condition[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/flying_pig}.pools[0].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:33] [Render thread/WARN]: Found loot table element validation problem in {loot_tables:betternether:entities/naga}.pools[1].entries[0].functions[1]: Parameters [<parameter minecraft:killer_entity>] are not provided in this context
[20:29:34] [Render thread/INFO]: [bclib] Disabling Recipe: bclib:test_star
[20:29:34] [Render thread/INFO]: Loaded 28 recipes
[20:29:34] [Render thread/INFO]: Loaded 5803 advancements
[20:29:34] [Render thread/INFO]: Loaded 9 turtle upgrades
[20:29:34] [Render thread/INFO]: Loaded 3 pocket computer upgrades
[20:29:34] [Render thread/INFO]: [Fabric Seasons] Successfully loaded 15 custom crop configs.
[20:29:34] [ForkJoinPool.commonPool-worker-8/INFO]: Loaded 55 translation keys
[20:29:39] [Render thread/INFO]: [betternether] Freeze Registry[ResourceKey[minecraft:root / worlds_together:worldgen/betterx/surface_rules] (Stable)]
[20:29:41] [Render thread/INFO]: [betternether] Freeze Registry[ResourceKey[minecraft:root / worlds_together:worldgen/betterx/surface_rules] (Stable)]
[20:29:41] [Render thread/INFO]: [DataFixerAPI] Applying Patch{betternether:5.3.5:21020677}
[20:29:41] [Render thread/INFO]: [DataFixerAPI] Applying Patch{betternether:8.2.2:33587202}
[20:29:41] [Render thread/INFO]: [DataFixerAPI] Applying Patch{betternether:9.0.1:37748737}
[20:29:41] [Render thread/INFO]: [DataFixerAPI] Updating Patch-Level for 'betternether' from 0.0.0 to 9.0.1
[20:29:41] [Render thread/ERROR]: [worlds_together] Unable to parse Version in jar:file:///C:/Users/kandz/AppData/Roaming/.minecraft/mods/AmbientSounds_FABRIC_v5.2.19_mc1.20.jar
[20:29:41] [Render thread/ERROR]: [worlds_together] Unable to parse Version in jar:file:///C:/Users/kandz/AppData/Roaming/.minecraft/mods/DramaticDoors-Fabric-1.20.1-2.0.0_1.jar
[20:29:41] [Render thread/ERROR]: [worlds_together] Unable to read name in jar:file:///C:/Users/kandz/AppData/Roaming/.minecraft/mods/Essential-fabric_1-20.jar
[20:29:41] [Render thread/ERROR]: [worlds_together] Unable to parse Version in jar:file:///C:/Users/kandz/AppData/Roaming/.minecraft/mods/scorched-1.1.2c.jar
[20:29:41] [Render thread/INFO]: [bclib] Updating Pickers for BCLib - The End  BiomeSource (576e93bd)
[20:29:41] [Render thread/INFO]: [bclib] Updating Pickers for BCLib - Nether BiomeSource (39326f58)
[20:29:41] [Render thread/INFO]: [bclib] Enforcing Correct Generator for minecraft:the_end.
[20:29:41] [Render thread/INFO]: [bclib] Updating Pickers for BCLib - The End  BiomeSource (576e93bd)
[20:29:42] [Render thread/ERROR]: Reported exception thrown!
net.minecraft.class_148: mouseClicked event handler
    at net.minecraft.class_437.method_25412(class_437.java:414) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_1601(class_312.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_22686(class_312.java:169) ~[client-intermediary.jar:?]
    at net.minecraft.class_1255.execute(class_1255.java:102) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_22684(class_312.java:169) ~[client-intermediary.jar:?]
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar:?]
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar:?]
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474) ~[lwjgl-glfw-3.3.1.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:237) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1244) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:250) ~[fabric-loader-0.14.21-1.20.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
Caused by: java.lang.IllegalStateException: BiomeSource created while RegistryManager is null!
    at com.terraformersmc.biolith.impl.biome.DimensionBiomePlacement.getBiomeLookup(DimensionBiomePlacement.java:64) ~[biolith-1.0.0-alpha.5-76260812ac9bfc0e.jar:?]
    at com.terraformersmc.biolith.impl.biome.NetherBiomePlacement.writeBiomeEntries(NetherBiomePlacement.java:81) ~[biolith-1.0.0-alpha.5-76260812ac9bfc0e.jar:?]
    at net.minecraft.class_4766.wrapOperation$zim000$biolith$injectEntries(class_4766.java:563) ~[client-intermediary.jar:?]
    at net.minecraft.class_4766.method_49506(class_4766.java:50) ~[client-intermediary.jar:?]
    at net.minecraft.class_4766.method_49494(class_4766.java:58) ~[client-intermediary.jar:?]
    at net.minecraft.class_1966.method_49495(class_1966.java:31) ~[client-intermediary.jar:?]
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183) ~[guava-31.1-jre.jar:?]
    at net.minecraft.class_1966.redirect$bag000$fabric-biome-api-v1$getBiomes(class_1966.java:2036) ~[client-intermediary.jar:?]
    at net.minecraft.class_1966.method_28443(class_1966.java:41) ~[client-intermediary.jar:?]
    at org.betterx.worlds.together.biomesource.MergeableBiomeSource.togetherShouldMerge(MergeableBiomeSource.java:12) ~[bclib-3.0.5.jar:?]
    at org.betterx.worlds.together.chunkgenerator.EnforceableChunkGenerator.togetherShouldRepair(EnforceableChunkGenerator.java:36) ~[bclib-3.0.5.jar:?]
    at org.betterx.worlds.together.levelgen.WorldGenUtil.repairBiomeSourceInAllDimensions(WorldGenUtil.java:166) ~[bclib-3.0.5.jar:?]
    at org.betterx.worlds.together.world.event.WorldBootstrap.enforceInLayeredRegistry(WorldBootstrap.java:327) ~[bclib-3.0.5.jar:?]
    at net.minecraft.class_6904.localvar$zed000$bclib$wt_bake(class_6904.java:517) ~[client-intermediary.jar:?]
    at net.minecraft.class_6904.<init>(class_6904.java:7) ~[client-intermediary.jar:?]
    at net.minecraft.class_7196.method_41889(class_7196.java:118) ~[client-intermediary.jar:?]
    at net.minecraft.class_525.method_41847(class_525.java:469) ~[client-intermediary.jar:?]
    at net.minecraft.class_525.method_45683(class_525.java:451) ~[client-intermediary.jar:?]
    at net.minecraft.class_7196.method_41892(class_7196.java:303) ~[client-intermediary.jar:?]
    at net.minecraft.class_525.method_2736(class_525.java:451) ~[client-intermediary.jar:?]
    at net.minecraft.class_525.method_19922(class_525.java:404) ~[client-intermediary.jar:?]
    at net.minecraft.class_4185.method_25306(class_4185.java:94) ~[client-intermediary.jar:?]
    at net.minecraft.class_4264.method_25348(class_4264.java:56) ~[client-intermediary.jar:?]
    at net.minecraft.class_339.method_25402(class_339.java:189) ~[client-intermediary.jar:?]
    at net.minecraft.class_4069.method_25402(class_4069.java:38) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_1611(class_312.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_437.method_25412(class_437.java:409) ~[client-intermediary.jar:?]
    ... 14 more

Other Mods

Traverse, Terrestia, mcw-paths, worldedit, supermartijn642corelib, mcw-roofs, dramatic-doors, c2me, stoneworks, spark, flowerpatch, servercore, graves, mcw-fences, supermartijn642configlib, movingelevators, journeymap, scorched, roughlyenoughitems, architectury, wilderwild, croptopia, indium, puzzleslib, techreborn, reborncore, creativecore, forgeconfigAPIPort, fabric-seasons, fabric-season-extra, cc-tweaked, MTR, fallingtree, appleskin, lithium, sodium, iris, ambient sounds, falling-tree, soundphysics, essential
quiqueck commented 1 year ago

Hm, looks like the crash happens in Biolith...

quiqueck commented 1 year ago

I think the biolith authors should be able to fix the crash quite easily. If they don't I might be able to prevent the game from crashing there, but that would probably omit the biomes that are managed by biolith.

I will flag this issue as external for now. But I will continue to keep track of the issue.

gniftygnome commented 1 year ago

I am going to publish an updated Biolith to address this issue per se, but there are other issues with the combination of Biolith and bclib. Cinderscapes will declare a breaks relationship with bclib because of the behavior described in https://github.com/TerraformersMC/Biolith/issues/4#issuecomment-1596249675 which is certain to cause user frustration otherwise. It is fairly likely in the future Terrestria will also place some biomes by noise and at that time we may need to do the same in Terrestria.

If you would prefer a new issue, let me know. I suspect the above behavior may stem from some kind of stored state or a different code path in bclib during world creation vs. save loads. A key difference between Biolith and TerraBlender is Biolith does not insert its noise-based biomes into MultiNoiseBiomeSource.biomeEntries but rather modifies the output of MultiNoiseBiomeSource.getBiomeEntries() (possibleBiomes()).

I poked around in bclib's mixins but the problem did not jump right out to me so I suspect/hope it may be more apparent to someone familiar with bclib.

quiqueck commented 1 year ago

No, this issue is fine, and I think this is actually a Bug in BCLib.

Some Background: When a world was created with the BetterX World type, the game will create the loaded dimensions with our ChunkLoader and more importantly our BiomeSources (which do not inherit from vanillas MultiNoiseBiomeSource). When we get to the point where we usually merge the biomes from other sources, the vanilla Nether Source was nether loaded and thus, your Mod never got a chance to inject the custom Biomes.

The good thing is, that this is easily fixable.

Oh, and BCLib does not touch the Overworld, so the only other conflict could come up for the End.

quiqueck commented 1 year ago

And there is also another, simple solution (but it would require your Mod to include some files in the data directory, and I understand if you don't want to do that).

Our Biome sources use a custom registry to determine whether or not a Biome is supposed to be placed in a certain Dimension. The registry is read from Datapacks, so other mods can easily extend it.

You can place a json file for each Biome into /data/[modid]/worldgen/betterx/biome/. Here is an example for the Nether Wastes in Minecraft:

{
  "type": "bclib:biome",
  "biome": "minecraft:nether_wastes",
  "fogDensity": 1.0,
  "genChance": 1.0,
  "intended_for": "OTHER_NETHER",
  "vertical": false
}

The value for intended_for are

This will do the same as the BCLib code, but (especially in the end) the type for a merged Biome is always OTHER_END_LAND.

The vertical value is only available for Nether Biomes, and will ensure that the biome spans the entire height of the nether (especially with an amplified nether)

quiqueck commented 1 year ago

Oh, and finally: If there is some data I can read from your mods that tell me which biomes go where, I'd be happy to read it to ensure they are loaded properly.

gniftygnome commented 1 year ago

For the Overworld and the End, I could definitely expose data like that; impl has the following two methods:

public void BiomeCoordinator.OVERWORLD.writeBiomeParameters(Consumer<Pair<MultiNoiseUtil.NoiseHypercube, RegistryKey<Biome>>> parameters);
public void BiomeCoordinator.OVERWORLD.writeBiomeEntries(Consumer<Pair<MultiNoiseUtil.NoiseHypercube, RegistryEntry<Biome>>> parameters);

(And equivalents for BiomeCoordinator.NETHER). The first can be called any time after the end of the mod initialization phase, and the second any time after the registry is available. If you can describe what sort of an API would be easiest for you to use, I can write something that translates the output of those functions. (The RegistryKey version is deprecated but only because I am no longer using it; I can keep it if someone else wants it.)

Regarding data for the custom registry, the main issue is Biolith is just a utility for other mods (like Bclib). I cannot create those files (or I suppose I could but only after the server is starting up). We could provide some documentation for users of Biolith to add the files themselves...

The End is a whole different thing and I am not sure how we could make our libraries compatible there. Biolith replaces TheEndBiomeSource.getBiome() with the same multi-noise implementation we use in the Overworld and Nether and provides a complete noise point for biome selection. It may be the best thing for us to do is to somehow coordinate so users can pick which End library they prefer...

quiqueck commented 1 year ago

First off, thanks a lot for investing the time. I really appreciate it :)

It may be the best thing for us to do is to somehow coordinate so users can pick which End library they prefer...

BCLib will only add our custom ChunkGenerator/BiomeSource if players choose one of the BetterX World-Types when creating the world.

image

If they choose any other type (or disable the Custom Biome Source for any dimension), we do not interfere and just register our Biomes with the Fabric Biome API and hope for the best :) image. And if End Biome are visible through a call to possibleBiomes (the type of the end BiomeSource does not matter) we will automatically add them as regular highland biomes.

For the Overworld and the End, I could definitely expose data like that;

I am wondering what the best approach is without adding additional runtime dependencies. Maybe an entry point? One that receives a Supplier<List<Pair<MultiNoiseUtil.NoiseHypercube, RegistryEntry<Biome>>>>. BCLib could call that supplier when it is ready to merge the biomes. But that would not include a hint as to where the Biome should get used in the "regular" End (as in small island or highland biome).

I could also add an entry point to BCLib, one that BCLib would call when it needs a list of biomes...

quiqueck commented 1 year ago

For the Overworld and the End, I could definitely expose data like that;

I was thinking, and I guess the most flexible solution would be Biome-Tags? Using IS_NETHER is a simple way to find all nether biomes.

If we would use Biome Tags for the different End Biome types (c:IS_END_HIGHLAND, c:IS_END_MIDLAND,...), BCLib could spawn them in the correct locations...

gniftygnome commented 1 year ago

For the Overworld and the End, I could definitely expose data like that; impl has the following two methods:

Kind of a critical error there ^^^ -- I intended to say, "For the Overworld and the Nether".

But that would not include a hint as to where the Biome should get used in the "regular" End (as in small island or highland biome).

Actually, it does; the End's native noise gives an exact relation between continentalness noise and the vanilla biomes (meaning, it mirrors the use of that single noise in generating the vanilla island terrain). Biolith's End noise retains this by mapping the vanilla biomes in such a manner as to cause the multi-noise biome selection to place them in the same locations as the vanilla method did. Therefore you can generally know where our biomes belong by looking at the continentalness noise.

gniftygnome commented 1 year ago

The only issue with using tags is we have to push everybody who uses Biolith to define the custom tags for their biomes, which is somewhat similar to the other data-based approach.

Also, as aside, bclib can't really place Biolith-based End biomes in the right place; they should be distributed using multi-noise points, and many of our replacement biomes need access to the second-best-fit noise value in order to situate themselves correctly (f.e. biomes which are intended to transition from a specific biome to another specific biome). So anything we do to allow the biomes to generate in a bclib-controlled End is just a best-effort sort of thing anyway.

The biome overlay code appears to work in bclib worlds for the Overworld and Nether, so we may be compatible in the Overworld already and in the Nether once you publish the fix mentioned above.

quiqueck commented 1 year ago

By now the fix is live as BCLib 3.0.8.

We do have a concept of edge biomes so maybe it would be possible to map transitional Biomes to those edges... But I absolutely agree. It will allays be just a best-effort.

The only issue with using tags is we have to push everybody who uses Biolith to define the custom tags for their biomes, which is somewhat similar to the other data-based approach.

Oh sorry, I figured you might be able to add Biomes to a Tag at runtime. As I said, I am happy to either provide or use an entry point that passes the required information.

gniftygnome commented 1 year ago

By now the fix is live as BCLib 3.0.8.

Thanks; I'm going to push the updated Cinderscapes in a moment.

Regarding the rest of this discussion, I haven't dropped it; I'm just bogged down with work stuff at the moment. I want to do some testing with both mods configured to generate End biomes and try to understand how that affects them and what our options actually are. There's a good chance I will have to make a dev dependency on bclib like we do for TB and in that case the simplest solution to getting biomes over to bclib would be for you to add an API.