Fix running game tests / build [1.18] ()

* Fix running game tests.

* Fix dimension api bugfix mixin. Of note: The Vanilla bug is still present, and the bugfix still needed.

* Fix references to unmatched RegistryOps method.
This commit is contained in:
shartte 2021-09-18 00:32:44 +02:00 committed by GitHub
parent a2c681827d
commit d7a7efac01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions
fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/modification
fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/mixin/dimension
fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/mixin/gametest/server
fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/client
fabric-tag-extensions-v0/src/main/java/net/fabricmc/fabric
impl/tag/extension
mixin/tag/extension

View file

@ -37,19 +37,19 @@ import net.fabricmc.fabric.impl.biome.modification.BiomeModificationImpl;
* <li>{@link DynamicRegistryManager#create()} is used to create a dynamic registry manager with just
* entries from {@link net.minecraft.util.registry.BuiltinRegistries}</li>
* <li>Sometimes, Vanilla Minecraft will stop here, and use the {@link DynamicRegistryManager} as-is (examples: server.properties parsing, world creation screen).</li>
* <li>{@link RegistryOps#method_36574(DynamicOps, ResourceManager, DynamicRegistryManager)} gets called with the manager, and a
* <li>{@link RegistryOps#ofLoaded(DynamicOps, ResourceManager, DynamicRegistryManager)} gets called with the manager, and a
* resource manager that contains the loaded data packs. This will pull in all worldgen objects from datapacks into the
* dynamic registry manager.</li>
* <li>After the worldgen objects are pulled in from the datapacks, this mixin will call the biome modification callback.</li>
* <li>In most cases, Vanilla will stop here and now use the dynamic registy manager to instantiate a server.</li>
* <li>Sometimes, i.e. when using the "re-create world feature", and a datapack throws an error, Vanilla will sometimes
* repeat the {@link RegistryOps#method_36574(DynamicOps, ResourceManager, DynamicRegistryManager)} call on the same
* repeat the {@link RegistryOps#ofLoaded(DynamicOps, ResourceManager, DynamicRegistryManager)} call on the same
* dynamic registry manager. We guard against this using {@link net.fabricmc.fabric.impl.biome.modification.BiomeModificationTracker}.</li>
* </ol>
*/
@Mixin(RegistryOps.class)
public class RegistryOpsMixin {
@Inject(method = "method_36574", at = @At("RETURN"))
@Inject(method = "ofLoaded", at = @At("RETURN"))
private static <T> void afterCreation(DynamicOps<T> dynamicOps, ResourceManager resourceManager, DynamicRegistryManager impl, CallbackInfoReturnable<RegistryOps<T>> cir) {
BiomeModificationImpl.INSTANCE.modifyBiomes((DynamicRegistryManager.Impl) impl);
}

View file

@ -46,7 +46,7 @@ import net.minecraft.world.level.storage.LevelStorage;
*
* <p>See https://bugs.mojang.com/browse/MC-195468 for a related bug report.
*
* <p>In 1.17: Retest if this bug still occurs without this Mixin by launching a dedicated server with the
* <p>In 1.18: Retest if this bug still occurs without this Mixin by launching a dedicated server with the
* dimension testmod, and no world directory. If the dimension is available (i.e. in /execute in, or via
* the testmod's commands), then the bug is fixed and this Mixin can be removed.
*/
@ -73,7 +73,7 @@ public class ServerBugfixMixin {
return value;
}
@ModifyVariable(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;method_36574(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"), method = "main", allow = 1)
@ModifyVariable(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;ofLoaded(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"), method = "main", allow = 1)
private static RegistryOps<NbtElement> captureRegistryOps(RegistryOps<NbtElement> value) {
fabric_registryOps = value;
return value;

View file

@ -55,7 +55,7 @@ public class MainMixin {
}
@Inject(method = "main", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/LevelStorage$Session;readLevelProperties(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/DataPackSettings;)Lnet/minecraft/world/SaveProperties;"), remap = false)
private static void main(String[] args, CallbackInfo info, OptionParser optionParser, OptionSpec o1, OptionSpec o2, OptionSpec o3, OptionSpec o4, OptionSpec o5, OptionSpec o6, OptionSpec o7, OptionSpec o8, OptionSpec o9, OptionSpec o10, OptionSpec o11, OptionSpec o12, OptionSpec o13, OptionSpec o14, OptionSet optionSet, DynamicRegistryManager.Impl impl, Path path, ServerPropertiesLoader serverPropertiesLoader, Path path2, EulaReader eulaReader, File file, YggdrasilAuthenticationService yggdrasilAuthenticationService, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, String string, LevelStorage levelStorage, LevelStorage.Session session, LevelSummary levelSummary, DataPackSettings dataPackSettings, boolean bl, ResourcePackManager resourcePackManager, DataPackSettings dataPackSettings2, CompletableFuture completableFuture, ServerResourceManager serverResourceManager, RegistryOps registryOps) {
private static void main(String[] args, CallbackInfo info, OptionParser optionParser, OptionSpec o1, OptionSpec o2, OptionSpec o3, OptionSpec o4, OptionSpec o5, OptionSpec o6, OptionSpec o7, OptionSpec o8, OptionSpec o9, OptionSpec o10, OptionSpec o11, OptionSpec o12, OptionSpec o13, OptionSpec o14, OptionSpec o15, OptionSet optionSet, DynamicRegistryManager.Impl impl, Path path, ServerPropertiesLoader serverPropertiesLoader, Path path2, EulaReader eulaReader, File file, YggdrasilAuthenticationService yggdrasilAuthenticationService, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, String string, LevelStorage levelStorage, LevelStorage.Session session, LevelSummary levelSummary, DataPackSettings dataPackSettings, boolean bl, ResourcePackManager resourcePackManager, DataPackSettings dataPackSettings2, CompletableFuture completableFuture, ServerResourceManager serverResourceManager, RegistryOps registryOps) {
if (FabricGameTestHelper.ENABLED) {
FabricGameTestHelper.runHeadlessServer(session, resourcePackManager, serverResourceManager, impl);
info.cancel(); // Do not progress in starting the normal dedicated server

View file

@ -57,14 +57,14 @@ public class MixinMinecraftClient {
}
}
@Inject(method = "createSaveProperties", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;method_36574(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"))
@Inject(method = "createSaveProperties", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;ofLoaded(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"))
private static void createSaveProperties(LevelStorage.Session session, DynamicRegistryManager.Impl impl, ResourceManager resourceManager, DataPackSettings dataPackSettings, CallbackInfoReturnable<SaveProperties> cir) {
Path saveDir = ((AccessorLevelStorageSession) session).getDirectory();
PersistentDynamicRegistryHandler.remapDynamicRegistries(impl, saveDir);
}
// synthetic in method_29607 just after RegistryOps.of
@Inject(method = "method_31125", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;method_36574(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"))
@Inject(method = "method_31125", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;ofLoaded(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"))
private static void method_31125(DynamicRegistryManager.Impl impl, GeneratorOptions generatorOptions, LevelInfo levelInfo, LevelStorage.Session session, DynamicRegistryManager.Impl impl2, ResourceManager resourceManager, DataPackSettings dataPackSettings, CallbackInfoReturnable<SaveProperties> cir) {
Path saveDir = ((AccessorLevelStorageSession) session).getDirectory();
PersistentDynamicRegistryHandler.remapDynamicRegistries(impl, saveDir);

View file

@ -77,7 +77,7 @@ public final class TagFactoryImpl<T> implements TagFactory<T> {
* if it mentions datapack entries. The solution is to manually load tags after the registry is loaded.
*
* <p>Look at server's {@link Main#main} function calls for {@link ServerResourceManager#reload} and
* {@link RegistryOps#method_36574} for the relevant code.
* {@link RegistryOps#ofLoaded} for the relevant code.
*/
public static void loadDynamicRegistryTags(DynamicRegistryManager registryManager, ResourceManager resourceManager) {
Stopwatch stopwatch = Stopwatch.createStarted();

View file

@ -34,7 +34,7 @@ import net.fabricmc.fabric.impl.tag.extension.TagFactoryImpl;
*/
@Mixin(value = RegistryOps.class, priority = 900)
public class MixinRegistryOps {
@Inject(method = "method_36574", at = @At("RETURN"))
@Inject(method = "ofLoaded", at = @At("RETURN"))
private static <T> void afterDynamicRegistryLoaded(DynamicOps<T> dynamicOps, ResourceManager resourceManager, DynamicRegistryManager registryManager, CallbackInfoReturnable<RegistryOps<T>> cir) {
TagFactoryImpl.loadDynamicRegistryTags(registryManager, resourceManager);
}