diff --git a/gradle.properties b/gradle.properties index 3293f03..10b444f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=true # Versions -versionConnector=1.0.0-beta.44 +versionConnector=1.0.0-beta.45 versionAdapter=1.11.55-1.20.1-20240428.153904 -versionAdapterDefinition=1.11.65 +versionAdapterDefinition=1.11.67-1.20.1 versionAdapterRuntime=1.0.0 versionMc=1.20.1 diff --git a/src/main/java/org/sinytra/connector/service/ConnectorLoaderService.java b/src/main/java/org/sinytra/connector/service/ConnectorLoaderService.java index d026c77..ac9d2ae 100644 --- a/src/main/java/org/sinytra/connector/service/ConnectorLoaderService.java +++ b/src/main/java/org/sinytra/connector/service/ConnectorLoaderService.java @@ -8,14 +8,14 @@ import cpw.mods.modlauncher.api.ITransformationService; import cpw.mods.modlauncher.api.ITransformer; import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; -import org.sinytra.connector.loader.ConnectorEarlyLoader; -import org.sinytra.connector.service.hacks.ConnectorForkJoinThreadFactory; -import org.sinytra.connector.service.hacks.LenientRuntimeEnumExtender; -import org.sinytra.connector.service.hacks.ModuleLayerMigrator; import net.minecraftforge.fml.loading.ImmediateWindowHandler; import net.minecraftforge.fml.loading.ImmediateWindowProvider; import net.minecraftforge.fml.loading.LoadingModList; import net.minecraftforge.fml.unsafe.UnsafeHacks; +import org.sinytra.connector.loader.ConnectorEarlyLoader; +import org.sinytra.connector.service.hacks.ConnectorForkJoinThreadFactory; +import org.sinytra.connector.service.hacks.LenientRuntimeEnumExtender; +import org.sinytra.connector.service.hacks.ModuleLayerMigrator; import org.slf4j.Logger; import java.lang.invoke.VarHandle; @@ -55,16 +55,17 @@ public void initialize(IEnvironment environment) { ImmediateWindowProvider original = (ImmediateWindowProvider) provider.get(); ImmediateWindowProvider newProvider = new ImmediateWindowProvider() { - @Override public void updateModuleReads(ModuleLayer layer) { - // Setup entrypoints - ConnectorEarlyLoader.setup(); - // Invoke mixin on a dummy class to initialize mixin plugins - // Necessary to avoid duplicate class definition errors when a plugin loads the class that is being transformed - uncheck(() -> Class.forName("org.sinytra.connector.mod.DummyTarget", false, Thread.currentThread().getContextClassLoader())); - // Run preLaunch - ConnectorEarlyLoader.preLaunch(); + if (!ConnectorEarlyLoader.hasEncounteredException()) { + // Setup entrypoints + ConnectorEarlyLoader.setup(); + // Invoke mixin on a dummy class to initialize mixin plugins + // Necessary to avoid duplicate class definition errors when a plugin loads the class that is being transformed + uncheck(() -> Class.forName("org.sinytra.connector.mod.DummyTarget", false, Thread.currentThread().getContextClassLoader())); + // Run preLaunch + ConnectorEarlyLoader.preLaunch(); + } original.updateModuleReads(layer); } @@ -116,7 +117,8 @@ public void onLoad(IEnvironment env, Set otherServices) { public List completeScan(IModuleLayerManager layerManager) { if (LoadingModList.get().getBrokenFiles().isEmpty()) { LoadingModList.get().getErrors().addAll(ConnectorEarlyLoader.getLoadingExceptions()); - } else { + } + else { LOGGER.warn("Broken FML mod files found, not adding Connector locator errors"); } return List.of(new Resource(IModuleLayerManager.Layer.GAME, List.of( diff --git a/src/mod/java/org/sinytra/connector/mod/compat/TagConverter.java b/src/mod/java/org/sinytra/connector/mod/compat/TagConverter.java index a8921d8..32840b2 100644 --- a/src/mod/java/org/sinytra/connector/mod/compat/TagConverter.java +++ b/src/mod/java/org/sinytra/connector/mod/compat/TagConverter.java @@ -25,7 +25,8 @@ public final class TagConverter { private static final Pattern RAW_ORES_PATTERN = Pattern.compile("^raw_(.+?)_ores$"); private static final String TAG_ENTRY_SPLITTER = "_(?!.*_)"; private static final Collection COMMON_TYPES = Set.of("small_dusts"); - private static final Collection COMMON_GROUP_PREFIXES = Set.of("tools", "gems"); + private static final Collection COMMON_GROUP_PREFIXES = Set.of("tools"); + private static final Collection COMMON_GROUP_PREFIXES_NO_ENTRYPATH = Set.of("gems"); private static final Map ALIASES = Map.of( "blocks", "storage_blocks", "raw_ores", "raw_materials" @@ -83,7 +84,8 @@ public static ResourceLocation getNormalizedTagName(String path, Collection forge:gems/diamond) // This will handle existing tags, but won't be able to detect nonexisted tag names like c:rubies -> forge:gems/ruby // Well, it's better than nothing I guess diff --git a/src/mod/java/org/sinytra/connector/mod/mixin/registries/ForgeRegistryMixin.java b/src/mod/java/org/sinytra/connector/mod/mixin/registries/ForgeRegistryMixin.java index bdcb235..6673a62 100644 --- a/src/mod/java/org/sinytra/connector/mod/mixin/registries/ForgeRegistryMixin.java +++ b/src/mod/java/org/sinytra/connector/mod/mixin/registries/ForgeRegistryMixin.java @@ -1,30 +1,20 @@ package org.sinytra.connector.mod.mixin.registries; -import com.google.common.collect.BiMap; import com.mojang.serialization.Lifecycle; -import org.sinytra.connector.mod.ConnectorLoader; import net.minecraft.core.Holder; import net.minecraft.core.MappedRegistry; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.IForgeRegistry; -import org.spongepowered.asm.mixin.Final; +import org.sinytra.connector.mod.ConnectorLoader; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Desc; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.HashMap; -import java.util.Map; - @Mixin(ForgeRegistry.class) public abstract class ForgeRegistryMixin implements IForgeRegistry { - @Shadow - @Final - private BiMap owners; - // Mixin AP complained about not finding the target method, so we use @Desc instead of a string @Inject(target = @Desc(value = "getDelegateOrThrow", args = Object.class, ret = Holder.Reference.class), at = @At("HEAD"), cancellable = true, remap = false) private void getDelegateOrThrow(V value, CallbackInfoReturnable> cir) { @@ -41,13 +31,4 @@ private void getDelegateOrThrow(V value, CallbackInfoReturnable cir) { - // When POI Types have their blockstate lists modified by mods, it breaks value -> key lookup - // Resetting the owners map hash cache fixes the issue - Map copy = new HashMap<>(this.owners); - this.owners.clear(); - this.owners.putAll(copy); - } }