Skip to content

Commit

Permalink
Develop beta 45 (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD authored Aug 7, 2024
2 parents 78ad1ba + 4c7d95a commit f2e4253
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 37 deletions.
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);
}
}

0 comments on commit f2e4253

Please sign in to comment.