-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Player Skin Fetching Fix part 2 (#293)
* set user agent on image download requests (cherry picked from commit 57b9a00)
- Loading branch information
1 parent
17a4dc2
commit f9f3c20
Showing
4 changed files
with
38 additions
and
8 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
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
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
27 changes: 27 additions & 0 deletions
27
...n/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinThreadDownloadImageData.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,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)"); | ||
} | ||
} |