diff --git a/README.md b/README.md index c2417806c..fa5a624e4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Minecraft Minecraft Minecraft + Minecraft

@@ -70,6 +71,7 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s | [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-forge-1.10.1.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-fabric-1.10.1.jar) | | [1.20.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) | | [1.20.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) | +| [1.21.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-forge-1.11.1.jar) | [1.21.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-fabric-1.11.1.jar) | **Message for 2b2t players looking for 1.19/1.20 Baritone** If you like, please try the beta for Baritone Elytra for 2b2t, find it in #announcements of [the Baritone discord](http://discord.gg/s6fRBAUpmr). It supports 1.19.4 and 1.20.1, Forge or Fabric. If you have to see it to believe it, watch [this YouTube video](https://youtu.be/NnSlQi-68eQ). diff --git a/src/api/java/baritone/api/utils/BlockOptionalMeta.java b/src/api/java/baritone/api/utils/BlockOptionalMeta.java index 1d5af8359..17df9a3b2 100644 --- a/src/api/java/baritone/api/utils/BlockOptionalMeta.java +++ b/src/api/java/baritone/api/utils/BlockOptionalMeta.java @@ -21,28 +21,23 @@ import baritone.api.utils.accessor.ILootTable; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import net.minecraft.Util; import net.minecraft.client.Minecraft; -import net.minecraft.commands.Commands; +import net.minecraft.core.HolderLookup; import net.minecraft.core.LayeredRegistryAccess; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.RegistryDataLoader; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.RegistryLayer; import net.minecraft.server.ReloadableServerRegistries; -import net.minecraft.server.ReloadableServerResources; import net.minecraft.server.level.ServerLevel; 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.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.tags.TagLoader; import net.minecraft.world.RandomSequences; import net.minecraft.world.flag.FeatureFlagSet; @@ -51,14 +46,12 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.CustomSpawner; import net.minecraft.world.level.Level; -import net.minecraft.world.level.WorldDataConfiguration; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.ServerLevelData; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; @@ -307,11 +300,26 @@ public static Unsafe getUnsafe() { } public static CompletableFuture load() { - PackRepository packRepository = Minecraft.getInstance().getResourcePackRepository(); - CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, packRepository.openAllSelected()); - LayeredRegistryAccess layeredRegistryAccess = RegistryLayer.createRegistryAccess(); + // Simplified from {@link net.minecraft.server.WorldLoader#load()} + CloseableResourceManager closeableResourceManager = new MultiPackResourceManager( + PackType.SERVER_DATA, + List.of(ServerPacksSource.createVanillaPackSource()) + ); + LayeredRegistryAccess baseLayeredRegistry = RegistryLayer.createRegistryAccess(); List> pendingTags = TagLoader.loadTagsForExistingRegistries( - closeableResourceManager, layeredRegistryAccess.getLayer(RegistryLayer.STATIC) + closeableResourceManager, baseLayeredRegistry.getLayer(RegistryLayer.STATIC) + ); + List> worldGenRegistryLookupList = TagLoader.buildUpdatedLookups( + baseLayeredRegistry.getAccessForLoading(RegistryLayer.WORLDGEN), + pendingTags + ); + LayeredRegistryAccess layeredRegistryAccess = baseLayeredRegistry.replaceFrom( + RegistryLayer.WORLDGEN, + RegistryDataLoader.load( + closeableResourceManager, + worldGenRegistryLookupList, + RegistryDataLoader.WORLDGEN_REGISTRIES + ) ); return ReloadableServerRegistries.reload( layeredRegistryAccess, diff --git a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java index 081d32cc8..febe985d2 100644 --- a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java +++ b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java @@ -29,6 +29,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.util.Tuple; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; @@ -98,7 +99,7 @@ public static Tuple getSchematic(int i) { int minY = Integer.MAX_VALUE; int minZ = Integer.MAX_VALUE; HashMap subRegions = new HashMap<>(); - WorldSchematic schematicWorld = SchematicWorldHandler.getSchematicWorld(); + Level schematicWorld = SchematicWorldHandler.getSchematicWorld(); for (Map.Entry entry : placement.getEnabledRelativeSubRegionPlacements().entrySet()) { SubRegionPlacement subPlacement = entry.getValue(); Vec3i pos = transform(subPlacement.getPos(), placement.getMirror(), placement.getRotation()); @@ -152,4 +153,4 @@ public String toString() { return name; } } -} \ No newline at end of file +}