Skip to content

Commit

Permalink
Set up MixinBooter infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed May 19, 2024
1 parent 5c0d272 commit 4806584
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ dependencies {
transitive = false
}
}

}

// Adds Access Transformer files to tasks
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ archives_base_name = crimsonrevelations
# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly.

# Boilerplate Options
use_mixins = false
use_mixins = true
use_coremod = false
use_assetmover = false

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.mobiusflip.crimsonrevelations.core;

import com.google.common.collect.ImmutableMap;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import zone.rong.mixinbooter.ILateMixinLoader;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

public class CRMixinLoader implements ILateMixinLoader {
private static final Map<String, Supplier<Boolean>> clientsideMixinConfigs = ImmutableMap.copyOf(new HashMap<String, Supplier<Boolean>>() {
{

}
});

private static final Map<String, Supplier<Boolean>> commonMixinConfigs = ImmutableMap.copyOf(new HashMap<String, Supplier<Boolean>>() {
{

}
});

private static boolean loaded(String modid) {
return Loader.isModLoaded(modid);
}

@Override
public List<String> getMixinConfigs() {
List<String> configs = new ArrayList<>();
if (FMLLaunchHandler.side().isClient()) {
configs.addAll(clientsideMixinConfigs.keySet());
}
configs.addAll(commonMixinConfigs.keySet());
return configs;
}

@Override
public boolean shouldMixinConfigQueue(String mixinConfig) {
Supplier<Boolean> sidedSupplier = FMLLaunchHandler.side().isClient() ? clientsideMixinConfigs.get(mixinConfig) : null;
Supplier<Boolean> commonSupplier = commonMixinConfigs.get(mixinConfig);
return sidedSupplier != null ? sidedSupplier.get() : commonSupplier == null || commonSupplier.get();
}
}

0 comments on commit 4806584

Please sign in to comment.