killerjdog51 Posted June 30, 2021 Posted June 30, 2021 So I have an Oasis feature that generates and edits the biome around it. The feature generation part works well, the issue is that it no longer edits the biome like it did in previous versions (1.12, 1.14, & 1.15). Or it does, but instead of my custom biome it generates the "Received invalid biome id: -1" error and uses the Minecraft:Ocean biome. The biome spawns perfectly fine if I generate it using the single biome world type. OasisBiome Quote
killerjdog51 Posted July 4, 2021 Author Posted July 4, 2021 I've narrowed things down to: public int getInt(final Object k) { if ((strategy.equals(((K) k), (null)))) return containsNullKey ? value[n] : defRetValue; K curr; final K[] key = this.key; int pos; // The starting point. if (((curr = key[pos = (it.unimi.dsi.fastutil.HashCommon.mix(strategy.hashCode((K) k))) & mask]) == null)) return defRetValue; if ((strategy.equals((K) (k), (curr)))) return value[pos]; // There's always an unused entry. while (true) { if (((curr = key[pos = (pos + 1) & mask]) == null)) return defRetValue; if ((strategy.equals((K) (k), (curr)))) return value[pos]; } } Somehow the key[pos = (it.unimi.dsi.fastutil.HashCommon.mix(strategy.hashCode((K) k))) & mask] is used to calculate the biome data position within the list K. For some reason it seems like my inserted biome returns the wrong position value (though it is within the K list). I've tested it with Minecraft biomes like forest and mushroom fields, they also don't return the correct position unless its natural generation (not inserted like mine). Does anyone have ideas on why this is? If I had to guess inserting the biome data generates a different hash, but I don't understand why. perhaps its caused by ForgeRegistries.BIOMES.getValue()? Quote
killerjdog51 Posted July 7, 2021 Author Posted July 7, 2021 On 7/4/2021 at 5:12 PM, diesieben07 said: Biomes are loaded dynamically from datapacks. As far as I know you have to use World#registryAccess to get the DynamicRegistries and then use those to look up the biome (don't quote me on this). Alternatively you can just check the RegistryKey without converting to Biome. Expand Thanks, it worked! I'm an idiot for not realizing that biomes were dynamic and being called within the BiomeContainer with its own version of a dynamic Biome Registry. All I had to do was grab copy the reference to that and get a reference to my biome and the dynamic biome id that way. Quote
Recommended Posts
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.