Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix player skin fetching method in AbstractClientPlayer #237

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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";
}
}