|
| 1 | +/* |
| 2 | + * This program is free software; you can redistribute it and/or |
| 3 | + * modify it under the terms of the GNU Lesser General Public |
| 4 | + * License as published by the Free Software Foundation; either |
| 5 | + * version 3 of the License, or (at your option) any later version. |
| 6 | + * |
| 7 | + * This program is distributed in the hope that it will be useful, |
| 8 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 10 | + * Lesser General Public License for more details. |
| 11 | + * |
| 12 | + * You should have received a copy of the GNU Lesser General Public License |
| 13 | + * along with this program; if not, write to the Free Software Foundation, |
| 14 | + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 15 | + * |
| 16 | + * For more information, see the LICENSE file. |
| 17 | + */ |
| 18 | + |
| 19 | +package io.github.axolotlclient.oldanimations.mixin; |
| 20 | + |
| 21 | +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; |
| 22 | +import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig; |
| 23 | +import net.minecraft.client.gui.screen.ResourcePackScreen; |
| 24 | +import org.objectweb.asm.Opcodes; |
| 25 | +import org.spongepowered.asm.mixin.Mixin; |
| 26 | +import org.spongepowered.asm.mixin.injection.At; |
| 27 | + |
| 28 | +@Mixin(ResourcePackScreen.class) |
| 29 | +public class ResourcePackScreenMixin { |
| 30 | + |
| 31 | + @ModifyExpressionValue(method = "init", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/gui/screen/ResourcePackScreen;changed:Z")) |
| 32 | + private boolean axolotlclient$refreshResourcesWhenDone(boolean original) { |
| 33 | + if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.refreshResourcesRegardless.get()) { |
| 34 | + return false; |
| 35 | + } |
| 36 | + return original; |
| 37 | + } |
| 38 | + |
| 39 | + @ModifyExpressionValue(method = "buttonClicked", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/gui/screen/ResourcePackScreen;changed:Z")) |
| 40 | + private boolean axolotlclient$refreshResourcesWhenDone2(boolean original) { |
| 41 | + if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.refreshResourcesRegardless.get()) { |
| 42 | + return true; |
| 43 | + } |
| 44 | + return original; |
| 45 | + } |
| 46 | +} |
0 commit comments