Spaces:
Build error
Build error
File size: 2,304 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
package net.minecraft.data.registries;
import com.mojang.datafixers.DataFixUtils;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import net.minecraft.core.Cloner;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
public class RegistryPatchGenerator {
public static CompletableFuture<RegistrySetBuilder.PatchedRegistries> createLookup(
CompletableFuture<HolderLookup.Provider> p_310881_, RegistrySetBuilder p_310262_
) {
return p_310881_.thenApply(
p_309945_ -> {
RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
Cloner.Factory cloner$factory = new Cloner.Factory();
RegistryDataLoader.WORLDGEN_REGISTRIES.forEach(p_313050_ -> p_313050_.runWithArguments(cloner$factory::addCodec));
RegistrySetBuilder.PatchedRegistries registrysetbuilder$patchedregistries = p_310262_.buildPatch(
registryaccess$frozen, p_309945_, cloner$factory
);
HolderLookup.Provider holderlookup$provider = registrysetbuilder$patchedregistries.full();
Optional<? extends HolderLookup.RegistryLookup<Biome>> optional = holderlookup$provider.lookup(Registries.BIOME);
Optional<? extends HolderLookup.RegistryLookup<PlacedFeature>> optional1 = holderlookup$provider.lookup(Registries.PLACED_FEATURE);
if (optional.isPresent() || optional1.isPresent()) {
VanillaRegistries.validateThatAllBiomeFeaturesHaveBiomeFilter(
DataFixUtils.orElseGet(optional1, () -> p_309945_.lookupOrThrow(Registries.PLACED_FEATURE)),
DataFixUtils.orElseGet(optional, () -> p_309945_.lookupOrThrow(Registries.BIOME))
);
}
return registrysetbuilder$patchedregistries;
}
);
}
} |