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

top.hendrixshen.magiclib.impl.malilib.MixinPredicates Maven / Gradle / Ivy

There is a newer version: 0.8.41
Show newest version
package top.hendrixshen.magiclib.impl.malilib;

import org.objectweb.asm.tree.ClassNode;
import top.hendrixshen.magiclib.api.mixin.MixinPredicate;

//#if FABRIC_LIKE
import top.hendrixshen.magiclib.MagicLib;
import top.hendrixshen.magiclib.libs.org.semver4j.Semver;
//#endif

public class MixinPredicates {
    // Workaround for SemVer4j bug!
    public static class Malilib_0_11_4 implements MixinPredicate {
        @Override
        public boolean test(ClassNode classNode) {
            //#if FABRIC_LIKE
            String malilibVer = MagicLib.getInstance().getCurrentPlatform().getModVersion("malilib");

            if ("?".equals(malilibVer)) {
                return false;
            }

            String[] split = malilibVer.split("-");
            Semver semver = Semver.coerce(split[0]);

            if (semver == null) {
                return false;
            }

            return semver.satisfies("<0.11.4");
            //#else
            //$$ return false;
            //#endif
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy