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

top.hendrixshen.magiclib.dependency.impl.MixinDependencyPredicates Maven / Gradle / Ivy

There is a newer version: 0.7.398+fe2125a-beta
Show newest version
package top.hendrixshen.magiclib.dependency.impl;

import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import top.hendrixshen.magiclib.dependency.api.MixinDependencyPredicate;
import top.hendrixshen.magiclib.util.FabricUtil;

/**
 * MagicLib built-in MixinDependencyPredicates.
 * 

* Some basic uses of predicates are given here. */ public class MixinDependencyPredicates { /** * Predicate that implements {@link MixinDependencyPredicate} for config predicate checking. *

* Default value for config predicate check, this predicate always returns true. */ public static class TrueConfigPredicate implements MixinDependencyPredicate { @Override public boolean isSatisfied(ClassNode classNode) { return true; } } /** * Predicate that implements {@link MixinDependencyPredicate} for config predicate checking. *

* This predicate returns true only when Fabric is enabled in the development environment. */ public static class DevMixinPredicate implements MixinDependencyPredicate { @Override public boolean isSatisfied(ClassNode classNode) { return FabricUtil.isDevelopmentEnvironment(); } } /** * Predicate that implements {@link MixinDependencyPredicate} for config predicate checking. *

* This predicate returns true only when Fabric is enabled in the development environment and use mojang's mapping. */ public static class DevMojangMixinPredicate implements MixinDependencyPredicate { @Override public boolean isSatisfied(ClassNode mixinClass) { return FabricUtil.isDevelopmentEnvironment() && FabricLoader.getInstance().getMappingResolver() .mapClassName("intermediary", "net.minecraft.class_310").equals("net.minecraft.client.Minecraft"); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy