Hello everyone,
I currently have a class to create a BiomeSource to test my dimension. I want to use vanilla biomes in this dimension. The problem is that everytime I try to get a Biome and execute runData I get the following error :
[minecraft/RegistriesDatapackGenerator]: Couldn't serialize element /home/maxime/Programming/Java/Deepworld/src/generated/resources/data/deepworld/dimension/deepworld_dimension.json: Unknown registry element in ResourceKey[minecraft:root / minecraft:worldgen/biome_source]:RecordCodec[UnitDecoder[fr.dwightstudio.deepworld.common.dimension.DeepworldBiomeSource$$Lambda$4739/0x00000008016f8b18@68009f48] * Field[lush_caves: RegistryFileCodec[ResourceKey[minecraft:root / minecraft:worldgen/biome] net.minecraftforge.registries.ForgeRegistry$RegistryCodec@ac570e0]]]
So I tried several things and all of them gets into this error when trying to generate data with datagens.
If you want to take a look at my BiomeSource class here it is ( I have removed the imports ):
public class DeepworldBiomeSource extends BiomeSource {
public static final Codec<DeepworldBiomeSource> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
Biome.CODEC.fieldOf("lush_caves").forGetter(o -> o.biome1)
).apply(instance, instance.stable(DeepworldBiomeSource::new)));
private final Holder<Biome> biome1;
public DeepworldBiomeSource(Holder<Biome> biome1) {
System.out.printf(biome1.toString());
this.biome1 = biome1;
}
public static BiomeSource create(HolderGetter<Biome> biomes) {
return new DeepworldBiomeSource(biomes.getOrThrow(Biomes.LUSH_CAVES));
}
@Override
protected @NotNull Codec<? extends BiomeSource> codec() {
return CODEC;
}
@Override
protected @NotNull Stream<Holder<Biome>> collectPossibleBiomes() {
return Stream.of(this.biome1);
}
@Override
public @NotNull Set<Holder<Biome>> possibleBiomes() {
return Set.of(this.biome1);
}
@Override
public @NotNull Holder<Biome> getNoiseBiome(int x, int y, int z, Climate.@NotNull Sampler sampler) {
return this.biome1;
}
}
If you need any additional informations, ask me.
Thank you very much,
Maxime