From c896a3cf7e66e56b2d12db4ab75197eb9cf0c29d Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:32:51 -0400 Subject: [PATCH 1/2] fix player skin fetching --- .../com/mitchej123/hodgepodge/LoadingConfig.java | 2 ++ .../com/mitchej123/hodgepodge/mixins/Mixins.java | 3 +++ .../early/minecraft/MixinAbstractClientPlayer.java | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java diff --git a/src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java b/src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java index 182401a5..05c63176 100644 --- a/src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java @@ -73,6 +73,7 @@ public class LoadingConfig { public boolean fixNorthWestBias; public boolean fixOptifineChunkLoadingCrash; public boolean fixPerspectiveCamera; + public boolean fixPlayerSkinFetching; public boolean fixPotionEffectNumerals; public boolean fixPotionEffectRender; public boolean fixPotionIterating; @@ -252,6 +253,7 @@ public LoadingConfig(File file) { fixNorthWestBias = config.get(Category.FIXES.toString(), "fixNorthWestBias", true, "Fix northwest bias on RandomPositionGenerator").getBoolean(); fixOptifineChunkLoadingCrash = config.get(Category.FIXES.toString(), "fixOptifineChunkLoadingCrash", true, "Forces the chunk loading option from optifine to default since other values can crash the game").getBoolean(); fixPerspectiveCamera = config.get(Category.FIXES.toString(), "fixPerspectiveCamera", true, "Prevent tall grass and such to affect the perspective camera").getBoolean(); + fixPlayerSkinFetching = config.get(Category.FIXES.toString(), "fixPlayerSkinFetching", true, "Allow some mods to properly fetch the player skin").getBoolean(); fixPotionEffectNumerals = config.get(Category.FIXES.toString(), "fixPotionEffectNumerals", true, "Properly display level of potion effects in the inventory and on tooltips").getBoolean(); fixPotionEffectRender = config.get(Category.TWEAKS.toString(), "fixPotionEffectRender", true, "Fix vanilla potion effects rendering above the NEI tooltips in the inventory").getBoolean(); fixPotionIterating = config.get(Category.FIXES.toString(), "fixPotionIterating", true, "Fix crashes with ConcurrentModificationException because of incorrectly iterating over active potions").getBoolean(); diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java index d1e5e4b0..615bf7f4 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java @@ -235,6 +235,9 @@ public enum Mixins { BED_MESSAGE_ABOVE_HOTBAR(new Builder("Bed Message Above Hotbar").setPhase(Phase.EARLY) .addMixinClasses("minecraft.MixinBlockBed").setSide(Side.BOTH) .setApplyIf(() -> Common.config.bedMessageAboveHotbar).addTargetedMod(TargetedMod.VANILLA)), + FIX_PLAYER_SKIN_FETCHING(new Builder("Fix player skin fetching").setPhase(Phase.EARLY) + .addMixinClasses("minecraft.MixinAbstractClientPlayer").setSide(Side.CLIENT) + .setApplyIf(() -> Common.config.fixPlayerSkinFetching).addTargetedMod(TargetedMod.VANILLA)), VALIDATE_PACKET_ENCODING_BEFORE_SENDING(new Builder("Validate packet encoding before sending").setPhase(Phase.EARLY) .addMixinClasses("minecraft.packets.MixinDataWatcher", "minecraft.packets.MixinS3FPacketCustomPayload") diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java b/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java new file mode 100644 index 00000000..8dc6d345 --- /dev/null +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java @@ -0,0 +1,14 @@ +package com.mitchej123.hodgepodge.mixins.early.minecraft; + +import net.minecraft.client.entity.AbstractClientPlayer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(AbstractClientPlayer.class) +public class MixinAbstractClientPlayer { + @ModifyConstant(method = "getDownloadImageSkin", constant = @Constant(stringValue = "http://skins.minecraft.net/MinecraftSkins/%s.png")) + private static String hodgepodge$redirectSkinUrl(String url) { + return "https://visage.surgeplay.com/skin/%s.png"; + } +} From 4dc062b4a765107f1691ec52b4ed838db6112d54 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:44:37 -0400 Subject: [PATCH 2/2] spotless --- .../mixins/early/minecraft/MixinAbstractClientPlayer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java b/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java index 8dc6d345..25b250e5 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinAbstractClientPlayer.java @@ -1,13 +1,17 @@ package com.mitchej123.hodgepodge.mixins.early.minecraft; import net.minecraft.client.entity.AbstractClientPlayer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(AbstractClientPlayer.class) public class MixinAbstractClientPlayer { - @ModifyConstant(method = "getDownloadImageSkin", constant = @Constant(stringValue = "http://skins.minecraft.net/MinecraftSkins/%s.png")) + + @ModifyConstant( + method = "getDownloadImageSkin", + constant = @Constant(stringValue = "http://skins.minecraft.net/MinecraftSkins/%s.png")) private static String hodgepodge$redirectSkinUrl(String url) { return "https://visage.surgeplay.com/skin/%s.png"; }