Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-177683

"Noise-Based" Biome Generator has code implying that can be used for the "Buffet" mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 20w14a, 20w15a
    • None
    • Plausible
    • World generation

      Affects 20w06a, 20w07a, 20w08a, 20w09a, 20w10a, 20w11a, 20w12a, 20w13a, 20w13b, 20w14a and 20w15a.

      Actually there are different biome generators available in worlds through NBT editing the generator options, such as Vanilla Layered (assigned as the string "vanilla_layered" in the code), Checkerboard (assigned as the string "checkerboard" in the code), Fixed (string "fixed" in the code). These biome generators can be selected, but there's also a Multi Noise (known as "multi_noise" in the code).

      The fix I made by myself is located at net.minecraft.world.level.levelgen.ChunkGeneratorProvider.java, line 74~

      As of 20w14a:

      private static LongFunction<BiomeSource> createBuffetBiomeSource(final DynamicLike<?> dynamicLike) {
              final BiomeSourceType<?, ?> bpe2 = ChunkGeneratorProvider.<BiomeSourceType<?, ?>>getRegistryValue(dynamicLike.get("type"), Registry.BIOME_SOURCE_TYPE, BiomeSourceType.FIXED);
              final DynamicLike<?> dynamicLike2 = dynamicLike.get("options");
              final Stream<Biome> stream2 = dynamicLike2.get("biomes").asStreamOpt().<Stream<Biome>>map(stream -> stream.map(dynamic -> ChunkGeneratorProvider.<Biome>getRegistryValue(dynamic, Registry.BIOME, Biomes.OCEAN))).orElseGet(Stream::empty);
              if (BiomeSourceType.CHECKERBOARD == bpe2) {
                  final int integer2 = dynamicLike2.get("size").asInt(2);
                  final Biome[] arr6 = stream2.<Biome>toArray(Biome[]::new);
                  final Biome[] arr7 = (arr6.length > 0) ? arr6 : new Biome[] { Biomes.OCEAN };
                  final CheckerboardBiomeSourceSettings bpk5;
                  return (LongFunction<BiomeSource>)(long3 -> {
                      bpk5 = BiomeSourceType.CHECKERBOARD.createSettings(long3).setAllowedBiomes(arr7).setSize(integer2);
                      return BiomeSourceType.CHECKERBOARD.create(bpk5);
                  });
              }
              if (BiomeSourceType.VANILLA_LAYERED == bpe2) {
                  final OverworldBiomeSourceSettings brj3;
                  return (LongFunction<BiomeSource>)(long1 -> {
                      brj3 = BiomeSourceType.VANILLA_LAYERED.createSettings(long1);
                      return BiomeSourceType.VANILLA_LAYERED.create(brj3);
                  });
              }
              final Biome boz5 = stream2.findFirst().orElse(Biomes.OCEAN);
              final FixedBiomeSourceSettings bqd4;
              return (LongFunction<BiomeSource>)(long2 -> {
                  bqd4 = BiomeSourceType.FIXED.createSettings(long2).setBiome(boz5);
                  return BiomeSourceType.FIXED.create(bqd4);
              });
          }
      

      The possible fix I wrote by myself:

      private static LongFunction<BiomeSource> createBuffetBiomeSource(final DynamicLike<?> dynamicLike) {
              final BiomeSourceType<?, ?> bpe2 = ChunkGeneratorProvider.<BiomeSourceType<?, ?>>getRegistryValue(dynamicLike.get("type"), Registry.BIOME_SOURCE_TYPE, BiomeSourceType.FIXED);
              final DynamicLike<?> dynamicLike2 = dynamicLike.get("options");
              final Stream<Biome> stream2 = dynamicLike2.get("biomes").asStreamOpt().<Stream<Biome>>map(stream -> stream.map(dynamic -> ChunkGeneratorProvider.<Biome>getRegistryValue(dynamic, Registry.BIOME, Biomes.OCEAN))).orElseGet(Stream::empty);
              if (BiomeSourceType.CHECKERBOARD == bpe2) {
                  final int integer2 = dynamicLike2.get("size").asInt(2);
                  final Biome[] arr6 = stream2.<Biome>toArray(Biome[]::new);
                  final Biome[] arr7 = (arr6.length > 0) ? arr6 : new Biome[] { Biomes.OCEAN };
                  final CheckerboardBiomeSourceSettings bpk5;
                  return (LongFunction<BiomeSource>)(long3 -> {
                      bpk5 = BiomeSourceType.CHECKERBOARD.createSettings(long3).setAllowedBiomes(arr7).setSize(integer2);
                      return BiomeSourceType.CHECKERBOARD.create(bpk5);
                  });
              }
              if (BiomeSourceType.VANILLA_LAYERED == bpe2) {
                  final OverworldBiomeSourceSettings brj3;
                  return (LongFunction<BiomeSource>)(long1 -> {
                      brj3 = BiomeSourceType.VANILLA_LAYERED.createSettings(long1);
                      return BiomeSourceType.VANILLA_LAYERED.create(brj3);
                  });
              }
              /* START CHANGES */
              if (BiomeSourceType.MULTI_NOISE == bpe2) {;
                  final Biome[] arr6 = stream2.<Biome>toArray(Biome[]::new);
                  final Biome[] arr7 = (arr6.length > 0) ? arr6 : new Biome[] { Biomes.OCEAN };
                  final MultiNoiseBiomeSourceSettings multiNoiseSettings;
                  return (LongFunction<BiomeSource>)(long3 -> {
                      multiNoiseSettings = BiomeSourceType.MULTI_NOISE.createSettings(long3).setBiomes(arr7);
                      return BiomeSourceType.MULTI_NOISE.create(multiNoiseSettings);
                  });
              }
              /* END CHANGES */
              final Biome boz5 = stream2.findFirst().orElse(Biomes.OCEAN);
              final FixedBiomeSourceSettings bqd4;
              return (LongFunction<BiomeSource>)(long2 -> {
                  bqd4 = BiomeSourceType.FIXED.createSettings(long2).setBiome(boz5);
                  return BiomeSourceType.FIXED.create(bqd4);
              });
          }
      

      Note:

      Also add

      import net.minecraft.world.level.biome.MultiNoiseBiomeSourceSettings;

      Everyting you need to do is to copy-paste the code to the minecraft's source code.

            Unassigned Unassigned
            ISRosillo14 Ismael Rosillo
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: