Skip to content

Commit

Permalink
Merge pull request #4553 from rfresh2/packLoadFix-1.20.5
Browse files Browse the repository at this point in the history
Fix registry loading when custom registries present
  • Loading branch information
leijurv authored Nov 21, 2024
2 parents b550b92 + 81c53d5 commit 1bfc030
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/java/baritone/api/utils/BlockOptionalMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.VanillaPackResources;
import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.CloseableResourceManager;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.RandomSequences;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
Expand Down Expand Up @@ -306,14 +309,17 @@ public static Unsafe getUnsafe() {

public static CompletableFuture<RegistryAccess> load() {
PackRepository packRepository = Minecraft.getInstance().getResourcePackRepository();
CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, packRepository.openAllSelected());
CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(
PackType.SERVER_DATA,
List.of(packRepository.getPack(BuiltInPackSource.VANILLA_ID).open())
);
LayeredRegistryAccess<RegistryLayer> layeredRegistryAccess = loadAndReplaceLayer(
closeableResourceManager, RegistryLayer.createRegistryAccess(), RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES
);
return ReloadableServerResources.loadResources(
closeableResourceManager,
layeredRegistryAccess,
WorldDataConfiguration.DEFAULT.enabledFeatures(),
FeatureFlags.VANILLA_SET,
Commands.CommandSelection.INTEGRATED,
2,
Runnable::run,
Expand Down

0 comments on commit 1bfc030

Please sign in to comment.