diff --git a/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java b/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java index 14bf99e..41bfb4c 100644 --- a/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java +++ b/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java @@ -24,17 +24,37 @@ import net.minecraft.client.MinecraftClient; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +import java.io.InputStream; /** - * The implementation for mc (~, 1.20) - * See {@link IconsMixin} in subproject 1.20 for implementation for mc [1.20, ~) + * The implementation for mc (~, 1.19.3) + * See: + * - {@link MinecraftClientMixin} in subproject 1.19.3-fabric for implementation for mc [1.19.3, 1.20) + * - {@link IconsMixin} in subproject 1.20.1-fabric for implementation for mc [1.20, ~) */ @Mixin(MinecraftClient.class) public abstract class MinecraftClientMixin { - @ModifyArgs( + @ModifyArg( + //#if MC >= 11500 + method = "", + //#else + //$$ method = "init", + //#endif + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/util/Window;setIcon(Ljava/io/InputStream;Ljava/io/InputStream;)V" + ), + index = 0 + ) + private InputStream bringTheClassicCraftingTableIconBack_general16x(InputStream icon16) + { + return ClassicMinecraftIconStorage.getResource("icon_16x16.png"); + } + + @ModifyArg( //#if MC >= 11500 method = "", //#else @@ -42,34 +62,26 @@ public abstract class MinecraftClientMixin //#endif at = @At( value = "INVOKE", - //#if MC >= 11903 - //$$ target = "Lnet/minecraft/client/util/Window;setIcon(Lnet/minecraft/resource/InputSupplier;Lnet/minecraft/resource/InputSupplier;)V" - //#else target = "Lnet/minecraft/client/util/Window;setIcon(Ljava/io/InputStream;Ljava/io/InputStream;)V" - //#endif - ) + ), + index = 1 ) - private void bringTheClassicCraftingTableIconBack_general(Args args) + private InputStream bringTheClassicCraftingTableIconBack_general32x(InputStream icon32) { - args.set(0, ClassicMinecraftIconStorage.getResource("icon_16x16.png")); - args.set(1, ClassicMinecraftIconStorage.getResource("icon_32x32.png")); + return ClassicMinecraftIconStorage.getResource("icon_32x32.png"); } //#if MC >= 11902 - //$$ @ModifyArgs( + //$$ @ModifyArg( //$$ method = "", //$$ at = @At( //$$ value = "INVOKE", - //#if MC >= 11903 - //$$ target = "Lnet/minecraft/client/util/MacWindowUtil;setApplicationIconImage(Lnet/minecraft/resource/InputSupplier;)V" - //#else - //$$ target = "Lnet/minecraft/client/util/MacWindowUtil;setApplicationIconImage(Ljava/io/InputStream;)V" - //#endif + //$$ target = "Lnet/minecraft/client/util/MacWindowUtil;setApplicationIconImage(Ljava/io/InputStream;)V" //$$ ) //$$ ) - //$$ private void bringTheClassicCraftingTableIconBack_mac(Args args) + //$$ private InputStream bringTheClassicCraftingTableIconBack_mac(InputStream iconMac) //$$ { - //$$ args.set(0, ClassicMinecraftIconStorage.getResource("minecraft.icns")); + //$$ return ClassicMinecraftIconStorage.getResource("minecraft.icns"); //$$ } //#endif } diff --git a/versions/1.19.3-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java b/versions/1.19.3-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java new file mode 100644 index 0000000..8ca3cb6 --- /dev/null +++ b/versions/1.19.3-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java @@ -0,0 +1,78 @@ +/* + * This file is part of the Classic Minecraft Icon project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2023 Fallen_Breath and contributors + * + * Classic Minecraft Icon is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Classic Minecraft Icon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Classic Minecraft Icon. If not, see . + */ + +package me.fallenbreath.classicminecrafticon.mixins; + +import me.fallenbreath.classicminecrafticon.ClassicMinecraftIconStorage; +import net.minecraft.client.MinecraftClient; +import net.minecraft.resource.InputSupplier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +import java.io.InputStream; + +/** + * The implementation for mc [1.19.3, 1.20) + * See: + * - {@link MinecraftClientMixin} in subproject 1.15.2-fabric for implementation for mc (~, 1.19.3) + * - {@link IconsMixin} in subproject 1.20.1-fabric for implementation for mc [1.20, ~) + */ +@Mixin(MinecraftClient.class) +public abstract class MinecraftClientMixin +{ + @ModifyArg( + method = "", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/util/Window;setIcon(Lnet/minecraft/resource/InputSupplier;Lnet/minecraft/resource/InputSupplier;)V" + ), + index = 0 + ) + private InputSupplier bringTheClassicCraftingTableIconBack_general16x(InputSupplier icon16) + { + return ClassicMinecraftIconStorage.getResource("icon_16x16.png"); + } + + @ModifyArg( + method = "", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/util/Window;setIcon(Lnet/minecraft/resource/InputSupplier;Lnet/minecraft/resource/InputSupplier;)V" + ), + index = 1 + ) + private InputSupplier bringTheClassicCraftingTableIconBack_general32x(InputSupplier icon32) + { + return ClassicMinecraftIconStorage.getResource("icon_32x32.png"); + } + + @ModifyArg( + method = "", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/util/MacWindowUtil;setApplicationIconImage(Lnet/minecraft/resource/InputSupplier;)V" + ) + ) + private InputSupplier bringTheClassicCraftingTableIconBack_mac(InputSupplier iconMac) + { + return ClassicMinecraftIconStorage.getResource("minecraft.icns"); + } +} diff --git a/versions/1.20.1-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/IconsMixin.java b/versions/1.20.1-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/IconsMixin.java index 86fa6d0..08b4666 100644 --- a/versions/1.20.1-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/IconsMixin.java +++ b/versions/1.20.1-fabric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/IconsMixin.java @@ -33,7 +33,9 @@ /** * The implementation for mc [1.20, ~) - * See {@link MinecraftClientMixin} in subproject 1.15.2 for implementation for mc (~, 1.20) + * See: + * - {@link MinecraftClientMixin} in subproject 1.15.2-fabric for implementation for mc (~, 1.19.3) + * - {@link MinecraftClientMixin} in subproject 1.19.3-fabric for implementation for mc [1.19.3, 1.20) */ @Mixin(Icons.class) public abstract class IconsMixin