Skip to content

Commit

Permalink
new: fix resource pack folder sometimes not opening on windows (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru authored Jul 12, 2023
1 parent 4090c17 commit 8d07027
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package club.sk1er.patcher.mixins.bugfixes;

import gg.essential.universal.UDesktop;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreenResourcePacks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiScreenResourcePacks.class)
public class GuiScreenResourcePacksMixin_FixOpenPackFolder {

@Inject(
method = "actionPerformed",
at =
@At(
value = "INVOKE",
target = "Lnet/minecraft/client/resources/ResourcePackRepository;getDirResourcepacks()Ljava/io/File;",
shift = At.Shift.AFTER
),
cancellable = true
)
private void patcher$fixFolderOpening(CallbackInfo ci) {
if (UDesktop.open(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks())) {
ci.cancel();
}
}

}
1 change: 1 addition & 0 deletions src/main/resources/patcher.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"bugfixes.GuiScreenOptionsSoundsMixin_PacketSpam",
"bugfixes.GuiScreenResourcePacksMixin_ChangeTextPosition",
"bugfixes.GuiScreenResourcePacksMixin_ClearHandles",
"bugfixes.GuiScreenResourcePacksMixin_FixOpenPackFolder",
"bugfixes.GuiVideoSettingsMixin_MipmapSlider",
"bugfixes.InventoryEffectRendererMixin_FixPotionEffectNumerals",
"bugfixes.LayerArrowMixin_FixedBrightness",
Expand Down

0 comments on commit 8d07027

Please sign in to comment.