|
| 1 | +/* |
| 2 | + * This file is part of OneConfig. |
| 3 | + * OneConfig - Next Generation Config Library for Minecraft: Java Edition |
| 4 | + * Copyright (C) 2021~2023 Polyfrost. |
| 5 | + * <https://polyfrost.cc> <https://github.com/Polyfrost/> |
| 6 | + * |
| 7 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 8 | + * |
| 9 | + * OneConfig is licensed under the terms of version 3 of the GNU Lesser |
| 10 | + * General Public License as published by the Free Software Foundation, AND |
| 11 | + * under the Additional Terms Applicable to OneConfig, as published by Polyfrost, |
| 12 | + * either version 1.0 of the Additional Terms, or (at your option) any later |
| 13 | + * version. |
| 14 | + * |
| 15 | + * This program is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | + * Lesser General Public License for more details. |
| 19 | + * |
| 20 | + * You should have received a copy of the GNU Lesser General Public |
| 21 | + * License. If not, see <https://www.gnu.org/licenses/>. You should |
| 22 | + * have also received a copy of the Additional Terms Applicable |
| 23 | + * to OneConfig, as published by Polyfrost. If not, see |
| 24 | + * <https://polyfrost.cc/legal/oneconfig/additional-terms> |
| 25 | + */ |
| 26 | + |
| 27 | +package cc.polyfrost.oneconfig.internal.mixin; |
| 28 | + |
| 29 | +import net.minecraftforge.fml.common.Loader; |
| 30 | +import org.spongepowered.asm.mixin.Mixin; |
| 31 | +import org.spongepowered.asm.mixin.injection.At; |
| 32 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 33 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 34 | + |
| 35 | +@Mixin(value = Loader.class, remap = false) |
| 36 | +public class LoaderMixin { |
| 37 | + |
| 38 | + @Inject(method = "isModLoaded", at = @At("HEAD"), cancellable = true, remap = false) |
| 39 | + private static void oneconfig$isModLoaded(String modname, CallbackInfoReturnable<Boolean> cir) { |
| 40 | + if (modname.equals("oneconfig")) { |
| 41 | + cir.setReturnValue(true); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | +} |
0 commit comments