Java Code Examples for org.spongepowered.asm.mixin.MixinEnvironment#getOptionValue()

The following examples show how to use org.spongepowered.asm.mixin.MixinEnvironment#getOptionValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtensionClassExporter.java    From Mixin with MIT License 6 votes vote down vote up
@Override
public void export(MixinEnvironment env, String name, boolean force, ClassNode classNode) {
    // Export transformed class for debugging purposes
    if (force || env.getOption(Option.DEBUG_EXPORT)) {
        String filter = env.getOptionValue(Option.DEBUG_EXPORT_FILTER);
        if (force || filter == null || this.applyFilter(filter, name)) {
            Section exportTimer = MixinEnvironment.getProfiler().begin("debug.export");
            
            File outputFile = this.dumpClass(name.replace('.', '/'), classNode);
            if (this.decompiler != null) {
                this.decompiler.decompile(outputFile);
            }
            exportTimer.end();
        }
    }
}
 
Example 2
Source File: MixinApplicatorStandard.java    From Mixin with MIT License 5 votes vote down vote up
private InitialiserInjectionMode getInitialiserInjectionMode(MixinEnvironment environment) {
    String strMode = environment.getOptionValue(Option.INITIALISER_INJECTION_MODE);
    if (strMode == null) {
        return InitialiserInjectionMode.DEFAULT;
    }
    try {
        return InitialiserInjectionMode.valueOf(strMode.toUpperCase(Locale.ROOT));
    } catch (Exception ex) {
        this.logger.warn("Could not parse unexpected value \"{}\" for mixin.initialiserInjectionMode, reverting to DEFAULT", strMode);
        return InitialiserInjectionMode.DEFAULT;
    }
}
 
Example 3
Source File: RemappingReferenceMapper.java    From Mixin with MIT License 4 votes vote down vote up
private static String getResource(MixinEnvironment env) {
    String resource = env.getOptionValue(Option.REFMAP_REMAP_RESOURCE);
    return Strings.isNullOrEmpty(resource) ? System.getProperty(RemappingReferenceMapper.DEFAULT_RESOURCE_PATH_PROPERTY) : resource;
}
 
Example 4
Source File: RemappingReferenceMapper.java    From Mixin with MIT License 4 votes vote down vote up
private static String getMappingEnv(MixinEnvironment env) {
    String resource = env.getOptionValue(Option.REFMAP_REMAP_SOURCE_ENV);
    return Strings.isNullOrEmpty(resource) ? RemappingReferenceMapper.DEFAULT_MAPPING_ENV : resource;
}