Skip to content

Commit

Permalink
Player Skin Fetching Fix part 2 (#293)
Browse files Browse the repository at this point in the history
* set user agent on image download requests

(cherry picked from commit 57b9a00)
  • Loading branch information
kumquat-ir authored and Dream-Master committed Dec 20, 2023
1 parent 17a4dc2 commit f9f3c20
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1701530445
//version: 1702141377
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -54,7 +54,7 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
}

print("You might want to check out './gradlew :faq' if your build fails.\n")
Expand Down Expand Up @@ -613,7 +613,7 @@ repositories {
}
maven {
name = "ic2"
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
content {
includeGroup "net.industrial-craft"
}
Expand Down Expand Up @@ -672,6 +672,8 @@ configurations.all {
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")

substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
}
}

Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ dependencies {
transformedMod("com.github.GTNewHorizons:Baubles:1.0.3:dev")
// Transitive updates to make runClient17 work
transformedMod("com.github.GTNewHorizons:ForgeMultipart:1.4.1:dev")
transformedMod("com.github.GTNewHorizons:GT5-Unofficial:5.09.44.96:dev")
transformedMod("com.github.GTNewHorizons:harvestcraft:1.1.3-GTNH:dev")
transformedMod("com.github.GTNewHorizons:GT5-Unofficial:5.09.44.106:dev")
transformedMod("com.github.GTNewHorizons:harvestcraft:1.1.4-GTNH:dev")
transformedMod("com.github.GTNewHorizons:HungerOverhaul:1.0.4-GTNH:dev")
transformedMod("com.github.GTNewHorizons:MrTJPCore:1.1.5:dev") // Do not update, fixed afterwards
transformedMod("com.github.GTNewHorizons:Railcraft:9.15.1:dev") { exclude group: "thaumcraft", module: "Thaumcraft" }
transformedMod("com.github.GTNewHorizons:Railcraft:9.15.3:dev") { exclude group: "thaumcraft", module: "Thaumcraft" }
transformedMod("com.github.GTNewHorizons:TinkersConstruct:1.10.12-GTNH:dev")
transformedMod(deobfCurse("bibliocraft-228027:2423369"))
transformedMod("curse.maven:biomes-o-plenty-220318:2499612")
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ public enum Mixins {
.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)),
.addMixinClasses("minecraft.MixinAbstractClientPlayer", "minecraft.MixinThreadDownloadImageData")
.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")
.setSide(Side.BOTH).setApplyIf(() -> Common.config.validatePacketEncodingBeforeSending)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import java.net.HttpURLConnection;

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;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import com.mitchej123.hodgepodge.Tags;

@Mixin(targets = "net/minecraft/client/renderer/ThreadDownloadImageData$1")
public class MixinThreadDownloadImageData {

@SuppressWarnings("UnresolvedMixinReference") // mcdev cannot find references in anonymous classes correctly
@Inject(
method = "run()V",
at = @At(value = "INVOKE", target = "Ljava/net/HttpURLConnection;setDoInput(Z)V"),
locals = LocalCapture.CAPTURE_FAILSOFT,
remap = false)
private void hodgepodge$injectRun(CallbackInfo ci, HttpURLConnection httpURLConnection) {
httpURLConnection.setRequestProperty(
"User-Agent",
"Minecraft/1.7.10 Hodgepodge/" + Tags.VERSION + " (+https://github.com/GTNewHorizons/Hodgepodge)");
}
}

0 comments on commit f9f3c20

Please sign in to comment.