generated from Fallen-Breath/fabric-mod-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use ModifyArg instead of ModifyArgs, cuz forge 1.17+ crashes with it
see SpongePowered/Mixin#584 also splits 1.19.3 version for MinecraftClient for neater look
- Loading branch information
1 parent
cb69fd9
commit 9efa767
Showing
3 changed files
with
114 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...abric/src/main/java/me/fallenbreath/classicminecrafticon/mixins/MinecraftClientMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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 = "<init>", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/util/Window;setIcon(Lnet/minecraft/resource/InputSupplier;Lnet/minecraft/resource/InputSupplier;)V" | ||
), | ||
index = 0 | ||
) | ||
private InputSupplier<InputStream> bringTheClassicCraftingTableIconBack_general16x(InputSupplier<InputStream> icon16) | ||
{ | ||
return ClassicMinecraftIconStorage.getResource("icon_16x16.png"); | ||
} | ||
|
||
@ModifyArg( | ||
method = "<init>", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/util/Window;setIcon(Lnet/minecraft/resource/InputSupplier;Lnet/minecraft/resource/InputSupplier;)V" | ||
), | ||
index = 1 | ||
) | ||
private InputSupplier<InputStream> bringTheClassicCraftingTableIconBack_general32x(InputSupplier<InputStream> icon32) | ||
{ | ||
return ClassicMinecraftIconStorage.getResource("icon_32x32.png"); | ||
} | ||
|
||
@ModifyArg( | ||
method = "<init>", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/util/MacWindowUtil;setApplicationIconImage(Lnet/minecraft/resource/InputSupplier;)V" | ||
) | ||
) | ||
private InputSupplier<InputStream> bringTheClassicCraftingTableIconBack_mac(InputSupplier<InputStream> iconMac) | ||
{ | ||
return ClassicMinecraftIconStorage.getResource("minecraft.icns"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters