Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop beta 45 #1265

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -116,7 +117,8 @@ public void onLoad(IEnvironment env, Set<String> otherServices) {
public List<Resource> 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> COMMON_TYPES = Set.of("small_dusts");
private static final Collection<String> COMMON_GROUP_PREFIXES = Set.of("tools", "gems");
private static final Collection<String> COMMON_GROUP_PREFIXES = Set.of("tools");
private static final Collection<String> COMMON_GROUP_PREFIXES_NO_ENTRYPATH = Set.of("gems");
private static final Map<String, String> ALIASES = Map.of(
"blocks", "storage_blocks",
"raw_ores", "raw_materials"
Expand Down Expand Up @@ -83,7 +84,8 @@ public static ResourceLocation getNormalizedTagName(String path, Collection<Reso
LOGGER.debug("Found existing prefixed forge tag {}", tag);
return tag;
}

}
for (String prefix : COMMON_GROUP_PREFIXES_NO_ENTRYPATH) {
// Handle plural to singular tag names (c:diamonds -> 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<V> implements IForgeRegistry<V> {
@Shadow
@Final
private BiMap<Object, V> 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<Holder.Reference<V>> cir) {
Expand All @@ -41,13 +31,4 @@ private void getDelegateOrThrow(V value, CallbackInfoReturnable<Holder.Reference
}));
}
}

@Inject(method = "makeSnapshot", at = @At("HEAD"), remap = false)
private void resetOwners(CallbackInfoReturnable<ForgeRegistry.Snapshot> 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<Object, V> copy = new HashMap<>(this.owners);
this.owners.clear();
this.owners.putAll(copy);
}
}
Loading