All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.florianmichael.asmfabricloader.loader.classloading.AFLConstants Maven / Gradle / Ivy

/*
 * This file is part of AsmFabricLoader - https://github.com/FlorianMichael/AsmFabricLoader
 * Copyright (C) 2023-2024 FlorianMichael/EnZaXD 
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package de.florianmichael.asmfabricloader.loader.classloading;

import net.fabricmc.loader.api.FabricLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.InputStream;

/**
 * To prevent issues with multiple class loaders, we use this class to store fields that are shared between the class loaders.
 */
public class AFLConstants {

    public static final Logger LOGGER = LogManager.getLogger("AsmFabricLoader");

    public static boolean isDebugEnabled() {
        return Boolean.parseBoolean(System.getProperty("asmfabricloader.debug", "false"));
    }

    public static InputStream getMappingsFile() {
        final boolean production = !FabricLoader.getInstance().isDevelopmentEnvironment();
        return AFLConstants.class.getResourceAsStream(production ? "/afl_mappings.tiny" : "/mappings/mappings.tiny");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy