Compare commits

...
218 Commits
Author SHA1 Message Date
Alexander Xia 10e57fe349 Bump 14.11 2019-08-27 17:55:49 +08:00
Alexander Xia 9f70ad0159 Update upload url 2019-06-25 15:24:14 +08:00
ZekerZhayard 0d5538a110 Support for forge 1.14.2 (#59)
* Support for forge 1.14.2

* Delete unnecessary code.
2019-06-25 14:38:40 +08:00
Alexander Xia 27efbbfeb0 Fix addScheduledTask method not found 2019-06-24 20:07:48 +08:00
Alexander Xia 7fad8c602d Add 1.14.2 forge suport 2019-06-24 19:52:02 +08:00
Alexander Xia 29a0952bc4 Fix compatibility with ModLauncher 1.1 (#57) 2019-06-15 17:37:48 +08:00
Alexander Xia b7107b7172 Remove 1.13.2 vanilla 2019-05-24 00:06:35 +08:00
Alexander Xia 2adbc25f69 Fix gradle upload 2019-05-23 23:47:33 +08:00
ZekerZhayard 3bee9281ec Fix remapJar (#55) 2019-05-23 23:35:56 +08:00
ZekerZhayard 917f9f650b Support Fabric for 1.14.1 (#53)
* Fix ClassCastException

* Support Fabric for 1.14.1

* Support Fabric for 1.14.1

* Use mapping file instead of hard code
2019-05-22 23:47:59 +08:00
LionZXY edf6e241e4 Add GlitchlessAPI (#51)
* Add GlitchlessAPI

* Fix build and move GlitchlessSkin to down
2019-05-10 16:20:39 +08:00
Alexander Xia d2c65f00c9 Remove meaningless log 2019-04-26 13:59:08 +08:00
Alexander Xia 95ee345441 Fix 1.14 skin load 2019-04-26 13:56:22 +08:00
Alexander Xia 3ade4867d4 Add 1.14 to settings.gradle 2019-04-26 10:36:20 +08:00
Alexander Xia 2d1951774d Add 1.14 support 2019-04-26 10:34:31 +08:00
ZekerZhayard cc3616a074 Add CSLPluginsLoader (#48)
* Add CSLPluginsLoader

* Remove plugin loader. Add some events.

* Use ServiceLoader to load plugins

* Remove PluginClassLoader.
2019-03-08 13:38:44 +08:00
xfl03 42c48c5c2e Bump 14.10a 2019-03-05 19:33:09 +08:00
xfl03 030daf12a2 Fix 1.8 forge support 2019-03-04 20:12:13 +08:00
xfl03 88763d64ef Bump 14.10 2019-03-03 12:20:28 +08:00
xfl03 4f2b5edf84 Fix incorrect response code judgement 2019-03-03 11:53:48 +08:00
xfl03 cbe07b9003 Fix http redirect to https 2019-03-03 11:34:54 +08:00
xfl03 b2867a0dbf Add support for 1.13.2 forge 2019-03-02 12:26:53 +08:00
xfl03 65dacd8527 Fix javascript cannot expand 2019-03-01 20:31:23 +08:00
xfl03 d2d425e96e Remove 1.13 & 1.13.1 in settings.gradle 2019-03-01 20:10:50 +08:00
xfl03 0762e3e339 Remove support for vanilla 1.13 & 1.13.1 2019-03-01 20:08:22 +08:00
xfl03 4cb1e348bb Try to support 1.13 forge 2019-03-01 14:59:02 +08:00
Alexander Xia 7bbfd19bfd Fix no content cache 2019-02-06 00:39:17 +08:00
Alexander Xia be8b80bd55 Tweak CircleCI Docker Image 2019-01-05 00:20:22 +08:00
Alexander Xia 47de6d3a89 Add workaround for #42 2019-01-05 00:12:42 +08:00
Alexander Xia f78a3b2565 Add disable cape feature 2018-11-26 15:16:07 +08:00
Alexander Xia 016249c6ca Fix version display again 2018-11-25 02:33:12 +08:00
Alexander Xia 860edd2e1a Fix version display 2018-11-25 02:13:55 +08:00
Alexander Xia 3e6e444857 Fix gradle script buid again 2018-11-25 02:08:54 +08:00
Alexander Xia d67b7c6296 Fix gradle script buid again 2018-11-25 02:04:36 +08:00
Alexander Xia 94f6044c9a Fix gradle script build error 2018-11-25 01:53:28 +08:00
Alexander Xia 6b3531964e Tweak version json name 2018-11-25 01:44:06 +08:00
Alexander Xia fbd06f147a Modify gradle script 2018-11-24 01:38:49 +08:00
Alexander Xia e3020dad00 Add Upload Version json to COS 2018-11-23 03:23:17 +08:00
Alexander Xia 49fb976a2c Fix COS upload path 2018-11-23 02:48:19 +08:00
Alexander Xia 78bc4b5f7e Try to upload file to COS 2018-11-23 02:43:30 +08:00
Alexander Xia 7a3dc4f9c2 Support for 1.13.2 2018-11-02 14:48:07 +08:00
Alexander Xia 2087f7bb94 Tweak: Change Profile.json mirror 2018-09-23 23:44:25 +08:00
Alexander Xia e95edb16ac Add: Vanilla Support for 1.13.1 2018-09-23 23:00:34 +08:00
Alexander Xia 3b07b5ccca Update config version checker
Update config output
Add enableCape in config
2018-09-02 15:57:08 +08:00
xfl03 a3fb3cd770 Fix Build 2018-08-26 07:16:37 +08:00
xfl03 b7b59c0b85 Support ModLauncher 2018-08-26 07:04:25 +08:00
Alexander Xia db6b54732e Update MCP map to stable 2018-08-22 03:42:50 +08:00
Alexander Xia 09e3b81552 Fix path for ForgePlugin.log 2018-08-20 19:23:47 +08:00
Alexander Xia 2f494d295e Update Forge Version 2018-08-13 05:15:32 +08:00
Alexander Xia e8e3a72ae7 Add Fingerprint Violation 2018-08-13 05:11:47 +08:00
Alexander Xia ca8bd4e83d Add Profile.json for vanilla edition
Remove CustomSkinAPIPlusPrivacy
Fix typo in ReadMe
Update mcp map
2018-08-11 07:34:13 +08:00
Alexander Xia d789119c8f Get Ready for Forge 1.13 2018-07-26 20:50:41 +08:00
Alexander Xia bfd1b41ecc Update ReadMe
Thanks for @HeartyYF
2018-07-26 13:19:33 +08:00
Alexander Xia 5807acb34a Bump 14.9 2018-07-25 21:16:59 +08:00
Alexander Xia f319d535ae Merge branch '1.13-dev' into csl-14 2018-07-25 21:08:10 +08:00
Alexander Xia f669d095b6 Add Support for 1.13!
Thanks for MinecraftForge/MCPConfig.
2018-07-25 21:06:16 +08:00
Alexander Xia ca8b0ba185 Add FakeImage 2018-07-25 15:55:03 +08:00
Alexander Xia 7acef4d987 Fix Support for Java9
Add ElyBy in default load list
2018-07-20 23:23:37 +08:00
Alexander Xia 79404f659c Merge pull request #36 from andylizi/pr-replace
Replace the unnecessary `replaceAll` calls with `replace`
2018-07-13 22:36:31 +08:00
andylizi 85c86ff375 Replace the unnecessary replaceAll calls with replace 2018-07-13 19:48:02 +08:00
Alexander Xia f4030701ee Fix Legacy Texture cannot refresh in cache 2018-07-12 15:18:13 +08:00
Alexander Xia a36eca2a53 Add ElyByAPI 2018-07-09 19:53:35 +08:00
Alexander Xia 6ffdf2aafb Fix Spectator Menu totally 2018-07-02 00:15:03 +08:00
Alexander Xia fba9f7ca28 Fix head in Spectator Menu 2018-07-01 23:25:57 +08:00
Alexander Xia 2d157e3d5b Fix head is not loaded first time open Spectator Menu 2018-07-01 23:15:06 +08:00
Alexander Xia 055aef17db Fix ForgePlugin log 2018-06-25 00:56:47 +08:00
Alexander Xia 622e834d26 Make Code Better 2018-06-25 00:34:32 +08:00
Alexander Xia 469c8b62a9 Fix Noname skull load 2018-06-24 23:07:51 +08:00
Alexander Xia 1558ec819a Fix Crash in Spectator Menu 2018-06-24 22:59:46 +08:00
Alexander Xia 883e7b45fc Add skin model auto judge 2018-05-18 21:06:28 +08:00
Alexander Xia f30d3319b0 Reuse Vanilla Code 2018-05-06 01:10:55 +08:00
Alexander Xia 58276a7a0c Reuse Vanilla Code 2018-05-06 01:09:48 +08:00
Alexander Xia 883fb39380 Update Gradle Script
Fix local jsonAPI bug
https://minecraft.curseforge.com/projects/customskinloader?comment=10
2018-05-05 23:07:20 +08:00
Alexander Xia 1358a99f51 Merge pull request #35 from tnqzh123/csl-14
Update LittleSkin's API root
2018-04-10 23:39:31 +08:00
LittleStudio-Little_Qiu 47ea01dc39 Update API root 2018-04-10 23:29:45 +08:00
LittleStudio-Little_Qiu ee36f2f42a Update README.md
change link
2018-04-10 23:28:27 +08:00
Alexander Xia 5868a39adb Bump 14.8 2018-03-13 16:48:31 +08:00
Alexander Xia f7e000cb82 Add Cache for MojangAPI 2018-02-12 15:02:12 +08:00
Alexander Xia c40bb38e20 Remove Tab 2018-02-12 12:20:28 +08:00
Alexander Xia 4449ccdd45 Fix Spectator and TabIcon for non-Forge 2018-02-11 15:36:40 +08:00
Alexander Xia 67e56957e7 Fix Spectator Menu 2018-02-11 12:44:41 +08:00
Alexander Xia ea432f2405 Add more debug log 2018-02-10 21:23:58 +08:00
Alexander Xia eee978fc83 Try to fix SpectatorMenu
Forge only
2018-02-10 20:21:26 +08:00
Alexander Xia 9698d4098a Add CurseForge Url 2018-02-07 19:36:02 +08:00
Alexander Xia 3f779c9028 Try CircleCI 2 2018-02-06 07:41:18 +08:00
Alexander Xia 3945599fb4 Try CircleCI 2018-02-06 06:03:54 +08:00
Alexander Xia b50e6a934f Use both UUID and Name as credential 2018-02-03 18:40:04 +08:00
Alexander Xia 3dbf812f50 Update readme 2017-08-13 22:06:47 +08:00
Alexander Xia 2bb8da3ff9 Using Forge Gradle 2.3 2017-08-13 21:11:29 +08:00
Alexander Xia 1371e7685e Bump 14.7
Remove vanilla edition before 1.12
2017-08-13 21:06:39 +08:00
Alexander Xia a49fea706d Support 1.12.1 2017-08-13 20:48:18 +08:00
xfl03 32547481e7 Add forceLoadAllTexture Function 2017-07-12 20:00:06 +08:00
xfl03 faff465ace Fix auto cache clean 2017-07-09 21:40:04 +08:00
xfl03 e487ab1147 Fix #27 2017-07-02 18:19:18 +08:00
xfl03 e26bc85f46 Fix Readme & Remove useless loader 2017-06-18 21:53:29 +08:00
xfl03 7dc2c45600 Fix PlayerTab 2017-06-18 21:31:25 +08:00
xfl03 d6281881a5 Update Skin Site 2017-06-11 17:14:39 +08:00
xfl03 7cdd582ed4 Try CircleCI 2017-06-11 15:02:01 +08:00
xfl03 129b50a6c2 Add 1.11.2 1.12 and Remove1.11 2017-06-11 13:05:21 +08:00
xfl03 eaf9c5f48f Update 2017-01-01 01:33:13 +08:00
xfl03 b7e5c59ecf Fix desc 2017-01-01 01:19:09 +08:00
xfl03 05e98d6eee Fix 2017-01-01 01:09:22 +08:00
xfl03 f4b7393b44 Rewrite ASM 2017-01-01 01:06:40 +08:00
xfl03 898a4fe7d9 May fix forge 2016-12-31 23:17:31 +08:00
xfl03 5cbfb87d08 Remove some debug output 2016-12-31 23:05:55 +08:00
xfl03 8cdabb762d Add debug output 2016-12-31 22:41:36 +08:00
xfl03 4369ddf43e Continue 2016-12-31 22:20:29 +08:00
xfl03 8a1dca0dd4 May fix forge 2016-12-31 21:54:28 +08:00
xfl03 b533d33f71 Update Build Script 2016-12-29 16:51:51 +08:00
xfl03 bfaa97ba04 May finished fake skin manager 2016-12-29 16:44:16 +08:00
xfl03 c86790371d Finished FakeSkinManager 2016-12-25 17:05:30 +08:00
xfl03 ed4bf8dbb3 Fix Transformer for forge 2016-12-04 15:19:08 +08:00
xfl03 b97f838d59 Forge Test 2016-12-04 14:57:25 +08:00
xfl03 79440740ee Forge Test 2016-12-04 14:50:36 +08:00
xfl03 481b0d9df9 Remove 1.7.10 2016-12-04 14:38:17 +08:00
xfl03 cdd42d60e3 Fix strange bug 2016-11-27 13:32:25 +08:00
xfl03 76bf0b5fdf Fix 2016-11-20 12:57:42 +08:00
xfl03 f1c1f2f39a BuildInfo Test 2016-11-20 12:49:08 +08:00
xfl03 3c4b1cc4e2 Fix 2016-11-20 12:25:57 +08:00
xfl03 e2258b1540 Fix 2016-11-20 12:18:50 +08:00
xfl03 d286e419c5 Bump 14.6 2016-11-20 11:27:33 +08:00
xfl03 28eb5eb376 Fix again 2016-11-19 20:37:34 +08:00
xfl03 4d34720d1c Fix 2016-11-19 20:35:53 +08:00
xfl03 b9456d599f Fix 1.10 2016-11-19 20:33:59 +08:00
xfl03 0233b7e077 1.11 Test 2016-11-19 20:31:01 +08:00
xfl03 a917e67871 Support Dynamic Skull Texture Index
Local Texture Supported for Static Skull
Fix network bug
Try to use some forge
2016-11-19 19:35:17 +08:00
xfl03 ea49e7489a Update CustomSkinAPIPlus 2016-11-12 19:33:01 +08:00
xfl03 bcf5dc4cea RFC-2396 URL encode
Remove unused imports
Added ElfSkin for test
2016-11-11 19:48:42 +08:00
xfl03 7e522011e7 Do more for cache 2016-11-06 13:36:26 +08:00
xfl03 bdead01ef9 Added Http Cache
Use new http request platform
2016-11-06 12:00:36 +08:00
xfl03 87a40fc3c7 Fix auto clean 2016-10-18 22:12:06 +08:00
xfl03 0d60fb328a Fix 1.8 2016-10-18 21:59:42 +08:00
xfl03 2f141bd565 Cache Auto Clean 2016-10-18 21:48:07 +08:00
xfl03 a7f52365ca Update Build Script 2016-10-01 13:51:48 +08:00
xfl03 10ec669589 Update build script 2016-10-01 13:46:30 +08:00
xfl03 f09fe38831 Bump 14.5 2016-10-01 13:28:04 +08:00
xfl03 953748f2ae Added Custom Error Message for JsonAPI 2016-09-25 15:13:46 +08:00
xfl03 e63858d561 Fix Dynamic Skull 2016-09-25 11:45:52 +08:00
xfl03 b2d6532709 Fix Dynamic Skull Bug 2016-09-25 11:08:55 +08:00
xfl03 d2db775a17 Update Blessing Skin Url 2016-09-25 10:31:59 +08:00
xfl03 7cf42be31c Auto create local skin folder 2016-09-24 20:47:08 +08:00
xfl03 9a85d18f22 Load Elytra Standalone 2016-09-24 19:08:01 +08:00
xfl03 5d366d1d8c Refix texture parsing bug 2016-09-14 21:50:28 +08:00
xfl03 8257d6dfd0 Fix mistake 2016-09-10 21:26:52 +08:00
xfl03 1c973e633b Gzip Encoding 2016-09-10 21:21:49 +08:00
xfl03 933244a492 Fix build script 2016-09-10 21:11:37 +08:00
xfl03 e719e9cd4e Custom Map 2016-09-10 21:08:07 +08:00
xfl03 25c864b11b Dynamic Skull Test 2016-09-10 21:00:53 +08:00
xfl03 d60d9d4c36 Fix regex 2016-08-29 10:43:40 +08:00
xfl03 a2698b5b95 Fix mistake 2016-08-29 09:22:48 +08:00
xfl03 b14be41789 Fix loading bug 2016-08-29 09:19:38 +08:00
xfl03 cf4487f4d3 Fix mistake 2016-08-28 21:00:57 +08:00
xfl03 23f301c819 Bump 14.4 2016-08-28 20:55:54 +08:00
xfl03 958023382d Default loader list 2016-08-28 19:40:18 +08:00
xfl03 037ef06379 Fix mistake 2016-08-28 19:25:54 +08:00
xfl03 ad8c356c46 Do the same thing for 1.7.10 2016-08-28 19:21:49 +08:00
xfl03 c9181c411f Try to fix skin texture parsing bug 2016-08-28 19:08:59 +08:00
Alexander Xia 164632c7be Update 1.7.10 build script 2016-08-23 21:07:48 +08:00
xfl03 7af9df3177 Try to build 1.7.10 2016-08-21 16:20:27 +08:00
xfl03 37960965b4 Added Extra List 2016-08-21 11:26:00 +08:00
xfl03 10c0536dbe Update README 2016-08-20 23:48:46 +08:00
xfl03 aaf23aa88a Remove Build 1.7.10 2016-08-20 22:13:03 +08:00
xfl03 8bbb9b1ee9 Fixed mistake 2016-08-20 21:11:10 +08:00
xfl03 8c1cfa330e Build all version with Gradle 2016-08-20 21:07:25 +08:00
xfl03 ff83d7f709 Fixed mistake 2016-08-20 20:17:19 +08:00
xfl03 e05ee65d19 Remove maven mirror 2016-08-20 19:39:13 +08:00
xfl03 9a39e38ba1 Build with Gradle 2016-08-20 19:36:44 +08:00
xfl03 7a7b9418d3 Update MCP Map 2016-08-14 01:23:51 +08:00
xfl03 b08122913b Use UTF-8 Charset 2016-08-14 00:12:45 +08:00
xfl03 bbc355365a Get ready for new JsonAPI 2016-08-09 17:23:27 +08:00
xfl03 8bccab4f0b Remove some useless code 2016-08-05 17:00:03 +08:00
xfl03 1d88a98040 Fixed ClassTransformer bug 2016-08-01 23:58:29 +08:00
xfl03 7314a08268 Update README for Revision 14 2016-07-31 22:26:20 +08:00
xfl03 5c12463c94 Revision 14
Local skin supported
Local profile cache supported
Better profile cache
Swifter official profile loading
Better skull loading
Fix legacy loading bug
Fix bug while using ClassTransformer
2016-07-31 22:00:46 +08:00
Alexander Xia b34a5b3343 Fix 1.10 HD texture rendering bug 2016-07-16 20:18:50 +08:00
Alexander Xia 7654dc583d Added custom useragent
Faster mod loading
Backup broken json
Added a new skin site
2016-07-04 14:10:44 +08:00
Alexander Xia 4e78285bbe Fixed mistake 2016-06-30 23:40:10 +08:00
Alexander Xia fe8c556e35 Fixed crash when skull without name and texture 2016-06-25 17:00:48 +08:00
Alexander Xia ffbe66193d Added 1.10 forge support 2016-06-24 20:29:55 +08:00
Alexander Xia fccacc6f98 Changed to stable mcp 2016-06-18 20:45:51 +08:00
Alexander Xia e27c3ecd68 Added 1.10 support 2016-06-09 01:12:08 +08:00
Alexander Xia 11d7d53684 Reformat +1 2016-06-06 13:53:45 +08:00
Alexander Xia fa97359eeb Reformat 2016-06-06 13:48:59 +08:00
Alexander Xia 1540ecfa8d Refix incorrect skull texture 2016-06-06 13:44:55 +08:00
Alexander Xia b27654dfe9 Fixed mistake in 1.8 2016-06-05 22:24:02 +08:00
Alexander Xia db10725c31 Added 1.9.4 forge support 2016-06-05 19:18:09 +08:00
Alexander Xia 946d6901ea Fix incorrect skull texture.
Closes #16
2016-06-05 17:57:26 +08:00
Alexander Xia 3054cc6a13 Added 1.9.4 support 2016-05-14 00:13:16 +08:00
Alexander Xia 8f73eed29d Fix data folder url decoding bug 2016-05-07 19:41:32 +08:00
Alexander Xia a16c4a7b44 Fixed data folder 2016-05-07 13:11:08 +08:00
Alexander Xia fcb24315e5 Fixed tweaker log 2016-05-02 01:01:18 +08:00
Alexander Xia 47f198b337 Fixed data folder bug 2016-04-30 22:12:26 +08:00
Alexander Xia a38aa9687c Fixed crash when skull texture not found [1.7.10] 2016-04-10 19:21:28 +08:00
Alexander Xia 0857a80ca8 Tweaked Skull Texture Load 2016-04-04 13:13:18 +08:00
Alexander Xia 704f3a4102 Added 1.9.2 Support 2016-04-04 00:35:12 +08:00
Alexander Xia 4ebce88594 Fixed crash when skull texture not found
Added switch for cache
2016-04-03 16:29:00 +08:00
Alexander Xia 8fa3a567ac Fixed mistake 2016-04-03 14:56:06 +08:00
Alexander Xia 5a29416ee9 Added Skull Support 2016-04-03 13:55:33 +08:00
Alexander Xia 4142609635 Added Config File Updater
Added Transparent Skin Support
Tweaked UniSkinAPI Log
Added Config for Skull and Transparent Skin
Added a new skin site
2016-04-03 13:01:06 +08:00
Alexander Xia 1dbfa30ba8 Added Skull Support[1.9]
Added Profile Cache
Fixed Default Profile Not Used
Close #6
2016-04-03 01:14:33 +08:00
Alexander Xia 199c5d674e 1.9 forge support 2016-03-19 22:21:23 +08:00
Alexander Xia bebbbb0050 Fix 1.8-1.8.9 texture binding mistake
Support new UniSkinApi
2016-03-13 00:17:11 +08:00
Alexander Xia 03388e3f85 Fix 1.9 bwn NullPointer 2016-03-12 19:14:53 +08:00
Alexander Xia 103cd4548d Fix a mistake 2016-03-05 11:10:39 +08:00
Alexander Xia 87aa82647a Make CSL 1.9 support java6 2016-03-05 10:59:18 +08:00
Alexander Xia adbde5334d Fix 1.7.10 authlib21 bug
Fix #6 in all versions
2016-03-05 10:37:10 +08:00
Alexander Xia 6d44d738a8 Fix #6 2016-03-05 10:27:13 +08:00
Alexander Xia 5f0c3b419c Support 1.9 2016-03-05 10:04:28 +08:00
Alexander Xia 4fe495d7fa Get ready for 1.9
1.9-pre4 HD Fix
2016-02-28 12:25:13 +08:00
Alexander Xia ae4eaeb4ba 1.9-pre4 Support 2016-02-28 12:04:54 +08:00
Alexander Xia f9a36acf8f New 1.8.8 Support 2016-02-27 21:43:46 +08:00
Alexander Xia c6ea90867e Fix CustomSkinAPI Bug 2016-02-27 18:37:37 +08:00
Alexander Xia e584c112df New 1.8 Support 2016-02-27 18:04:25 +08:00
Alexander Xia f59e58a15a Fix rename bug 2016-02-27 16:37:05 +08:00
Alexander Xia be06bbb2ab Fix Readme *3 2016-02-27 15:28:47 +08:00
Alexander Xia 7cbc4ac79e Fix readme *2 2016-02-27 15:27:58 +08:00
Alexander Xia ce4d0b550a Fix Readme 2016-02-27 15:26:56 +08:00
Alexander Xia 17c6bfad5f Remake CustomSkinLoader
Support 1.7.10 first
2016-02-27 15:22:35 +08:00
141 changed files with 5679 additions and 7217 deletions

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
# Java Gradle CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: circleci/openjdk@sha256:7be33522f6f0ca65c2e78b22b1ef3e6739038494c1de1b8fb6d96da400dccf53
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- restore_cache:
keys:
- gradle-cache
# Gradle Wrapper
# - run: sudo chmod +x gradlew
# - run: ./gradlew --version
# - run: ./gradlew clean build
# Gradle
- run: gradle --version
- run: gradle clean build
- run: gradle upload
- store_artifacts:
path: ./build/libs
- save_cache:
paths:
- ~/.gradle
key: gradle-cache
+24
View File
@@ -1,3 +1,4 @@
# Java
*.class
# Mobile Tools for Java (J2ME)
@@ -10,3 +11,26 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# VSCode
.vscode/
# eclipse
*/.classpath
.classpath
*/.project
.project
.settings/
*.launch
# gradle
.gradle/
build/
gradle/
gradlew*
run/
# IDEA
.idea/
*.iml
out/
+2
View File
@@ -0,0 +1,2 @@
/build/
/src/main/
+498
View File
@@ -0,0 +1,498 @@
CL: net/minecraft/util/ResourceLocation qs
CL: net/minecraft/util/ResourceLocation$Serializer qs$a
CL: net/minecraft/util/StringUtils zy
CL: net/minecraft/client/renderer/texture/NativeImage cty
CL: net/minecraft/client/renderer/texture/NativeImage$1 cty$1
CL: net/minecraft/client/renderer/texture/NativeImage$PixelFormat cty$a
CL: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode cty$b
CL: net/minecraft/client/renderer/texture/NativeImage$WriteCallback cty$c
CL: net/minecraft/client/Minecraft cvk
CL: net/minecraft/client/Minecraft$1 cvk$1
CL: net/minecraft/client/Minecraft$2 cvk$2
CL: net/minecraft/client/multiplayer/ServerData dhq
CL: net/minecraft/client/multiplayer/ServerData$ServerResourceMode dhq$a
CL: net/minecraft/client/renderer/IImageBuffer dkl
CL: net/minecraft/client/renderer/ImageBufferDownload dkq
CL: net/minecraft/client/renderer/ThreadDownloadImageData dua
CL: net/minecraft/client/renderer/ThreadDownloadImageData$1 dua$1
CL: net/minecraft/client/renderer/texture/SimpleTexture duf
CL: net/minecraft/client/renderer/texture/SimpleTexture$TextureData duf$a
CL: net/minecraft/client/renderer/texture/TextureManager duk
CL: net/minecraft/client/renderer/texture/ITextureObject dul
CL: net/minecraft/client/resources/DefaultPlayerSkin dut
CL: net/minecraft/client/resources/SkinManager dvb
CL: net/minecraft/client/resources/SkinManager$1 dvb$1
CL: net/minecraft/client/resources/SkinManager$2 dvb$2
CL: net/minecraft/client/resources/SkinManager$SkinAvailableCallback dvb$a
FD: net/minecraft/util/ResourceLocation/field_110626_a qs/a
FD: net/minecraft/util/ResourceLocation/field_110625_b qs/b
FD: net/minecraft/util/ResourceLocation/field_200118_c qs/c
FD: net/minecraft/util/StringUtils/field_76339_a zy/a
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/RGBA cty$a/a
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/RGB cty$a/b
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/LUMINANCE_ALPHA cty$a/c
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/LUMINANCE cty$a/d
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211659_e cty$a/e
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211660_f cty$a/f
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211661_g cty$a/g
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211662_h cty$a/h
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211663_i cty$a/i
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211664_j cty$a/j
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211665_k cty$a/k
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211666_l cty$a/l
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211667_m cty$a/m
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211668_n cty$a/n
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211669_o cty$a/o
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211670_p cty$a/p
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/field_211671_q cty$a/q
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/$VALUES cty$a/r
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/RGBA cty$b/a
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/RGB cty$b/b
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/LUMINANCE_ALPHA cty$b/c
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/LUMINANCE cty$b/d
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/INTENSITY cty$b/e
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/field_211673_f cty$b/f
FD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/$VALUES cty$b/g
FD: net/minecraft/client/renderer/texture/NativeImage$WriteCallback/field_209268_a cty$c/a
FD: net/minecraft/client/renderer/texture/NativeImage$WriteCallback/field_209269_b cty$c/b
FD: net/minecraft/client/renderer/texture/NativeImage/field_209272_a cty/a
FD: net/minecraft/client/renderer/texture/NativeImage/field_211680_b cty/b
FD: net/minecraft/client/renderer/texture/NativeImage/field_195719_a cty/c
FD: net/minecraft/client/renderer/texture/NativeImage/field_195720_b cty/d
FD: net/minecraft/client/renderer/texture/NativeImage/field_195721_c cty/e
FD: net/minecraft/client/renderer/texture/NativeImage/field_195722_d cty/f
FD: net/minecraft/client/renderer/texture/NativeImage/field_195723_e cty/g
FD: net/minecraft/client/Minecraft$1/field_74532_a cvk$1/a
FD: net/minecraft/client/Minecraft$2/field_210222_a cvk$2/a
FD: net/minecraft/client/Minecraft$2/field_210223_b cvk$2/b
FD: net/minecraft/client/Minecraft/field_181542_y cvk/A
FD: net/minecraft/client/Minecraft/field_71426_K cvk/B
FD: net/minecraft/client/Minecraft/field_175612_E cvk/F
FD: net/minecraft/client/Minecraft/field_147123_G cvk/G
FD: net/minecraft/client/Minecraft/field_211120_F cvk/H
FD: net/minecraft/client/Minecraft/field_130070_K cvk/I
FD: net/minecraft/client/Minecraft/field_181038_N cvk/J
FD: net/minecraft/client/Minecraft/field_195556_O cvk/K
FD: net/minecraft/client/Minecraft/field_71422_O cvk/L
FD: net/minecraft/client/Minecraft/field_71446_o cvk/M
FD: net/minecraft/client/Minecraft/field_71432_P cvk/N
FD: net/minecraft/client/Minecraft/field_184131_U cvk/O
FD: net/minecraft/client/Minecraft/field_195557_T cvk/P
FD: net/minecraft/client/Minecraft/field_71434_R cvk/Q
FD: net/minecraft/client/Minecraft/field_71433_S cvk/R
FD: net/minecraft/client/Minecraft/field_181541_X cvk/S
FD: net/minecraft/client/Minecraft/field_71428_T cvk/T
FD: net/minecraft/client/Minecraft/field_71427_U cvk/U
FD: net/minecraft/client/Minecraft/field_175616_W cvk/V
FD: net/minecraft/client/Minecraft/field_175621_X cvk/W
FD: net/minecraft/client/Minecraft/field_175620_Y cvk/X
FD: net/minecraft/client/Minecraft/field_193995_ae cvk/Y
FD: net/minecraft/client/Minecraft/field_71449_j cvk/Z
FD: net/minecraft/client/Minecraft/field_142025_a cvk/a
FD: net/minecraft/client/Minecraft/field_211502_b cvk/b
FD: net/minecraft/client/Minecraft/field_71464_q cvk/c
FD: net/minecraft/client/Minecraft/field_213278_d cvk/d
FD: net/minecraft/client/Minecraft/field_71444_a cvk/e
FD: net/minecraft/client/Minecraft/field_71442_b cvk/f
FD: net/minecraft/client/Minecraft/field_195558_d cvk/g
FD: net/minecraft/client/Minecraft/field_71441_e cvk/h
FD: net/minecraft/client/Minecraft/field_71438_f cvk/i
FD: net/minecraft/client/Minecraft/field_71439_g cvk/j
FD: net/minecraft/client/Minecraft/field_175622_Z cvk/k
FD: net/minecraft/client/Minecraft/field_147125_j cvk/l
FD: net/minecraft/client/Minecraft/field_71452_i cvk/m
FD: net/minecraft/client/Minecraft/field_71466_p cvk/n
FD: net/minecraft/client/Minecraft/field_71462_r cvk/o
FD: net/minecraft/client/Minecraft/field_213279_p cvk/p
FD: net/minecraft/client/Minecraft/field_71460_t cvk/q
FD: net/minecraft/client/Minecraft/field_184132_p cvk/r
FD: net/minecraft/client/Minecraft/field_71429_W cvk/s
FD: net/minecraft/client/Minecraft/field_71456_v cvk/t
FD: net/minecraft/client/Minecraft/field_71454_w cvk/u
FD: net/minecraft/client/Minecraft/field_71476_x cvk/v
FD: net/minecraft/client/Minecraft/field_71474_y cvk/w
FD: net/minecraft/client/Minecraft/field_71417_B cvk/x
FD: net/minecraft/client/Minecraft/field_195559_v cvk/y
FD: net/minecraft/client/Minecraft/field_71412_D cvk/z
FD: net/minecraft/client/Minecraft/field_147124_at cvk/aA
FD: net/minecraft/client/Minecraft/field_147128_au cvk/aB
FD: net/minecraft/client/Minecraft/field_147127_av cvk/aC
FD: net/minecraft/client/Minecraft/field_147126_aw cvk/aD
FD: net/minecraft/client/Minecraft/field_211501_aD cvk/aE
FD: net/minecraft/client/Minecraft/field_213271_aF cvk/aF
FD: net/minecraft/client/Minecraft/field_152355_az cvk/aG
FD: net/minecraft/client/Minecraft/field_152350_aA cvk/aH
FD: net/minecraft/client/Minecraft/field_152352_aC cvk/aI
FD: net/minecraft/client/Minecraft/field_175617_aL cvk/aJ
FD: net/minecraft/client/Minecraft/field_175618_aM cvk/aK
FD: net/minecraft/client/Minecraft/field_213272_aL cvk/aL
FD: net/minecraft/client/Minecraft/field_213273_aM cvk/aM
FD: net/minecraft/client/Minecraft/field_193034_aS cvk/aN
FD: net/minecraft/client/Minecraft/field_213274_aO cvk/aO
FD: net/minecraft/client/Minecraft/field_71425_J cvk/aP
FD: net/minecraft/client/Minecraft/field_71419_L cvk/aQ
FD: net/minecraft/client/Minecraft/field_71420_M cvk/aR
FD: net/minecraft/client/Minecraft/field_193035_aW cvk/aS
FD: net/minecraft/client/Minecraft/field_195555_I cvk/aT
FD: net/minecraft/client/Minecraft/field_213275_aU cvk/aU
FD: net/minecraft/client/Minecraft/field_213276_aV cvk/aV
FD: net/minecraft/client/Minecraft/field_71465_an cvk/aW
FD: net/minecraft/client/Minecraft/field_71445_n cvk/aa
FD: net/minecraft/client/Minecraft/field_193996_ah cvk/ab
FD: net/minecraft/client/Minecraft/field_71437_Z cvk/ac
FD: net/minecraft/client/Minecraft/field_213277_ad cvk/ad
FD: net/minecraft/client/Minecraft/field_191950_u cvk/ae
FD: net/minecraft/client/Minecraft/field_110446_Y cvk/af
FD: net/minecraft/client/Minecraft/field_110447_Z cvk/ag
FD: net/minecraft/client/Minecraft/field_184130_ao cvk/ah
FD: net/minecraft/client/Minecraft/field_110453_aa cvk/ai
FD: net/minecraft/client/Minecraft/field_71469_aa cvk/aj
FD: net/minecraft/client/Minecraft/field_71470_ab cvk/ak
FD: net/minecraft/client/Minecraft/field_71467_ac cvk/al
FD: net/minecraft/client/Minecraft/field_71475_ae cvk/am
FD: net/minecraft/client/Minecraft/field_71477_af cvk/an
FD: net/minecraft/client/Minecraft/field_181543_z cvk/ao
FD: net/minecraft/client/Minecraft/field_147129_ai cvk/ap
FD: net/minecraft/client/Minecraft/field_71459_aj cvk/aq
FD: net/minecraft/client/Minecraft/field_71453_ak cvk/ar
FD: net/minecraft/client/Minecraft/field_71455_al cvk/as
FD: net/minecraft/client/Minecraft/field_71424_I cvk/at
FD: net/minecraft/client/Minecraft/field_110451_am cvk/au
FD: net/minecraft/client/Minecraft/field_195554_ax cvk/av
FD: net/minecraft/client/Minecraft/field_110448_aq cvk/aw
FD: net/minecraft/client/Minecraft/field_135017_as cvk/ax
FD: net/minecraft/client/Minecraft/field_184127_aH cvk/ay
FD: net/minecraft/client/Minecraft/field_184128_aI cvk/az
FD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/ENABLED dhq$a/a
FD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/DISABLED dhq$a/b
FD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/PROMPT dhq$a/c
FD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/field_152594_d dhq$a/d
FD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/$VALUES dhq$a/e
FD: net/minecraft/client/multiplayer/ServerData/field_78847_a dhq/a
FD: net/minecraft/client/multiplayer/ServerData/field_78845_b dhq/b
FD: net/minecraft/client/multiplayer/ServerData/field_78846_c dhq/c
FD: net/minecraft/client/multiplayer/ServerData/field_78843_d dhq/d
FD: net/minecraft/client/multiplayer/ServerData/field_78844_e dhq/e
FD: net/minecraft/client/multiplayer/ServerData/field_82821_f dhq/f
FD: net/minecraft/client/multiplayer/ServerData/field_82822_g dhq/g
FD: net/minecraft/client/multiplayer/ServerData/field_78841_f dhq/h
FD: net/minecraft/client/multiplayer/ServerData/field_147412_i dhq/i
FD: net/minecraft/client/multiplayer/ServerData/field_152587_j dhq/j
FD: net/minecraft/client/multiplayer/ServerData/field_147411_m dhq/k
FD: net/minecraft/client/multiplayer/ServerData/field_181042_l dhq/l
FD: net/minecraft/client/renderer/ThreadDownloadImageData$1/field_110932_a dua$1/a
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_147644_c dua/g
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_147643_d dua/h
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_152434_e dua/i
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_110562_b dua/j
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_110563_c dua/k
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_110561_e dua/l
FD: net/minecraft/client/renderer/ThreadDownloadImageData/field_110559_g dua/m
FD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/field_217802_a duf$a/a
FD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/field_217803_b duf$a/b
FD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/field_217804_c duf$a/c
FD: net/minecraft/client/renderer/texture/SimpleTexture/field_110568_b duf/f
FD: net/minecraft/client/renderer/texture/SimpleTexture/field_147639_c duf/g
FD: net/minecraft/client/renderer/texture/TextureManager/field_194008_a duk/a
FD: net/minecraft/client/renderer/texture/TextureManager/field_147646_a duk/b
FD: net/minecraft/client/renderer/texture/TextureManager/field_110585_a duk/c
FD: net/minecraft/client/renderer/texture/TextureManager/field_110583_b duk/d
FD: net/minecraft/client/renderer/texture/TextureManager/field_110584_c duk/e
FD: net/minecraft/client/renderer/texture/TextureManager/field_110582_d duk/f
FD: net/minecraft/client/resources/DefaultPlayerSkin/field_177337_a dut/a
FD: net/minecraft/client/resources/DefaultPlayerSkin/field_177336_b dut/b
FD: net/minecraft/client/resources/SkinManager$1/field_152787_a dvb$1/a
FD: net/minecraft/client/resources/SkinManager$2/field_152635_a dvb$2/a
FD: net/minecraft/client/resources/SkinManager$2/field_152636_b dvb$2/b
FD: net/minecraft/client/resources/SkinManager$2/field_152637_c dvb$2/c
FD: net/minecraft/client/resources/SkinManager$2/field_152638_d dvb$2/d
FD: net/minecraft/client/resources/SkinManager$2/field_177249_e dvb$2/e
FD: net/minecraft/client/resources/SkinManager$2/field_152639_e dvb$2/f
FD: net/minecraft/client/resources/SkinManager/field_152794_b dvb/a
FD: net/minecraft/client/resources/SkinManager/field_152795_c dvb/b
FD: net/minecraft/client/resources/SkinManager/field_152796_d dvb/c
FD: net/minecraft/client/resources/SkinManager/field_152797_e dvb/d
FD: net/minecraft/client/resources/SkinManager/field_152798_f dvb/e
MD: net/minecraft/util/ResourceLocation$Serializer/deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/util/ResourceLocation; qs$a/a (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lqs;
MD: net/minecraft/util/ResourceLocation$Serializer/serialize (Lnet/minecraft/util/ResourceLocation;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement; qs$a/a (Lqs;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
MD: net/minecraft/util/ResourceLocation$Serializer/serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement; qs$a/serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
MD: net/minecraft/util/ResourceLocation$Serializer/deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object; qs$a/deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
MD: net/minecraft/util/ResourceLocation/func_110623_a ()Ljava/lang/String; qs/a ()Ljava/lang/String;
MD: net/minecraft/util/ResourceLocation/func_195824_a (C)Z qs/a (C)Z
MD: net/minecraft/util/ResourceLocation/func_217859_a (I)Z qs/a (I)Z
MD: net/minecraft/util/ResourceLocation/func_195826_a (Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/util/ResourceLocation; qs/a (Lcom/mojang/brigadier/StringReader;)Lqs;
MD: net/minecraft/util/ResourceLocation/func_208304_a (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; qs/a (Ljava/lang/String;)Lqs;
MD: net/minecraft/util/ResourceLocation/func_195828_a (Ljava/lang/String;C)Lnet/minecraft/util/ResourceLocation; qs/a (Ljava/lang/String;C)Lqs;
MD: net/minecraft/util/ResourceLocation/compareTo (Lnet/minecraft/util/ResourceLocation;)I qs/a (Lqs;)I
MD: net/minecraft/util/ResourceLocation/func_110624_b ()Ljava/lang/String; qs/b ()Ljava/lang/String;
MD: net/minecraft/util/ResourceLocation/func_217857_b (I)Z qs/b (I)Z
MD: net/minecraft/util/ResourceLocation/func_217855_b (Ljava/lang/String;)Z qs/b (Ljava/lang/String;)Z
MD: net/minecraft/util/ResourceLocation/func_195823_b (Ljava/lang/String;C)[Ljava/lang/String; qs/b (Ljava/lang/String;C)[Ljava/lang/String;
MD: net/minecraft/util/ResourceLocation/func_217856_c (Ljava/lang/String;)Z qs/c (Ljava/lang/String;)Z
MD: net/minecraft/util/ResourceLocation/func_217858_d (Ljava/lang/String;)Z qs/d (Ljava/lang/String;)Z
MD: net/minecraft/util/ResourceLocation/equals (Ljava/lang/Object;)Z qs/equals (Ljava/lang/Object;)Z
MD: net/minecraft/util/ResourceLocation/hashCode ()I qs/hashCode ()I
MD: net/minecraft/util/ResourceLocation/toString ()Ljava/lang/String; qs/toString ()Ljava/lang/String;
MD: net/minecraft/util/ResourceLocation/compareTo (Ljava/lang/Object;)I qs/compareTo (Ljava/lang/Object;)I
MD: net/minecraft/util/StringUtils/func_76337_a (I)Ljava/lang/String; zy/a (I)Ljava/lang/String;
MD: net/minecraft/util/StringUtils/func_76338_a (Ljava/lang/String;)Ljava/lang/String; zy/a (Ljava/lang/String;)Ljava/lang/String;
MD: net/minecraft/util/StringUtils/func_151246_b (Ljava/lang/String;)Z zy/b (Ljava/lang/String;)Z
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211651_a ()I cty$a/a ()I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211652_a (I)Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat; cty$a/a (I)Lcty$a;
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211655_a (Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat;)I cty$a/a (Lcty$a;)I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211656_b ()V cty$a/b ()V
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211646_b (I)Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat; cty$a/b (I)Lcty$a;
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211658_c ()V cty$a/c ()V
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211650_d ()I cty$a/d ()I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211645_i ()Z cty$a/e ()Z
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211648_n ()I cty$a/f ()I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211653_r ()Z cty$a/g ()Z
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211647_v ()I cty$a/h ()I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/func_211654_w ()Z cty$a/i ()Z
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/values ()[Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat; cty$a/values ()[Lcty$a;
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormat/valueOf (Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat; cty$a/valueOf (Ljava/lang/String;)Lcty$a;
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/func_211672_a ()I cty$b/a ()I
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/values ()[Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode; cty$b/values ()[Lcty$b;
MD: net/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode/valueOf (Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormatGLCode; cty$b/valueOf (Ljava/lang/String;)Lcty$b;
MD: net/minecraft/client/renderer/texture/NativeImage$WriteCallback/func_209267_a ()V cty$c/a ()V
MD: net/minecraft/client/renderer/texture/NativeImage$WriteCallback/invoke (JJI)V cty$c/invoke (JJI)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195702_a ()I cty/a ()I
MD: net/minecraft/client/renderer/texture/NativeImage/func_195709_a (II)I cty/a (II)I
MD: net/minecraft/client/renderer/texture/NativeImage/func_195700_a (III)V cty/a (III)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195715_a (IIIII)V cty/a (IIIII)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195706_a (IIIIIIIZ)V cty/a (IIIIIIIZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195712_a (IIIIIIIZZZ)V cty/a (IIIIIIIZZZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195699_a (IIIIIIZZ)V cty/a (IIIIIIZZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195708_a (IIIILnet/minecraft/client/renderer/texture/NativeImage;)V cty/a (IIIILcty;)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195697_a (IIIZ)V cty/a (IIIZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195717_a (IZ)V cty/a (IZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_211679_a (Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat;Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; cty/a (Lcty$a;Ljava/io/InputStream;)Lcty;
MD: net/minecraft/client/renderer/texture/NativeImage/func_211677_a (Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat;Ljava/nio/ByteBuffer;)Lnet/minecraft/client/renderer/texture/NativeImage; cty/a (Lcty$a;Ljava/nio/ByteBuffer;)Lcty;
MD: net/minecraft/client/renderer/texture/NativeImage/func_195703_a (Lnet/minecraft/client/renderer/texture/NativeImage;)V cty/a (Lcty;)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_209271_a (Ljava/io/File;)V cty/a (Ljava/io/File;)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; cty/a (Ljava/io/InputStream;)Lcty;
MD: net/minecraft/client/renderer/texture/NativeImage/func_216510_a (Ljava/lang/String;)V cty/a (Ljava/lang/String;)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195704_a (Ljava/nio/ByteBuffer;)Lnet/minecraft/client/renderer/texture/NativeImage; cty/a (Ljava/nio/ByteBuffer;)Lcty;
MD: net/minecraft/client/renderer/texture/NativeImage/func_209270_a (Ljava/nio/file/Path;)V cty/a (Ljava/nio/file/Path;)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_211676_a (Lorg/lwjgl/stb/STBTTFontinfo;IIIFFFFII)V cty/a (Lorg/lwjgl/stb/STBTTFontinfo;IIIFFFFII)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195701_a (Z)V cty/a (Z)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195705_a (ZZ)V cty/a (ZZ)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195714_b ()I cty/b ()I
MD: net/minecraft/client/renderer/texture/NativeImage/func_211675_e (II)B cty/b (II)B
MD: net/minecraft/client/renderer/texture/NativeImage/func_195718_b (III)V cty/b (III)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_216511_b (Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; cty/b (Ljava/lang/String;)Lcty;
MD: net/minecraft/client/renderer/texture/NativeImage/func_195707_b (Z)V cty/b (Z)V
MD: net/minecraft/client/renderer/texture/NativeImage/func_211678_c ()Lnet/minecraft/client/renderer/texture/NativeImage$PixelFormat; cty/c ()Lcty$a;
MD: net/minecraft/client/renderer/texture/NativeImage/func_195716_c ()[I cty/d ()[I
MD: net/minecraft/client/renderer/texture/NativeImage/func_195710_e ()V cty/e ()V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195711_f ()V cty/f ()V
MD: net/minecraft/client/renderer/texture/NativeImage/func_195696_g ()V cty/g ()V
MD: net/minecraft/client/renderer/texture/NativeImage/close ()V cty/close ()V
MD: net/minecraft/client/renderer/texture/NativeImage/toString ()Ljava/lang/String; cty/toString ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft$1/run ()V cvk$1/run ()V
MD: net/minecraft/client/Minecraft/func_71401_C ()Lnet/minecraft/server/integrated/IntegratedServer; cvk/A ()Ldxk;
MD: net/minecraft/client/Minecraft/func_71378_E ()Lnet/minecraft/profiler/Snooper; cvk/B ()Lahk;
MD: net/minecraft/client/Minecraft/func_110432_I ()Lnet/minecraft/util/Session; cvk/C ()Lcvv;
MD: net/minecraft/client/Minecraft/func_181037_M ()Lcom/mojang/authlib/properties/PropertyMap; cvk/D ()Lcom/mojang/authlib/properties/PropertyMap;
MD: net/minecraft/client/Minecraft/func_110437_J ()Ljava/net/Proxy; cvk/E ()Ljava/net/Proxy;
MD: net/minecraft/client/Minecraft/func_110434_K ()Lnet/minecraft/client/renderer/texture/TextureManager; cvk/F ()Lduk;
MD: net/minecraft/client/Minecraft/func_195551_G ()Lnet/minecraft/resources/IResourceManager; cvk/G ()Lxe;
MD: net/minecraft/client/Minecraft/func_195548_H ()Lnet/minecraft/resources/ResourcePackList; cvk/H ()Lwt;
MD: net/minecraft/client/Minecraft/func_195541_I ()Lnet/minecraft/client/resources/DownloadingPackFinder; cvk/I ()Ldur;
MD: net/minecraft/client/Minecraft/func_195549_J ()Ljava/io/File; cvk/J ()Ljava/io/File;
MD: net/minecraft/client/Minecraft/func_135016_M ()Lnet/minecraft/client/resources/LanguageManager; cvk/K ()Ldvh;
MD: net/minecraft/client/Minecraft/func_147117_R ()Lnet/minecraft/client/renderer/texture/AtlasTexture; cvk/L ()Ldui;
MD: net/minecraft/client/Minecraft/func_147111_S ()Z cvk/M ()Z
MD: net/minecraft/client/Minecraft/func_147113_T ()Z cvk/N ()Z
MD: net/minecraft/client/Minecraft/func_147118_V ()Lnet/minecraft/client/audio/SoundHandler; cvk/O ()Ldxx;
MD: net/minecraft/client/Minecraft/func_147109_W ()Lnet/minecraft/client/audio/MusicTicker$MusicType; cvk/P ()Ldxs$a;
MD: net/minecraft/client/Minecraft/func_152347_ac ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; cvk/R ()Lcom/mojang/authlib/minecraft/MinecraftSessionService;
MD: net/minecraft/client/Minecraft/func_152342_ad ()Lnet/minecraft/client/resources/SkinManager; cvk/S ()Ldvb;
MD: net/minecraft/client/Minecraft/func_175606_aa ()Lnet/minecraft/entity/Entity; cvk/T ()Laii;
MD: net/minecraft/client/Minecraft/func_175602_ab ()Lnet/minecraft/client/renderer/BlockRendererDispatcher; cvk/U ()Ldle;
MD: net/minecraft/client/Minecraft/func_175598_ae ()Lnet/minecraft/client/renderer/entity/EntityRendererManager; cvk/V ()Ldpi;
MD: net/minecraft/client/Minecraft/func_175599_af ()Lnet/minecraft/client/renderer/ItemRenderer; cvk/W ()Ldqd;
MD: net/minecraft/client/Minecraft/func_175597_ag ()Lnet/minecraft/client/renderer/FirstPersonRenderer; cvk/X ()Ldkm;
MD: net/minecraft/client/Minecraft/func_175610_ah ()I cvk/Y ()I
MD: net/minecraft/client/Minecraft/func_181539_aj ()Lnet/minecraft/util/FrameTimer; cvk/Z ()Lzl;
MD: net/minecraft/client/Minecraft/func_213226_a ()V cvk/a ()V
MD: net/minecraft/client/Minecraft/func_71383_b (I)V cvk/a (I)V
MD: net/minecraft/client/Minecraft/func_195545_a (IJ)V cvk/a (IJ)V
MD: net/minecraft/client/Minecraft/func_70000_a (Lnet/minecraft/profiler/Snooper;)V cvk/a (Lahk;)V
MD: net/minecraft/client/Minecraft/func_175607_a (Lnet/minecraft/entity/Entity;)V cvk/a (Laii;)V
MD: net/minecraft/client/Minecraft/func_213235_a (Lnet/minecraft/item/ItemStack;)Ljava/util/stream/Stream; cvk/a (Lbcb;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_184119_a (Lnet/minecraft/item/ItemStack;Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/item/ItemStack; cvk/a (Lbcb;Lbtn;)Lbcb;
MD: net/minecraft/client/Minecraft/func_213244_a (Lnet/minecraft/item/crafting/IRecipe;)Lnet/minecraft/util/ResourceLocation; cvk/a (Lbej;)Lqs;
MD: net/minecraft/client/Minecraft/access$000 (Lnet/minecraft/client/Minecraft;)Z cvk/a (Lcvk;)Z
MD: net/minecraft/client/Minecraft/func_213268_a (Lnet/minecraft/client/gui/LoadingGui;)V cvk/a (Lczo;)V
MD: net/minecraft/client/Minecraft/func_147108_a (Lnet/minecraft/client/gui/screen/Screen;)V cvk/a (Lczt;)V
MD: net/minecraft/client/Minecraft/func_71404_a (Lnet/minecraft/crash/CrashReport;)V cvk/a (Ld;)V
MD: net/minecraft/client/Minecraft/func_213258_a (Lnet/minecraft/client/gui/recipebook/RecipeList;)Ljava/util/stream/Stream; cvk/a (Ldck;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_71403_a (Lnet/minecraft/client/world/ClientWorld;)V cvk/a (Ldhn;)V
MD: net/minecraft/client/Minecraft/func_71351_a (Lnet/minecraft/client/multiplayer/ServerData;)V cvk/a (Ldhq;)V
MD: net/minecraft/client/Minecraft/func_213232_a (Lnet/minecraft/client/util/SearchTree;Lnet/minecraft/client/util/SearchTreeReloadable;Lnet/minecraft/item/ItemStack;)V cvk/a (Ldxe;Ldxd;Lbcb;)V
MD: net/minecraft/client/Minecraft/func_213253_a (Lnet/minecraft/client/util/SearchTreeManager$Key;)Lnet/minecraft/client/util/IMutableSearchTree; cvk/a (Ldxf$a;)Ldxc;
MD: net/minecraft/client/Minecraft/func_213238_a (Ljava/lang/String;)Z cvk/a (Ljava/lang/String;)Z
MD: net/minecraft/client/Minecraft/func_71371_a (Ljava/lang/String;Ljava/lang/String;Lnet/minecraft/world/WorldSettings;)V cvk/a (Ljava/lang/String;Ljava/lang/String;Lbhm;)V
MD: net/minecraft/client/Minecraft/func_213262_a (Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/resources/IResourcePack;Lnet/minecraft/resources/data/PackMetadataSection;Lnet/minecraft/resources/ResourcePackInfo$Priority;)Lnet/minecraft/client/resources/ClientResourcePackInfo; cvk/a (Ljava/lang/String;ZLjava/util/function/Supplier;Lwh;Lwm;Lww$a;)Ldve;
MD: net/minecraft/client/Minecraft/func_213236_a (Ljava/util/List;Ljava/util/concurrent/CompletableFuture;)V cvk/a (Ljava/util/List;Ljava/util/concurrent/CompletableFuture;)V
MD: net/minecraft/client/Minecraft/func_213240_a (Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletionStage; cvk/a (Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletionStage;
MD: net/minecraft/client/Minecraft/func_213228_a (Z)V cvk/a (Z)V
MD: net/minecraft/client/Minecraft/func_99999_d ()V cvk/b ()V
MD: net/minecraft/client/Minecraft/func_213246_b (I)Lnet/minecraft/world/chunk/listener/IChunkStatusListener; cvk/b (I)Lvp;
MD: net/minecraft/client/Minecraft/func_213251_b (Lnet/minecraft/item/ItemStack;)Ljava/util/stream/Stream; cvk/b (Lbcb;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_213234_b (Lnet/minecraft/item/crafting/IRecipe;)Ljava/util/stream/Stream; cvk/b (Lbej;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_213231_b (Lnet/minecraft/client/gui/screen/Screen;)V cvk/b (Lczt;)V
MD: net/minecraft/client/Minecraft/func_71396_d (Lnet/minecraft/crash/CrashReport;)Lnet/minecraft/crash/CrashReport; cvk/b (Ld;)Ld;
MD: net/minecraft/client/Minecraft/func_213252_b (Lnet/minecraft/client/gui/recipebook/RecipeList;)Ljava/util/stream/Stream; cvk/b (Ldck;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_213257_b (Lnet/minecraft/client/world/ClientWorld;)V cvk/b (Ldhn;)V
MD: net/minecraft/client/Minecraft/func_213267_b (Ljava/lang/String;)Z cvk/b (Ljava/lang/String;)Z
MD: net/minecraft/client/Minecraft/func_213265_b (Ljava/util/concurrent/CompletableFuture;)V cvk/b (Ljava/util/concurrent/CompletableFuture;)V
MD: net/minecraft/client/Minecraft/func_213270_b (Ljava/util/function/Supplier;)Lnet/minecraft/resources/IResourcePack; cvk/b (Ljava/util/function/Supplier;)Lwh;
MD: net/minecraft/client/Minecraft/func_213261_b (Lnet/minecraft/util/text/ITextComponent;)V cvk/b (Ljm;)V
MD: net/minecraft/client/Minecraft/func_213227_b (Z)V cvk/b (Z)V
MD: net/minecraft/client/Minecraft/func_147110_a ()Lnet/minecraft/client/shader/Framebuffer; cvk/c ()Lcto;
MD: net/minecraft/client/Minecraft/func_213242_c (Lnet/minecraft/item/ItemStack;)Ljava/util/stream/Stream; cvk/c (Lbcb;)Ljava/util/stream/Stream;
MD: net/minecraft/client/Minecraft/func_213241_c (Lnet/minecraft/client/gui/screen/Screen;)V cvk/c (Lczt;)V
MD: net/minecraft/client/Minecraft/func_71377_b (Lnet/minecraft/crash/CrashReport;)V cvk/c (Ld;)V
MD: net/minecraft/client/Minecraft/func_212874_c_ (Ljava/lang/Runnable;)Z cvk/c (Ljava/lang/Runnable;)Z
MD: net/minecraft/client/Minecraft/func_213264_c (Lnet/minecraft/util/text/ITextComponent;)Ljava/lang/String; cvk/c (Ljm;)Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_71385_j (Z)V cvk/c (Z)V
MD: net/minecraft/client/Minecraft/func_175600_c ()Ljava/lang/String; cvk/d ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_212875_d_ (Ljava/lang/Runnable;)Ljava/lang/Runnable; cvk/d (Ljava/lang/Runnable;)Ljava/lang/Runnable;
MD: net/minecraft/client/Minecraft/func_213230_d (Lnet/minecraft/util/text/ITextComponent;)Ljava/lang/String; cvk/d (Ljm;)Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_181537_a (Z)V cvk/d (Z)V
MD: net/minecraft/client/Minecraft/func_184123_d ()Ljava/lang/String; cvk/e ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_195542_b (Z)V cvk/e (Z)V
MD: net/minecraft/client/Minecraft/func_211821_e ()Z cvk/f ()Z
MD: net/minecraft/client/Minecraft/func_147115_a (Z)V cvk/f (Z)V
MD: net/minecraft/client/Minecraft/func_213237_g ()Ljava/util/concurrent/CompletableFuture; cvk/g ()Ljava/util/concurrent/CompletableFuture;
MD: net/minecraft/client/Minecraft/func_71359_d ()Lnet/minecraft/world/storage/SaveFormat; cvk/h ()Lcof;
MD: net/minecraft/client/Minecraft/func_71405_e ()V cvk/i ()V
MD: net/minecraft/client/Minecraft/func_71398_f ()V cvk/j ()V
MD: net/minecraft/client/Minecraft/func_71400_g ()V cvk/k ()V
MD: net/minecraft/client/Minecraft/func_181535_r ()Lnet/minecraft/client/audio/MusicTicker; cvk/l ()Ldxs;
MD: net/minecraft/client/Minecraft/func_71407_l ()V cvk/m ()V
MD: net/minecraft/client/Minecraft/func_213254_o ()V cvk/n ()V
MD: net/minecraft/client/Minecraft/func_71355_q ()Z cvk/o ()Z
MD: net/minecraft/client/Minecraft/func_147114_u ()Lnet/minecraft/client/network/play/ClientPlayNetHandler; cvk/q ()Ldhk;
MD: net/minecraft/client/Minecraft/func_71382_s ()Z cvk/r ()Z
MD: net/minecraft/client/Minecraft/func_71375_t ()Z cvk/s ()Z
MD: net/minecraft/client/Minecraft/func_71379_u ()Z cvk/t ()Z
MD: net/minecraft/client/Minecraft/func_71410_x ()Lnet/minecraft/client/Minecraft; cvk/u ()Lcvk;
MD: net/minecraft/client/Minecraft/func_213245_w ()Ljava/util/concurrent/CompletableFuture; cvk/v ()Ljava/util/concurrent/CompletableFuture;
MD: net/minecraft/client/Minecraft/func_71369_N ()I cvk/w ()I
MD: net/minecraft/client/Minecraft/func_147104_D ()Lnet/minecraft/client/multiplayer/ServerData; cvk/x ()Ldhq;
MD: net/minecraft/client/Minecraft/func_71387_A ()Z cvk/y ()Z
MD: net/minecraft/client/Minecraft/func_71356_B ()Z cvk/z ()Z
MD: net/minecraft/client/Minecraft/func_213256_aB ()V cvk/aA ()V
MD: net/minecraft/client/Minecraft/func_213243_aC ()I cvk/aB ()I
MD: net/minecraft/client/Minecraft/func_213266_aD ()Z cvk/aC ()Z
MD: net/minecraft/client/Minecraft/func_203410_as ()V cvk/aD ()V
MD: net/minecraft/client/Minecraft/func_147116_af ()V cvk/aE ()V
MD: net/minecraft/client/Minecraft/func_147121_ag ()V cvk/aF ()V
MD: net/minecraft/client/Minecraft/func_184117_aA ()V cvk/aG ()V
MD: net/minecraft/client/Minecraft/func_147112_ai ()V cvk/aH ()V
MD: net/minecraft/client/Minecraft/func_181538_aA ()Ljava/lang/String; cvk/aI ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_213255_aK ()Ljava/lang/String; cvk/aJ ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_213259_aL ()Ljava/lang/String; cvk/aK ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_211822_az ()Ljava/lang/String; cvk/aL ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_211816_aA ()Ljava/lang/String; cvk/aM ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_211112_aw ()Ljava/lang/String; cvk/aN ()Ljava/lang/String;
MD: net/minecraft/client/Minecraft/func_213249_aP ()Z cvk/aO ()Z
MD: net/minecraft/client/Minecraft/func_213233_aQ ()V cvk/aP ()V
MD: net/minecraft/client/Minecraft/func_213260_aR ()V cvk/aQ ()V
MD: net/minecraft/client/Minecraft/func_213247_aS ()I cvk/aR ()I
MD: net/minecraft/client/Minecraft/func_181540_al ()Z cvk/aa ()Z
MD: net/minecraft/client/Minecraft/func_184126_aj ()Lcom/mojang/datafixers/DataFixer; cvk/ab ()Lcom/mojang/datafixers/DataFixer;
MD: net/minecraft/client/Minecraft/func_184121_ak ()F cvk/ac ()F
MD: net/minecraft/client/Minecraft/func_193989_ak ()F cvk/ad ()F
MD: net/minecraft/client/Minecraft/func_184125_al ()Lnet/minecraft/client/renderer/color/BlockColors; cvk/ae ()Lcvx;
MD: net/minecraft/client/Minecraft/func_189648_am ()Z cvk/ag ()Z
MD: net/minecraft/client/Minecraft/func_193033_an ()Lnet/minecraft/client/gui/toasts/ToastGui; cvk/ah ()Lcxv;
MD: net/minecraft/client/Minecraft/func_193032_ao ()Lnet/minecraft/client/tutorial/Tutorial; cvk/ai ()Ldyh;
MD: net/minecraft/client/Minecraft/func_195544_aj ()Z cvk/aj ()Z
MD: net/minecraft/client/Minecraft/func_199403_al ()Lnet/minecraft/client/settings/CreativeSettings; cvk/ak ()Lcvg;
MD: net/minecraft/client/Minecraft/func_209506_al ()Lnet/minecraft/client/renderer/model/ModelManager; cvk/al ()Ldwb;
MD: net/minecraft/client/Minecraft/func_211500_ak ()Lnet/minecraft/client/gui/fonts/FontResourceManager; cvk/am ()Lcxz;
MD: net/minecraft/client/Minecraft/func_213263_ao ()Lnet/minecraft/client/renderer/texture/PaintingSpriteUploader; cvk/an ()Ldva;
MD: net/minecraft/client/Minecraft/func_213248_ap ()Lnet/minecraft/client/renderer/texture/PotionSpriteUploader; cvk/ao ()Lduz;
MD: net/minecraft/client/Minecraft/func_213239_aq ()Lnet/minecraft/profiler/IProfiler; cvk/ap ()Lagh;
MD: net/minecraft/client/Minecraft/func_213229_ar ()Lnet/minecraft/client/MinecraftGame; cvk/aq ()Lcve;
MD: net/minecraft/client/Minecraft/func_213269_at ()Lnet/minecraft/client/util/Splashes; cvk/as ()Ldvc;
MD: net/minecraft/client/Minecraft/func_213250_au ()Lnet/minecraft/client/gui/LoadingGui; cvk/at ()Lczo;
MD: net/minecraft/client/Minecraft/func_71384_a ()V cvk/au ()V
MD: net/minecraft/client/Minecraft/func_193986_ar ()V cvk/av ()V
MD: net/minecraft/client/Minecraft/func_213170_ax ()Ljava/lang/Thread; cvk/ax ()Ljava/lang/Thread;
MD: net/minecraft/client/Minecraft/func_147122_X ()Z cvk/ay ()Z
MD: net/minecraft/client/Minecraft/func_71389_H ()V cvk/az ()V
MD: net/minecraft/client/Minecraft/close ()V cvk/close ()V
MD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/func_152589_a ()Lnet/minecraft/util/text/ITextComponent; dhq$a/a ()Ljm;
MD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/values ()[Lnet/minecraft/client/multiplayer/ServerData$ServerResourceMode; dhq$a/values ()[Ldhq$a;
MD: net/minecraft/client/multiplayer/ServerData$ServerResourceMode/valueOf (Ljava/lang/String;)Lnet/minecraft/client/multiplayer/ServerData$ServerResourceMode; dhq$a/valueOf (Ljava/lang/String;)Ldhq$a;
MD: net/minecraft/client/multiplayer/ServerData/func_78836_a ()Lnet/minecraft/nbt/CompoundNBT; dhq/a ()Lib;
MD: net/minecraft/client/multiplayer/ServerData/func_152584_a (Lnet/minecraft/client/multiplayer/ServerData$ServerResourceMode;)V dhq/a (Ldhq$a;)V
MD: net/minecraft/client/multiplayer/ServerData/func_152583_a (Lnet/minecraft/client/multiplayer/ServerData;)V dhq/a (Ldhq;)V
MD: net/minecraft/client/multiplayer/ServerData/func_78837_a (Lnet/minecraft/nbt/CompoundNBT;)Lnet/minecraft/client/multiplayer/ServerData; dhq/a (Lib;)Ldhq;
MD: net/minecraft/client/multiplayer/ServerData/func_147407_a (Ljava/lang/String;)V dhq/a (Ljava/lang/String;)V
MD: net/minecraft/client/multiplayer/ServerData/func_152586_b ()Lnet/minecraft/client/multiplayer/ServerData$ServerResourceMode; dhq/b ()Ldhq$a;
MD: net/minecraft/client/multiplayer/ServerData/func_147409_e ()Ljava/lang/String; dhq/c ()Ljava/lang/String;
MD: net/minecraft/client/multiplayer/ServerData/func_181041_d ()Z dhq/d ()Z
MD: net/minecraft/client/renderer/IImageBuffer/func_152634_a ()V dkl/a ()V
MD: net/minecraft/client/renderer/IImageBuffer/func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; dkl/a (Lcty;)Lcty;
MD: net/minecraft/client/renderer/ImageBufferDownload/func_152634_a ()V dkq/a ()V
MD: net/minecraft/client/renderer/ImageBufferDownload/func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; dkq/a (Lcty;)Lcty;
MD: net/minecraft/client/renderer/ImageBufferDownload/func_195788_a (Lnet/minecraft/client/renderer/texture/NativeImage;IIII)V dkq/a (Lcty;IIII)V
MD: net/minecraft/client/renderer/ImageBufferDownload/func_195787_b (Lnet/minecraft/client/renderer/texture/NativeImage;IIII)V dkq/b (Lcty;IIII)V
MD: net/minecraft/client/renderer/ThreadDownloadImageData$1/func_217786_a (Ljava/io/InputStream;)V dua$1/a (Ljava/io/InputStream;)V
MD: net/minecraft/client/renderer/ThreadDownloadImageData$1/run ()V dua$1/run ()V
MD: net/minecraft/client/renderer/ThreadDownloadImageData/func_152433_a ()V dua/a ()V
MD: net/minecraft/client/renderer/ThreadDownloadImageData/func_195417_a (Lnet/minecraft/client/renderer/texture/NativeImage;)V dua/a (Lcty;)V
MD: net/minecraft/client/renderer/ThreadDownloadImageData/access$000 (Lnet/minecraft/client/renderer/ThreadDownloadImageData;)Ljava/lang/String; dua/a (Ldua;)Ljava/lang/String;
MD: net/minecraft/client/renderer/ThreadDownloadImageData/func_195413_a (Lnet/minecraft/resources/IResourceManager;)V dua/a (Lxe;)V
MD: net/minecraft/client/renderer/ThreadDownloadImageData/func_195416_b (Lnet/minecraft/client/renderer/texture/NativeImage;)V dua/b (Lcty;)V
MD: net/minecraft/client/renderer/ThreadDownloadImageData/access$100 (Lnet/minecraft/client/renderer/ThreadDownloadImageData;)Ljava/io/File; dua/b (Ldua;)Ljava/io/File;
MD: net/minecraft/client/renderer/ThreadDownloadImageData/access$300 (Lnet/minecraft/client/renderer/ThreadDownloadImageData;)Lnet/minecraft/client/renderer/IImageBuffer; dua/c (Ldua;)Ldkl;
MD: net/minecraft/client/renderer/ThreadDownloadImageData/access$200 ()Lorg/apache/logging/log4j/Logger; dua/e ()Lorg/apache/logging/log4j/Logger;
MD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/func_217798_a ()Lnet/minecraft/client/resources/data/TextureMetadataSection; duf$a/a ()Ldvu;
MD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/func_217799_a (Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/SimpleTexture$TextureData; duf$a/a (Lxe;Lqs;)Lduf$a;
MD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/func_217800_b ()Lnet/minecraft/client/renderer/texture/NativeImage; duf$a/b ()Lcty;
MD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/func_217801_c ()V duf$a/c ()V
MD: net/minecraft/client/renderer/texture/SimpleTexture$TextureData/close ()V duf$a/close ()V
MD: net/minecraft/client/renderer/texture/SimpleTexture/func_195413_a (Lnet/minecraft/resources/IResourceManager;)V duf/a (Lxe;)V
MD: net/minecraft/client/renderer/texture/SimpleTexture/func_215246_b (Lnet/minecraft/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/SimpleTexture$TextureData; duf/b (Lxe;)Lduf$a;
MD: net/minecraft/client/renderer/texture/SimpleTexture/func_215245_f ()Lorg/apache/logging/log4j/Logger; duf/f ()Lorg/apache/logging/log4j/Logger;
MD: net/minecraft/client/renderer/texture/TextureManager/func_210123_a (Lnet/minecraft/client/renderer/texture/ITextureObject;)Ljava/lang/String; duk/a (Ldul;)Ljava/lang/String;
MD: net/minecraft/client/renderer/texture/TextureManager/func_110578_a (Ljava/lang/String;Lnet/minecraft/client/renderer/texture/DynamicTexture;)Lnet/minecraft/util/ResourceLocation; duk/a (Ljava/lang/String;Ldtz;)Lqs;
MD: net/minecraft/client/renderer/texture/TextureManager/func_110577_a (Lnet/minecraft/util/ResourceLocation;)V duk/a (Lqs;)V
MD: net/minecraft/client/renderer/texture/TextureManager/func_215267_a (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/PreloadedTexture;)V duk/a (Lqs;Ldue;)V
MD: net/minecraft/client/renderer/texture/TextureManager/func_110579_a (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z duk/a (Lqs;Ldul;)Z
MD: net/minecraft/client/renderer/texture/TextureManager/func_110580_a (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITickableTextureObject;)Z duk/a (Lqs;Ldun;)Z
MD: net/minecraft/client/renderer/texture/TextureManager/func_215268_a (Lnet/minecraft/util/ResourceLocation;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture; duk/a (Lqs;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
MD: net/minecraft/client/renderer/texture/TextureManager/func_215226_a (Lnet/minecraft/resources/IFutureReloadListener$IStage;Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/profiler/IProfiler;Lnet/minecraft/profiler/IProfiler;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture; duk/a (Lwz$a;Lxe;Lagh;Lagh;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
MD: net/minecraft/client/renderer/texture/TextureManager/func_215266_a (Lnet/minecraft/resources/IResourceManager;Ljava/util/concurrent/Executor;Ljava/lang/Void;)V duk/a (Lxe;Ljava/util/concurrent/Executor;Ljava/lang/Void;)V
MD: net/minecraft/client/renderer/texture/TextureManager/func_110581_b (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; duk/b (Lqs;)Ldul;
MD: net/minecraft/client/renderer/texture/TextureManager/func_147645_c (Lnet/minecraft/util/ResourceLocation;)V duk/c (Lqs;)V
MD: net/minecraft/client/renderer/texture/TextureManager/func_110550_d ()V duk/e ()V
MD: net/minecraft/client/renderer/texture/ITextureObject/func_215244_a (Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/util/ResourceLocation;Ljava/util/concurrent/Executor;)V dul/a (Lduk;Lxe;Lqs;Ljava/util/concurrent/Executor;)V
MD: net/minecraft/client/renderer/texture/ITextureObject/func_195413_a (Lnet/minecraft/resources/IResourceManager;)V dul/a (Lxe;)V
MD: net/minecraft/client/renderer/texture/ITextureObject/func_174935_a ()V dul/b ()V
MD: net/minecraft/client/renderer/texture/ITextureObject/func_174936_b (ZZ)V dul/b (ZZ)V
MD: net/minecraft/client/renderer/texture/ITextureObject/func_110552_b ()I dul/c ()I
MD: net/minecraft/client/renderer/texture/ITextureObject/func_195412_h ()V dul/h ()V
MD: net/minecraft/client/resources/DefaultPlayerSkin/func_177335_a ()Lnet/minecraft/util/ResourceLocation; dut/a ()Lqs;
MD: net/minecraft/client/resources/DefaultPlayerSkin/func_177334_a (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; dut/a (Ljava/util/UUID;)Lqs;
MD: net/minecraft/client/resources/DefaultPlayerSkin/func_177332_b (Ljava/util/UUID;)Ljava/lang/String; dut/b (Ljava/util/UUID;)Ljava/lang/String;
MD: net/minecraft/client/resources/DefaultPlayerSkin/func_177333_c (Ljava/util/UUID;)Z dut/c (Ljava/util/UUID;)Z
MD: net/minecraft/client/resources/SkinManager$1/load (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; dvb$1/a (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;
MD: net/minecraft/client/resources/SkinManager$1/load (Ljava/lang/Object;)Ljava/lang/Object; dvb$1/load (Ljava/lang/Object;)Ljava/lang/Object;
MD: net/minecraft/client/resources/SkinManager$2/func_152634_a ()V dvb$2/a ()V
MD: net/minecraft/client/resources/SkinManager$2/func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; dvb$2/a (Lcty;)Lcty;
MD: net/minecraft/client/resources/SkinManager$SkinAvailableCallback/func_180521_a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V dvb$a/onSkinTextureAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lqs;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V
MD: net/minecraft/client/resources/SkinManager/func_152788_a (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; dvb/a (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;
MD: net/minecraft/client/resources/SkinManager/func_152790_a (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V dvb/a (Lcom/mojang/authlib/GameProfile;Ldvb$a;Z)V
MD: net/minecraft/client/resources/SkinManager/func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V dvb/a (Lcom/mojang/authlib/GameProfile;ZLdvb$a;)V
MD: net/minecraft/client/resources/SkinManager/func_152792_a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; dvb/a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lqs;
MD: net/minecraft/client/resources/SkinManager/func_152789_a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; dvb/a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Ldvb$a;)Lqs;
MD: net/minecraft/client/resources/SkinManager/func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V dvb/a (Ljava/util/Map;Ldvb$a;)V
MD: net/minecraft/client/Minecraft/addScheduledTask (Ljava/lang/Runnable;)V cvk/execute (Ljava/lang/Runnable;)V
+7
View File
@@ -0,0 +1,7 @@
minecraft_version=1.14.2
minecraft_full_versions=1.14.2
#forge gradle needs forge version
forge_mc_version=1.12.2
forge_version=14.23.5.2768
mappings_version=stable_39
srg_notch_map=1.14.2.srg
@@ -0,0 +1,40 @@
package net.minecraft.client;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.Session;
import java.io.File;
public class Minecraft {
public File gameDir = null;
public static Minecraft getMinecraft() {
return null;
}
public SkinManager getSkinManager() {
return null;
}
public TextureManager getTextureManager() {
return null;
}
public MinecraftSessionService getSessionService() {
return null;
}
public Session getSession() {
return null;
}
public ServerData getCurrentServerData() {
return null;
}
public void addScheduledTask(Runnable r) {
}
}
@@ -1,357 +0,0 @@
package idv.jlchntoz;
import net.minecraft.src.Minecraft;
import java.io.*;
import java.math.BigInteger;
import java.net.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 12th Revision 9th Subversion 2016.2.10
*
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
*/
public class CustomSkinLoader {
public final static String VERSION="12.9";
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newResPattern = Pattern.compile("^http://textures.minecraft.net/texture/(.*?)?(Skin|Cloak)=(.*?)$"),
newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$"),
optifineCapeURLPattern = Pattern.compile("^http://s.optifine.net/capes/(.*?).png$");
public final static File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
CACHE_DIR=new File(DATA_DIR,"caches"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
SKIN_URL_FILE=new File(DATA_DIR,"skinurls.txt"),
CAPE_URL_FILE=new File(DATA_DIR,"capeurls.txt");
public final static MainLogger logger = getLogger(LOG_FILE);
public final static String[] DEFAULT_SKIN_URLS={
"http://skins.minecraft.net/MinecraftSkins/*.png",
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
"http://www.skinme.cc/MinecraftSkins/*.png"};
public final static String[] DEFAULT_CAPE_URLS={
"http://skins.minecraft.net/MinecraftCloaks/*.png",
"http://s.optifine.net/capes/*.png",
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
"http://www.skinme.cc/MinecraftCloaks/*.png"};
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
//Entrance
public InputStream getPlayerSkinStream(String path) {
if(!DATA_DIR.exists())
DATA_DIR.mkdir();
if(!CACHE_DIR.exists())
CACHE_DIR.mkdir();
logger.info("Get a request: "+path);
if(path.contains("NOCSL"))//Not to use CSL to load, prepared for json api
return getStream(path, false);
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//May be old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}else{
m = newResPattern.matcher(path);
if(m.matches()){
if (m.group(2).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(3));
else if (m.group(2).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(3));
}else{
m = optifineCapeURLPattern.matcher(path);
if(m.matches()){//Optifine Cape
logger.info("Ignore Optifine Cape.");
return null;//Not Load This
}
}
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if ((skinURLs == null|| skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))
refreshSkinURL(); // If the list is blank or null, try to load again.
InputStream S=null;
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
S = getStream(loc, true);
if (S == null){
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin") + " found in " + loc);
}else{
logger.info("Succeessfully load " + (isCloak ? "cloak" : "skin") + " in " + loc);
return S;
}
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
boolean success=false;
File cacheFile=new File(CACHE_DIR,MD5(URL));
boolean alreadyCached=false;
if(cacheFile.exists()&&cacheFile.length()>1){
alreadyCached=true;
logger.info("Cache File Found (LastModified: "+cacheFile.lastModified()+" , Size: "+cacheFile.length()+")");
}
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setReadTimeout(15000);
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
logger.info("Response Code: "+C.getResponseCode());
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful to get skin.
if(C.getContentLength()<=0){//Nothing got
logger.info("Nothing got.");
return null;
}
logger.info("Successfully Get Resource (LastModified: "+C.getLastModified()+" , ContentLength: "+C.getContentLength()+")");
if(alreadyCached && C.getLastModified()==cacheFile.lastModified() && C.getContentLength()==cacheFile.length()){
logger.info("Not Modified.");
return getStreamFromCache(cacheFile);
}
InputStream IS=new BufferedInputStream(C.getInputStream());
if (!CheckPNG){ // If no need to check PNG header, just skip it.
success=true;
saveToCache(IS,cacheFile);
return IS;
}
//logger.info(C.getContentLength()+" "+IS.available());
IS.mark(C.getContentLength()+10);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N' && ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
success=true;
saveToCache(IS,cacheFile);
return IS;
}
}
} catch (Exception ex) {
success=false;
logger.log(Level.WARNING, ex.getMessage());
if(alreadyCached)
return getStreamFromCache(cacheFile);
}finally{
if(!success)
disconnect();
}
return null;
}
private InputStream getStreamFromCache(File cacheFile) {
try{
logger.info("Try load local cache in " + cacheFile.getAbsolutePath());
InputStream in = new FileInputStream(cacheFile);
BufferedInputStream bis=new BufferedInputStream(in);
if(bis.available()<=0){
logger.info("Cannot load local cache in " + cacheFile.getAbsolutePath());
return null;
}else{
logger.info("Successfully load cache in " + cacheFile.getAbsolutePath());
return bis;
}
}catch(Exception e){
logger.log(Level.WARNING, e.getMessage());
return null;
}
}
private void saveToCache(InputStream is,File to){
logger.info("Try save local cache to " + to.getAbsolutePath());
FileOutputStream fs=null;
int times=0;
try{//Save to Local Skin File
if(to.exists()){
to.delete();
}
fs = new FileOutputStream(to);
int byteRead = 0;
byte[] buffer = new byte[1024];
while (( byteRead = is.read(buffer)) != -1) {
times+=byteRead;
fs.write(buffer, 0, byteRead);
if(times>=C.getContentLength()){
//logger.info(times+" "+C.getContentLength());
break;
}
}
if(to.length()>1){
to.setLastModified(C.getLastModified());
logger.info("Cache saved to " + to.getAbsolutePath()+" (LastModified: "+to.lastModified()+" , Size: "+to.length()+")");
}else{
to.delete();
logger.info("Cannot save local cache to " + to.getAbsolutePath());
}
}catch(Exception e){
logger.warning(e.getMessage());
}finally{
try {
if(fs!=null)
fs.close();
is.reset();
} catch (IOException e) {
logger.warning(e.getMessage());
}
}
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
if(!SKIN_URL_FILE.exists()){
logger.log(Level.INFO, "SKIN config not found, create a new one.");
SKIN_URL_FILE.createNewFile();
}
if(!CAPE_URL_FILE.exists()){
logger.log(Level.INFO, "CAPE config not found, create a new one.");
CAPE_URL_FILE.createNewFile();
}
skinURLs = readAllLines(SKIN_URL_FILE);
cloakURLs = readAllLines(CAPE_URL_FILE);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
if(skinURLs.length==0&&cloakURLs.length==0){
logger.info("No skinURLs and cloak URLS found, try to init and use default settings.");
initSkinURL();
refreshSkinURL();
}else{
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
}
private static void initSkinURL(){
//Init URL List
skinURLs=DEFAULT_SKIN_URLS;
writeToFile(new File(DATA_DIR,"skinurls.txt"),parseArrayToText(skinURLs));
cloakURLs=DEFAULT_CAPE_URLS;
writeToFile(new File(DATA_DIR,"capeurls.txt"),parseArrayToText(cloakURLs));
}
private static String[] readAllLines(File F) {
try {
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))//Remove note
re[i]=null;
else{//Remove same URL
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
private static String parseArrayToText(String[] data){
StringBuilder temp=new StringBuilder();
for(int i=0;i<data.length-1;i++)
temp.append(data[i]).append("\r\n");
temp.append(data[data.length-1]);
return temp.toString();
}
private static boolean writeToFile(File file,String Data){
System.out.print("Write to "+file.getAbsolutePath()+" ");
FileWriter fw=null;
try{
fw = new FileWriter(file);
fw.write(Data,0,Data.length());
fw.flush();
fw.close();
}catch(Exception ex){
ex.printStackTrace();
System.out.println("failed.");
return false;
}
System.out.println("succeed.");
return true;
}
public String MD5(String str){
byte [] buf = str.getBytes();
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(buf);
byte [] tmp = md5.digest();
StringBuilder sb = new StringBuilder();
for (byte b:tmp) {
sb.append(Integer.toHexString(b&0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
logger.warning(e.getMessage());
}
return "Fail";
}
private static MainLogger getLogger(File logFile){
MainLogger mainLogger = new MainLogger(logFile);
mainLogger.info("CustomSkinLoader " + VERSION);
return mainLogger;
}
}
@@ -1,71 +0,0 @@
package idv.jlchntoz;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
public class MainLogger {
private static final int LOWEST_DISPLAY_LEVEL=Level.INFO.intValue();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private BufferedWriter writer;
public MainLogger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(level.intValue()>=LOWEST_DISPLAY_LEVEL)
System.out.println(msg);
try {
writer.write("[");
writer.write(DATE_FORMAT.format(new Date()));
writer.write(" ");
writer.write(Thread.currentThread().getName());
writer.write(" ");
writer.write(level.getName());
writer.write("] ");
writer.write(msg);
writer.write("\r\n");
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void info(String msg){
log(Level.INFO,msg);
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(Exception e){
log(Level.WARNING,"Exception occurs while running: "+e.getMessage());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
log(Level.WARNING,"");
}
}
@@ -1,98 +0,0 @@
package net.minecraft.src;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.ImageObserver;
public class ImageBufferDownload implements IImageBuffer
{
private int[] imageData;
private int imageWidth;
private int imageHeight;
public BufferedImage parseUserSkin(BufferedImage par1BufferedImage)
{
if (par1BufferedImage == null)
{
return null;
}
else
{
this.imageWidth = par1BufferedImage.getWidth();//Default: 64
this.imageHeight = par1BufferedImage.getHeight();//Default: 32
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageWidth / 2, 2);
Graphics var3 = var2.getGraphics();
if(imageWidth == imageHeight){
var3.drawImage(par1BufferedImage, 0, 0, this.imageWidth, this.imageWidth / 2, 0, 0, this.imageWidth, this.imageWidth / 2, (ImageObserver)null);
var3.drawImage(par1BufferedImage, 0, this.imageWidth / 4, this.imageWidth, this.imageWidth / 2, 0, this.imageWidth / 2 , this.imageWidth, this.imageWidth / 4 * 3, (ImageObserver)null);
imageHeight/=2;
}else{
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
}
var3.dispose();
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
//this.setAreaOpaque(0, 0, 32, 16);
//this.setAreaTransparent(32, 0, 64, 32);
//this.setAreaOpaque(0, 16, 64, 32);
this.setAreaOpaque(0, 0, imageWidth / 2, imageHeight / 2);
this.setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight);
this.setAreaOpaque(0, imageHeight / 2, imageWidth, imageHeight);
return var2;
}
}
/**
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
* maker is just using an image editor without an alpha channel)
*/
private void setAreaTransparent(int par1, int par2, int par3, int par4)
{
if (!this.hasTransparency(par1, par2, par3, par4))
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
}
}
}
}
/**
* Makes the given area of the image opaque
*/
private void setAreaOpaque(int par1, int par2, int par3, int par4)
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
}
}
}
/**
* Returns true if the given area of the image contains transparent pixels
*/
private boolean hasTransparency(int par1, int par2, int par3, int par4)
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
int var7 = this.imageData[var5 + var6 * this.imageWidth];
if ((var7 >> 24 & 255) < 128)
{
return true;
}
}
}
return false;
}
}
@@ -1,81 +0,0 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.IOException;
public class ThreadDownloadImageData extends AbstractTexture
{
private final String imageUrl;
private final IImageBuffer imageBuffer;
private BufferedImage bufferedImage;
private Thread imageThread;
private SimpleTexture imageLocation;
private boolean textureUploaded;
public boolean enabled;//For Optifine
public ThreadDownloadImageData(String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
{
this.imageUrl = par1Str;
this.imageBuffer = par3IImageBuffer;
this.imageLocation = par2ResourceLocation != null ? new SimpleTexture(par2ResourceLocation) : null;
}
public int getGlTextureId()
{
int var1 = super.getGlTextureId();
if (!this.textureUploaded && this.bufferedImage != null)
{
TextureUtil.uploadTextureImage(var1, this.bufferedImage);
this.textureUploaded = true;
}
return var1;
}
public void getBufferedImage(BufferedImage par1BufferedImage)
{
this.bufferedImage = par1BufferedImage;
}
public void loadTexture(ResourceManager par1ResourceManager) throws IOException
{
if (this.bufferedImage == null)
{
if (this.imageLocation != null)
{
this.imageLocation.loadTexture(par1ResourceManager);
this.glTextureId = this.imageLocation.getGlTextureId();
}
}
else
{
TextureUtil.uploadTextureImage(this.getGlTextureId(), this.bufferedImage);
}
if (this.imageThread == null)
{
this.imageThread = new ThreadDownloadImageDataINNER1(this);
this.imageThread.setDaemon(true);
//this.imageThread.setName("Skin downloader: " + this.imageUrl);
this.imageThread.start();
}
}
public boolean isTextureUploaded()
{
this.getGlTextureId();
return this.textureUploaded;
}
static String getImageUrl(ThreadDownloadImageData par0ThreadDownloadImageData)
{
return par0ThreadDownloadImageData.imageUrl;
}
static IImageBuffer getImageBuffer(ThreadDownloadImageData par0ThreadDownloadImageData)
{
return par0ThreadDownloadImageData.imageBuffer;
}
}
@@ -1,63 +0,0 @@
package net.minecraft.src;
import idv.jlchntoz.CustomSkinLoader;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
class ThreadDownloadImageDataINNER1 extends Thread
{
final ThreadDownloadImageData theThreadDownloadImageData;
ThreadDownloadImageDataINNER1(ThreadDownloadImageData par1ThreadDownloadImageData)
{
this.theThreadDownloadImageData = par1ThreadDownloadImageData;
}
public void run()
{
//HttpURLConnection var1 = null;
CustomSkinLoader loader=new CustomSkinLoader();
try
{
/*
var1 = (HttpURLConnection)(new URL(ThreadDownloadImageData.getImageUrl(this.theThreadDownloadImageData))).openConnection(Minecraft.getMinecraft().getProxy());
var1.setDoInput(true);
var1.setDoOutput(false);
var1.connect();
if (var1.getResponseCode() / 100 != 2)
{
return;
}
BufferedImage var2 = ImageIO.read(var1.getInputStream());
*/
BufferedImage var2 = ImageIO.read(loader.getPlayerSkinStream(
ThreadDownloadImageData.getImageUrl(this.theThreadDownloadImageData)));
if (ThreadDownloadImageData.getImageBuffer(this.theThreadDownloadImageData) != null)
{
var2 = ThreadDownloadImageData.getImageBuffer(this.theThreadDownloadImageData).parseUserSkin(var2);
}
this.theThreadDownloadImageData.getBufferedImage(var2);
}
catch (Exception var6)
{
var6.printStackTrace();
}
finally
{
/*
if (var1 != null)
{
var1.disconnect();
}*/
loader.disconnect();
}
}
}
@@ -1,359 +0,0 @@
package idv.jlchntoz;
import net.minecraft.client.Minecraft;
import java.io.*;
import java.math.BigInteger;
import java.net.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 12th Revision 8th Subversion 2016.2.3
*
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
*/
public class CustomSkinLoader {
public final static String VERSION="12.8";
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newResPattern = Pattern.compile("^http://textures.minecraft.net/texture/(.*?)?(Skin|Cloak)=(.*?)$"),
newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$"),
optifineCapeURLPattern = Pattern.compile("^http://s.optifine.net/capes/(.*?).png$");
public final static File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
CACHE_DIR=new File(DATA_DIR,"caches"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
SKIN_URL_FILE=new File(DATA_DIR,"skinurls.txt"),
CAPE_URL_FILE=new File(DATA_DIR,"capeurls.txt");
public final static MainLogger logger = getLogger(LOG_FILE);
public final static String[] DEFAULT_SKIN_URLS={
"http://skins.minecraft.net/MinecraftSkins/*.png",
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
"http://www.skinme.cc/MinecraftSkins/*.png"};
public final static String[] DEFAULT_CAPE_URLS={
"http://skins.minecraft.net/MinecraftCloaks/*.png",
"http://s.optifine.net/capes/*.png",
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
"http://www.skinme.cc/MinecraftCloaks/*.png"};
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
//Entrance
public InputStream getPlayerSkinStream(String path) {
if(!DATA_DIR.exists())
DATA_DIR.mkdir();
if(!CACHE_DIR.exists())
CACHE_DIR.mkdir();
logger.info("Get a request: "+path);
if(path.contains("NOCSL"))//Not to use CSL to load, prepared for json api
return getStream(path, false);
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//May be old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}else{
m = newResPattern.matcher(path);
if(m.matches()){
if (m.group(2).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(3));
else if (m.group(2).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(3));
}else{
m = optifineCapeURLPattern.matcher(path);
if(m.matches()){//Optifine Cape
logger.info("Ignore Optifine Cape.");
return null;//Not Load This
}
}
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load again.
InputStream S=null;
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
S = getStream(loc, true);
if (S == null){
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin") + " found in " + loc);
}else{
logger.info("Succeessfully load " + (isCloak ? "cloak" : "skin") + " in " + loc);
return S;
}
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
boolean success=false;
File cacheFile=new File(CACHE_DIR,MD5(URL));
boolean alreadyCached=false;
if(cacheFile.exists()&&cacheFile.length()>1){
alreadyCached=true;
logger.info("Cache File Found");
}
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setReadTimeout(15000);
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
logger.info("Response Code: "+C.getResponseCode());
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful to get skin.
if(alreadyCached && C.getLastModified()==cacheFile.lastModified()){
logger.info("Not Modified!");
return getStreamFromCache(cacheFile);
}
if(C.getContentLength()<=0){//Nothing to get
return null;
}
InputStream IS=new BufferedInputStream(C.getInputStream());
if (!CheckPNG){ // If no need to check PNG header, just skip it.
success=true;
saveToCache(IS,cacheFile);
return IS;
}
//logger.info(C.getContentLength()+" "+IS.available());
IS.mark(C.getContentLength()+10);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N' && ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
success=true;
saveToCache(IS,cacheFile);
return IS;
}
}
} catch (Exception ex) {
success=false;
logger.log(Level.WARNING, ex.getMessage());
if(alreadyCached)
return getStreamFromCache(cacheFile);
}finally{
if(!success)
disconnect();
}
return null;
}
private InputStream getStreamFromCache(File cacheFile) {
try{
logger.info("Try load local cache in " + cacheFile.getAbsolutePath());
InputStream in = new FileInputStream(cacheFile);
BufferedInputStream bis=new BufferedInputStream(in);
if(bis.available()<=0){
logger.info("Cannot load local cache in " + cacheFile.getAbsolutePath());
return null;
}else{
logger.info("Successfully load cache in " + cacheFile.getAbsolutePath());
return bis;
}
}catch(Exception e){
logger.log(Level.WARNING, e.getMessage());
return null;
}
}
private void saveToCache(InputStream is,File to){
logger.info("Try save local cache to " + to.getAbsolutePath());
FileOutputStream fs=null;
int times=0;
try{//Save to Local Skin File
if(to.exists()){
to.delete();
}
fs = new FileOutputStream(to);
int byteRead = 0;
byte[] buffer = new byte[1024];
while (( byteRead = is.read(buffer)) != -1) {
times+=byteRead;
fs.write(buffer, 0, byteRead);
if(times>=C.getContentLength()){
//logger.info(times+" "+C.getContentLength());
break;
}
}
if(to.length()>1){
logger.info("Successfully save cache to " + to.getAbsolutePath());
}else{
to.delete();
logger.info("Cannot save local cache to " + to.getAbsolutePath());
}
}catch(Exception e){
logger.warning(e.getMessage());
}finally{
try {
if(fs!=null)
fs.close();
is.reset();
logger.info("Cache size : "+is.available());
} catch (IOException e) {
logger.warning(e.getMessage());
}
if(to.exists()){
to.setLastModified(C.getLastModified());
}
}
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
if(!SKIN_URL_FILE.exists()){
logger.log(Level.INFO, "SKIN config not found, create a new one.");
SKIN_URL_FILE.createNewFile();
}
if(!CAPE_URL_FILE.exists()){
logger.log(Level.INFO, "CAPE config not found, create a new one.");
CAPE_URL_FILE.createNewFile();
}
skinURLs = readAllLines(SKIN_URL_FILE);
cloakURLs = readAllLines(CAPE_URL_FILE);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
if(skinURLs.length==0&&cloakURLs.length==0){
logger.info("No skinURLs and cloak URLS found, try to init and use default settings.");
initSkinURL();
refreshSkinURL();
}else{
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
}
private static void initSkinURL(){
//TODO Init URL List
skinURLs=DEFAULT_SKIN_URLS;
writeToFile(new File(DATA_DIR,"skinurls.txt"),parseArrayToText(skinURLs));
cloakURLs=DEFAULT_CAPE_URLS;
writeToFile(new File(DATA_DIR,"capeurls.txt"),parseArrayToText(cloakURLs));
}
private static String[] readAllLines(File F) {
try {
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))//Remove note
re[i]=null;
else{//Remove same URL
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
private static String parseArrayToText(String[] data){
StringBuilder temp=new StringBuilder();
for(int i=0;i<data.length-1;i++)
temp.append(data[i]).append("\r\n");
temp.append(data[data.length-1]);
return temp.toString();
}
private static boolean writeToFile(File file,String Data){
System.out.print("Write to "+file.getAbsolutePath()+" ");
FileWriter fw=null;
try{
fw = new FileWriter(file);
fw.write(Data,0,Data.length());
fw.flush();
fw.close();
}catch(Exception ex){
ex.printStackTrace();
System.out.println("failed.");
return false;
}
System.out.println("succeed.");
return true;
}
public String MD5(String str){
byte [] buf = str.getBytes();
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(buf);
byte [] tmp = md5.digest();
StringBuilder sb = new StringBuilder();
for (byte b:tmp) {
sb.append(Integer.toHexString(b&0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
logger.warning(e.getMessage());
}
return "Fail";
}
private static MainLogger getLogger(File logFile){
MainLogger mainLogger = new MainLogger(logFile);
mainLogger.info("CustomSkinLoader " + VERSION);
return mainLogger;
}
}
@@ -1,71 +0,0 @@
package idv.jlchntoz;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
public class MainLogger {
private static final int LOWEST_DISPLAY_LEVEL=Level.INFO.intValue();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private BufferedWriter writer;
public MainLogger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(level.intValue()>=LOWEST_DISPLAY_LEVEL)
System.out.println(msg);
try {
writer.write("[");
writer.write(DATE_FORMAT.format(new Date()));
writer.write(" ");
writer.write(Thread.currentThread().getName());
writer.write(" ");
writer.write(level.getName());
writer.write("] ");
writer.write(msg);
writer.write("\r\n");
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void info(String msg){
log(Level.INFO,msg);
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(Exception e){
log(Level.WARNING,"Exception occurs while running: "+e.getMessage());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
log(Level.WARNING,"");
}
}
@@ -1,101 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.ImageObserver;
public class ImageBufferDownload implements IImageBuffer
{
private int[] imageData;
private int imageWidth;
private int imageHeight;
private static final String __OBFID = "CL_00000956";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (p_78432_1_ == null)
{
return null;
}
else
{
this.imageWidth = p_78432_1_.getWidth();//Default: 64
this.imageHeight = p_78432_1_.getHeight();//Default: 32
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageWidth / 2, 2);
Graphics var3 = var2.getGraphics();
if(imageWidth == imageHeight){
var3.drawImage(p_78432_1_, 0, 0, this.imageWidth, this.imageWidth / 2, 0, 0, this.imageWidth, this.imageWidth / 2, (ImageObserver)null);
var3.drawImage(p_78432_1_, 0, this.imageWidth / 4, this.imageWidth, this.imageWidth / 2, 0, this.imageWidth / 2 , this.imageWidth, this.imageWidth / 4 * 3, (ImageObserver)null);
imageHeight/=2;
}else{
var3.drawImage(p_78432_1_, 0, 0, (ImageObserver)null);
}
var3.dispose();
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
//this.setAreaOpaque(0, 0, 32, 16);
//this.setAreaTransparent(32, 0, 64, 32);
//this.setAreaOpaque(0, 16, 64, 32);
this.setAreaOpaque(0, 0, imageWidth / 2, imageHeight / 2);
this.setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight);
this.setAreaOpaque(0, imageHeight / 2, imageWidth, imageHeight);
return var2;
}
}
public void func_152634_a() {}
/**
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
* maker is just using an image editor without an alpha channel)
*/
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
{
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
{
for (int var5 = p_78434_1_; var5 < p_78434_3_; ++var5)
{
for (int var6 = p_78434_2_; var6 < p_78434_4_; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
}
}
}
}
/**
* Makes the given area of the image opaque
*/
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
{
for (int var5 = p_78433_1_; var5 < p_78433_3_; ++var5)
{
for (int var6 = p_78433_2_; var6 < p_78433_4_; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
}
}
}
/**
* Returns true if the given area of the image contains transparent pixels
*/
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
{
for (int var5 = p_78435_1_; var5 < p_78435_3_; ++var5)
{
for (int var6 = p_78435_2_; var6 < p_78435_4_; ++var6)
{
int var7 = this.imageData[var5 + var6 * this.imageWidth];
if ((var7 >> 24 & 255) < 128)
{
return true;
}
}
}
return false;
}
}
@@ -1,158 +0,0 @@
package net.minecraft.client.renderer;
import idv.jlchntoz.CustomSkinLoader;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ThreadDownloadImageData extends SimpleTexture
{
private static final Logger logger = LogManager.getLogger();
private static final AtomicInteger field_147643_d = new AtomicInteger(0);
private final File field_152434_e;
private final String imageUrl;
private final IImageBuffer imageBuffer;
private BufferedImage bufferedImage;
private Thread imageThread;
private boolean textureUploaded;
private static final String __OBFID = "CL_00001049";
//For Optifine
public Boolean imageFound = null;
public boolean pipeline = false;
public ThreadDownloadImageData(File p_i1049_1_, String p_i1049_2_, ResourceLocation p_i1049_3_, IImageBuffer p_i1049_4_)
{
super(p_i1049_3_);
this.field_152434_e = p_i1049_1_;
this.imageUrl = p_i1049_2_;
this.imageBuffer = p_i1049_4_;
}
private void func_147640_e()
{
if (!this.textureUploaded)
{
if (this.bufferedImage != null)
{
if (this.textureLocation != null)
{
this.func_147631_c();
}
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
this.textureUploaded = true;
}
}
}
public int getGlTextureId()
{
this.func_147640_e();
return super.getGlTextureId();
}
public void func_147641_a(BufferedImage p_147641_1_)
{
this.bufferedImage = p_147641_1_;
if (this.imageBuffer != null)
{
this.imageBuffer.func_152634_a();
}
}
public void loadTexture(IResourceManager p_110551_1_) throws IOException
{
if (this.bufferedImage == null && this.textureLocation != null)
{
super.loadTexture(p_110551_1_);
}
if (this.imageThread == null)
{
if (this.field_152434_e != null && this.field_152434_e.isFile())
{
logger.debug("Loading http texture from local cache ({})", new Object[] {this.field_152434_e});
try
{
this.bufferedImage = ImageIO.read(this.field_152434_e);
if (this.imageBuffer != null)
{
this.func_147641_a(this.imageBuffer.parseUserSkin(this.bufferedImage));
}
}
catch (IOException var3)
{
logger.error("Couldn\'t load skin " + this.field_152434_e, var3);
this.func_152433_a();
}
}
else
{
this.func_152433_a();
}
}
}
protected void func_152433_a()
{
this.imageThread = new Thread("Texture Downloader #" + field_147643_d.incrementAndGet())
{
private static final String __OBFID = "CL_00001050";
public void run()
{
ThreadDownloadImageData.logger.debug("Downloading http texture from {} to {}", new Object[] {ThreadDownloadImageData.this.imageUrl, ThreadDownloadImageData.this.field_152434_e});
try
{
CustomSkinLoader loader=new CustomSkinLoader();
InputStream var9=loader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl);
BufferedImage var2;
/*
if (ThreadDownloadImageData.this.field_152434_e != null)
{
FileUtils.copyInputStreamToFile(var9, ThreadDownloadImageData.this.field_152434_e);
var2 = ImageIO.read(ThreadDownloadImageData.this.field_152434_e);
}
else
{
}*/
var2 = ImageIO.read(var9);
if (ThreadDownloadImageData.this.imageBuffer != null)
{
var2 = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
}
ThreadDownloadImageData.this.func_147641_a(var2);
loader.disconnect();
}
catch (Exception var6)
{
ThreadDownloadImageData.logger.error("Couldn\'t download http texture", var6);
}
}
};
this.imageThread.setDaemon(true);
this.imageThread.start();
}
}
@@ -1,178 +0,0 @@
package net.minecraft.client.resources;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ImageBufferDownload;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public class SkinManager
{
public static final ResourceLocation field_152793_a = new ResourceLocation("textures/entity/steve.png");
private static final ExecutorService field_152794_b = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue());
private final TextureManager field_152795_c;
private final File field_152796_d;
private final MinecraftSessionService field_152797_e;
private final LoadingCache field_152798_f;
private static final String __OBFID = "CL_00001830";
public SkinManager(TextureManager p_i1044_1_, File p_i1044_2_, MinecraftSessionService p_i1044_3_)
{
this.field_152795_c = p_i1044_1_;
this.field_152796_d = p_i1044_2_;
this.field_152797_e = p_i1044_3_;
this.field_152798_f = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).build(new CacheLoader()
{
private static final String __OBFID = "CL_00001829";
public Map func_152786_a(GameProfile p_152786_1_)
{
return Minecraft.getMinecraft().func_152347_ac().getTextures(p_152786_1_, false);
}
public Object load(Object p_load_1_)
{
return this.func_152786_a((GameProfile)p_load_1_);
}
});
}
public ResourceLocation func_152792_a(MinecraftProfileTexture p_152792_1_, Type p_152792_2_)
{
return this.func_152789_a(p_152792_1_, p_152792_2_, (SkinManager.SkinAvailableCallback)null);
}
public ResourceLocation func_152789_a(MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
{
final ResourceLocation var4 = new ResourceLocation(p_152789_2_.name()+"/" + p_152789_1_.getHash());
//ITextureObject var5 = this.field_152795_c.getTexture(var4);
/*
if (var5 != null)
{
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, var4);
}
}
else
{*/
File var6 = new File(this.field_152796_d, p_152789_1_.getHash().substring(0, 2));
File var7 = new File(var6, p_152789_1_.getHash());
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData var9 = new ThreadDownloadImageData(var7, p_152789_1_.getUrl(), field_152793_a, new IImageBuffer()
{
private static final String __OBFID = "CL_00001828";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (var8 != null)
{
p_78432_1_ = var8.parseUserSkin(p_78432_1_);
}
return p_78432_1_;
}
public void func_152634_a()
{
if (var8 != null)
{
var8.func_152634_a();
}
if (p_152789_3_ != null)
{
p_152789_3_.func_152121_a(p_152789_2_, var4);
}
}
});
this.field_152795_c.loadTexture(var4, var9);
//}
return var4;
}
public void func_152790_a(final GameProfile p_152790_1_, final SkinManager.SkinAvailableCallback p_152790_2_, final boolean p_152790_3_)
{
field_152794_b.submit(new Runnable()
{
private static final String __OBFID = "CL_00001827";
public void run()
{
final HashMap var1 = Maps.newHashMap();
try
{
var1.putAll(SkinManager.this.field_152797_e.getTextures(p_152790_1_, p_152790_3_));
}
catch (InsecureTextureException var3)
{
;
}
if (var1.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().func_148256_e().getId()))
{
var1.putAll(SkinManager.this.field_152797_e.getTextures(SkinManager.this.field_152797_e.fillProfileProperties(p_152790_1_, false), false));
}
//CustomSkinLoader Begin
HashMap var2 = Maps.newHashMap();
if (var1.containsKey(Type.SKIN)){
var2.put(Type.SKIN, new MinecraftProfileTexture(((MinecraftProfileTexture)var1.get(Type.SKIN)).getUrl()+"?Skin="+p_152790_1_.getName()));
}else{
var2.put(Type.SKIN,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftSkins/"+p_152790_1_.getName()+".png"));
}
if (var1.containsKey(Type.CAPE)){
var2.put(Type.CAPE, new MinecraftProfileTexture(((MinecraftProfileTexture)var1.get(Type.CAPE)).getUrl()+"?Cloak="+p_152790_1_.getName()));
}else{
var2.put(Type.CAPE,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftCloaks/"+p_152790_1_.getName()+".png"));
}
var1.clear();
var1.putAll(var2);
//CustomSkinLoader End
Minecraft.getMinecraft().func_152344_a(new Runnable()
{
private static final String __OBFID = "CL_00001826";
public void run()
{
if (var1.containsKey(Type.SKIN))
{
SkinManager.this.func_152789_a((MinecraftProfileTexture)var1.get(Type.SKIN), Type.SKIN, p_152790_2_);
}
if (var1.containsKey(Type.CAPE))
{
SkinManager.this.func_152789_a((MinecraftProfileTexture)var1.get(Type.CAPE), Type.CAPE, p_152790_2_);
}
}
});
}
});
}
public Map func_152788_a(GameProfile p_152788_1_)
{
return (Map)this.field_152798_f.getUnchecked(p_152788_1_);
}
public interface SkinAvailableCallback
{
void func_152121_a(Type p_152121_1_, ResourceLocation p_152121_2_);
}
}
@@ -1,357 +0,0 @@
package idv.jlchntoz;
import net.minecraft.client.Minecraft;
import java.io.*;
import java.math.BigInteger;
import java.net.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 12th Revision 9th Subversion 2016.2.10
*
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
*/
public class CustomSkinLoader {
public final static String VERSION="12.9";
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newResPattern = Pattern.compile("^http://textures.minecraft.net/texture/(.*?)?(Skin|Cloak)=(.*?)$"),
newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$"),
optifineCapeURLPattern = Pattern.compile("^http://s.optifine.net/capes/(.*?).png$");
public final static File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
CACHE_DIR=new File(DATA_DIR,"caches"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
SKIN_URL_FILE=new File(DATA_DIR,"skinurls.txt"),
CAPE_URL_FILE=new File(DATA_DIR,"capeurls.txt");
public final static MainLogger logger = getLogger(LOG_FILE);
public final static String[] DEFAULT_SKIN_URLS={
"http://skins.minecraft.net/MinecraftSkins/*.png",
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
"http://www.skinme.cc/MinecraftSkins/*.png"};
public final static String[] DEFAULT_CAPE_URLS={
"http://skins.minecraft.net/MinecraftCloaks/*.png",
"http://s.optifine.net/capes/*.png",
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
"http://www.skinme.cc/MinecraftCloaks/*.png"};
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
//Entrance
public InputStream getPlayerSkinStream(String path) {
if(!DATA_DIR.exists())
DATA_DIR.mkdir();
if(!CACHE_DIR.exists())
CACHE_DIR.mkdir();
logger.info("Get a request: "+path);
if(path.contains("NOCSL"))//Not to use CSL to load, prepared for json api
return getStream(path, false);
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//May be old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}else{
m = newResPattern.matcher(path);
if(m.matches()){
if (m.group(2).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(3));
else if (m.group(2).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(3));
}else{
m = optifineCapeURLPattern.matcher(path);
if(m.matches()){//Optifine Cape
logger.info("Ignore Optifine Cape.");
return null;//Not Load This
}
}
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if ((skinURLs == null|| skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))
refreshSkinURL(); // If the list is blank or null, try to load again.
InputStream S=null;
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
S = getStream(loc, true);
if (S == null){
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin") + " found in " + loc);
}else{
logger.info("Succeessfully load " + (isCloak ? "cloak" : "skin") + " in " + loc);
return S;
}
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
boolean success=false;
File cacheFile=new File(CACHE_DIR,MD5(URL));
boolean alreadyCached=false;
if(cacheFile.exists()&&cacheFile.length()>1){
alreadyCached=true;
logger.info("Cache File Found (LastModified: "+cacheFile.lastModified()+" , Size: "+cacheFile.length()+")");
}
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setReadTimeout(15000);
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
logger.info("Response Code: "+C.getResponseCode());
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful to get skin.
if(C.getContentLength()<=0){//Nothing got
logger.info("Nothing got.");
return null;
}
logger.info("Successfully Get Resource (LastModified: "+C.getLastModified()+" , ContentLength: "+C.getContentLength()+")");
if(alreadyCached && C.getLastModified()==cacheFile.lastModified() && C.getContentLength()==cacheFile.length()){
logger.info("Not Modified.");
return getStreamFromCache(cacheFile);
}
InputStream IS=new BufferedInputStream(C.getInputStream());
if (!CheckPNG){ // If no need to check PNG header, just skip it.
success=true;
saveToCache(IS,cacheFile);
return IS;
}
//logger.info(C.getContentLength()+" "+IS.available());
IS.mark(C.getContentLength()+10);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N' && ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
success=true;
saveToCache(IS,cacheFile);
return IS;
}
}
} catch (Exception ex) {
success=false;
logger.log(Level.WARNING, ex.getMessage());
if(alreadyCached)
return getStreamFromCache(cacheFile);
}finally{
if(!success)
disconnect();
}
return null;
}
private InputStream getStreamFromCache(File cacheFile) {
try{
logger.info("Try load local cache in " + cacheFile.getAbsolutePath());
InputStream in = new FileInputStream(cacheFile);
BufferedInputStream bis=new BufferedInputStream(in);
if(bis.available()<=0){
logger.info("Cannot load local cache in " + cacheFile.getAbsolutePath());
return null;
}else{
logger.info("Successfully load cache in " + cacheFile.getAbsolutePath());
return bis;
}
}catch(Exception e){
logger.log(Level.WARNING, e.getMessage());
return null;
}
}
private void saveToCache(InputStream is,File to){
logger.info("Try save local cache to " + to.getAbsolutePath());
FileOutputStream fs=null;
int times=0;
try{//Save to Local Skin File
if(to.exists()){
to.delete();
}
fs = new FileOutputStream(to);
int byteRead = 0;
byte[] buffer = new byte[1024];
while (( byteRead = is.read(buffer)) != -1) {
times+=byteRead;
fs.write(buffer, 0, byteRead);
if(times>=C.getContentLength()){
//logger.info(times+" "+C.getContentLength());
break;
}
}
if(to.length()>1){
to.setLastModified(C.getLastModified());
logger.info("Cache saved to " + to.getAbsolutePath()+" (LastModified: "+to.lastModified()+" , Size: "+to.length()+")");
}else{
to.delete();
logger.info("Cannot save local cache to " + to.getAbsolutePath());
}
}catch(Exception e){
logger.warning(e.getMessage());
}finally{
try {
if(fs!=null)
fs.close();
is.reset();
} catch (IOException e) {
logger.warning(e.getMessage());
}
}
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
if(!SKIN_URL_FILE.exists()){
logger.log(Level.INFO, "SKIN config not found, create a new one.");
SKIN_URL_FILE.createNewFile();
}
if(!CAPE_URL_FILE.exists()){
logger.log(Level.INFO, "CAPE config not found, create a new one.");
CAPE_URL_FILE.createNewFile();
}
skinURLs = readAllLines(SKIN_URL_FILE);
cloakURLs = readAllLines(CAPE_URL_FILE);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
if(skinURLs.length==0&&cloakURLs.length==0){
logger.info("No skinURLs and cloak URLS found, try to init and use default settings.");
initSkinURL();
refreshSkinURL();
}else{
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
}
private static void initSkinURL(){
//Init URL List
skinURLs=DEFAULT_SKIN_URLS;
writeToFile(new File(DATA_DIR,"skinurls.txt"),parseArrayToText(skinURLs));
cloakURLs=DEFAULT_CAPE_URLS;
writeToFile(new File(DATA_DIR,"capeurls.txt"),parseArrayToText(cloakURLs));
}
private static String[] readAllLines(File F) {
try {
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))//Remove note
re[i]=null;
else{//Remove same URL
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
private static String parseArrayToText(String[] data){
StringBuilder temp=new StringBuilder();
for(int i=0;i<data.length-1;i++)
temp.append(data[i]).append("\r\n");
temp.append(data[data.length-1]);
return temp.toString();
}
private static boolean writeToFile(File file,String Data){
System.out.print("Write to "+file.getAbsolutePath()+" ");
FileWriter fw=null;
try{
fw = new FileWriter(file);
fw.write(Data,0,Data.length());
fw.flush();
fw.close();
}catch(Exception ex){
ex.printStackTrace();
System.out.println("failed.");
return false;
}
System.out.println("succeed.");
return true;
}
public String MD5(String str){
byte [] buf = str.getBytes();
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(buf);
byte [] tmp = md5.digest();
StringBuilder sb = new StringBuilder();
for (byte b:tmp) {
sb.append(Integer.toHexString(b&0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
logger.warning(e.getMessage());
}
return "Fail";
}
private static MainLogger getLogger(File logFile){
MainLogger mainLogger = new MainLogger(logFile);
mainLogger.info("CustomSkinLoader " + VERSION);
return mainLogger;
}
}
@@ -1,71 +0,0 @@
package idv.jlchntoz;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
public class MainLogger {
private static final int LOWEST_DISPLAY_LEVEL=Level.INFO.intValue();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private BufferedWriter writer;
public MainLogger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(level.intValue()>=LOWEST_DISPLAY_LEVEL)
System.out.println(msg);
try {
writer.write("[");
writer.write(DATE_FORMAT.format(new Date()));
writer.write(" ");
writer.write(Thread.currentThread().getName());
writer.write(" ");
writer.write(level.getName());
writer.write("] ");
writer.write(msg);
writer.write("\r\n");
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void info(String msg){
log(Level.INFO,msg);
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(Exception e){
log(Level.WARNING,"Exception occurs while running: "+e.getMessage());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
log(Level.WARNING,"");
}
}
@@ -1,99 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.ImageObserver;
public class ImageBufferDownload implements IImageBuffer
{
private int[] imageData;
private int imageWidth;
private int imageHeight;
private static final String __OBFID = "CL_00000956";
public BufferedImage parseUserSkin(BufferedImage par1BufferedImage)
{
if (par1BufferedImage == null)
{
return null;
}
else
{
this.imageWidth = par1BufferedImage.getWidth();//Default: 64
this.imageHeight = par1BufferedImage.getHeight();//Default: 32
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageWidth / 2, 2);
Graphics var3 = var2.getGraphics();
if(imageWidth == imageHeight){
var3.drawImage(par1BufferedImage, 0, 0, this.imageWidth, this.imageWidth / 2, 0, 0, this.imageWidth, this.imageWidth / 2, (ImageObserver)null);
var3.drawImage(par1BufferedImage, 0, this.imageWidth / 4, this.imageWidth, this.imageWidth / 2, 0, this.imageWidth / 2 , this.imageWidth, this.imageWidth / 4 * 3, (ImageObserver)null);
imageHeight/=2;
}else{
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
}
var3.dispose();
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
//this.setAreaOpaque(0, 0, 32, 16);
//this.setAreaTransparent(32, 0, 64, 32);
//this.setAreaOpaque(0, 16, 64, 32);
this.setAreaOpaque(0, 0, imageWidth / 2, imageHeight / 2);
this.setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight);
this.setAreaOpaque(0, imageHeight / 2, imageWidth, imageHeight);
return var2;
}
}
/**
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
* maker is just using an image editor without an alpha channel)
*/
private void setAreaTransparent(int par1, int par2, int par3, int par4)
{
if (!this.hasTransparency(par1, par2, par3, par4))
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
}
}
}
}
/**
* Makes the given area of the image opaque
*/
private void setAreaOpaque(int par1, int par2, int par3, int par4)
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
}
}
}
/**
* Returns true if the given area of the image contains transparent pixels
*/
private boolean hasTransparency(int par1, int par2, int par3, int par4)
{
for (int var5 = par1; var5 < par3; ++var5)
{
for (int var6 = par2; var6 < par4; ++var6)
{
int var7 = this.imageData[var5 + var6 * this.imageWidth];
if ((var7 >> 24 & 255) < 128)
{
return true;
}
}
}
return false;
}
}
@@ -1,110 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import idv.jlchntoz.CustomSkinLoader;
public class ThreadDownloadImageData extends SimpleTexture
{
private static final Logger logger = LogManager.getLogger();
private static final AtomicInteger field_147643_d = new AtomicInteger(0);
private final String imageUrl;
private final IImageBuffer imageBuffer;
private BufferedImage bufferedImage;
private Thread imageThread;
private boolean textureUploaded;
private static final String __OBFID = "CL_00001049";
public CustomSkinLoader customSkinLoader=new CustomSkinLoader();
public boolean enabled;//For Optifine
public ThreadDownloadImageData(String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
{
super(par2ResourceLocation);
this.imageUrl = par1Str;
this.imageBuffer = par3IImageBuffer;
}
private void func_147640_e()
{
if (!this.textureUploaded)
{
if (this.bufferedImage != null)
{
if (this.textureLocation != null)
{
this.func_147631_c();
}
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
this.textureUploaded = true;
}
}
}
public int getGlTextureId()
{
this.func_147640_e();
return super.getGlTextureId();
}
public void func_147641_a(BufferedImage p_147641_1_)
{
this.bufferedImage = p_147641_1_;
}
public void loadTexture(IResourceManager par1ResourceManager) throws IOException
{
if (this.bufferedImage == null && this.textureLocation != null)
{
super.loadTexture(par1ResourceManager);
}
if (this.imageThread == null)
{
this.imageThread = new Thread("Texture Downloader #" + field_147643_d.incrementAndGet())
{
private static final String __OBFID = "CL_00001050";
public void run()
{
try
{
BufferedImage var2 = ImageIO.read(
ThreadDownloadImageData.this.customSkinLoader.getPlayerSkinStream(
ThreadDownloadImageData.this.imageUrl));
if (ThreadDownloadImageData.this.imageBuffer != null){
var2 = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
}
ThreadDownloadImageData.this.func_147641_a(var2);
customSkinLoader.disconnect();
}catch (Exception var6){
ThreadDownloadImageData.logger.error("Couldn\'t download http texture", var6);
return;
}
}
};
this.imageThread.setDaemon(true);
//this.imageThread.setName("Skin downloader: " + this.imageUrl);
this.imageThread.start();
}
}
public boolean isTextureUploaded()
{
this.func_147640_e();
return this.textureUploaded;
}
}
-382
View File
@@ -1,382 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import org.lwjgl.opengl.GL11;
public class bpi extends bpa
{
private static final brq a = new brq("textures/entity/steve.png");
private bih f;
private bih g;
private bih h;
public bpi()
{
super(new bih(0.0F), 0.5F);
f = (bih)i;
g = new bih(1.0F);
h = new bih(0.5F);
}
protected int a(bma bma1, int i, float f1)
{
abu abu1 = bma1.bm.d(3 - i);
if (abu1 != null)
{
abs abs1 = abu1.b();
if (abs1 instanceof zs)
{
zs zs1 = (zs)abs1;
a(bop.a(zs1, i));
bih bih1 = i != 2 ? g : h;
bih1.c.j = i == 0;
bih1.d.j = i == 0;
bih1.e.j = i == 1 || i == 2;
bih1.f.j = i == 1;
bih1.g.j = i == 1;
bih1.h.j = i == 2 || i == 3;
bih1.i.j = i == 2 || i == 3;
a(((bim) (bih1)));
bih1.p = this.i.p;
bih1.q = this.i.q;
bih1.s = this.i.s;
if (zs1.m_() == zu.a)
{
int j = zs1.b(abu1);
float f2 = (float)(j >> 16 & 0xff) / 255F;
float f3 = (float)(j >> 8 & 0xff) / 255F;
float f4 = (float)(j & 0xff) / 255F;
GL11.glColor3f(f2, f3, f4);
return !abu1.y() ? 16 : 31;
}
GL11.glColor3f(1.0F, 1.0F, 1.0F);
return !abu1.y() ? 1 : 15;
}
}
return -1;
}
protected void b(bma bma1, int i, float f1)
{
abu abu1 = bma1.bm.d(3 - i);
if (abu1 != null)
{
abs abs1 = abu1.b();
if (abs1 instanceof zs)
{
a(bop.a((zs)abs1, i, "overlay"));
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
}
}
public void a(bma bma1, double d, double d1, double d2,
float f1, float f2)
{
GL11.glColor3f(1.0F, 1.0F, 1.0F);
abu abu1 = bma1.bm.h();
g.m = h.m = f.m = abu1 == null ? 0 : 1;
if (abu1 != null && bma1.bw() > 0)
{
acz acz1 = abu1.o();
if (acz1 == acz.d)
g.m = h.m = f.m = 3;
else
if (acz1 == acz.e)
g.o = h.o = f.o = true;
}
g.n = h.n = f.n = bma1.am();
double d3 = d1 - (double)bma1.L;
if (bma1.am() && !(bma1 instanceof bmd))
d3 -= 0.125D;
super.a(bma1, d, d3, d2, f1, f2);
g.o = h.o = f.o = false;
g.n = h.n = f.n = false;
g.m = h.m = f.m = 0;
}
protected brq a(bma bma1)
{
return bma1.t();
}
protected void a(bma bma1, float f1)
{
GL11.glColor3f(1.0F, 1.0F, 1.0F);
super.c(bma1, f1);
super.e(bma1, f1);
abu abu1 = bma1.bm.d(3);
if (abu1 != null)
{
GL11.glPushMatrix();
f.c.c(0.0625F);
if (abu1.b() instanceof zy)
{
if (bmf.a(ahz.a(abu1.b()).b()))
{
float f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, -f2);
}
b.f.a(bma1, abu1, 0);
} else
if (abu1.b() == abv.bL)
{
float f3 = 1.0625F;
GL11.glScalef(f3, -f3, -f3);
String s = "";
if (abu1.p() && abu1.q().b("SkullOwner", 8))
s = abu1.q().j("SkullOwner");
bnl.b.a(-0.5F, 0.0F, -0.5F, 1, 180F, abu1.k(), s);
}
GL11.glPopMatrix();
}
if (bma1.b_().equals("deadmau5") && bma1.r().a())
{
a(bma1.t());
for (int i = 0; i < 2; i++)
{
float f4 = (bma1.A + (bma1.y - bma1.A) * f1) - (bma1.aN + (bma1.aM - bma1.aN) * f1);
float f5 = bma1.B + (bma1.z - bma1.B) * f1;
GL11.glPushMatrix();
GL11.glRotatef(f4, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f5, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.375F * (float)(i * 2 - 1), 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.375F, 0.0F);
GL11.glRotatef(-f5, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-f4, 0.0F, 1.0F, 0.0F);
float f6 = 1.333333F;
GL11.glScalef(f6, f6, f6);
f.b(0.0625F);
GL11.glPopMatrix();
}
}
boolean flag = bma1.s().a();
if (flag && !bma1.ao() && !bma1.bS())
{
a(bma1.u());
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 0.0F, 0.125F);
double d = (bma1.bu + (bma1.bx - bma1.bu) * (double)f1) - (bma1.p + (bma1.s - bma1.p) * (double)f1);
double d1 = (bma1.bv + (bma1.by - bma1.bv) * (double)f1) - (bma1.q + (bma1.t - bma1.q) * (double)f1);
double d2 = (bma1.bw + (bma1.bz - bma1.bw) * (double)f1) - (bma1.r + (bma1.u - bma1.r) * (double)f1);
float f16 = bma1.aN + (bma1.aM - bma1.aN) * f1;
double d3 = oy.a((f16 * 3.141593F) / 180F);
double d4 = -oy.b((f16 * 3.141593F) / 180F);
float f18 = (float)d1 * 10F;
if (f18 < -6F)
f18 = -6F;
if (f18 > 32F)
f18 = 32F;
float f19 = (float)(d * d3 + d2 * d4) * 100F;
float f20 = (float)(d * d4 - d2 * d3) * 100F;
if (f19 < 0.0F)
f19 = 0.0F;
float f21 = bma1.br + (bma1.bs - bma1.br) * f1;
f18 += oy.a((bma1.O + (bma1.P - bma1.O) * f1) * 6F) * 32F * f21;
if (bma1.am())
f18 += 25F;
GL11.glRotatef(6F + f19 / 2.0F + f18, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f20 / 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f20 / 2.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
f.c(0.0625F);
GL11.glPopMatrix();
}
abu abu2 = bma1.bm.h();
if (abu2 != null)
{
GL11.glPushMatrix();
f.f.c(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
if (bma1.bK != null)
abu2 = new abu(abv.y);
acz acz1 = null;
if (bma1.bw() > 0)
acz1 = abu2.o();
if ((abu2.b() instanceof zy) && bmf.a(ahz.a(abu2.b()).b()))
{
float f7 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f7 *= 0.75F;
GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f7, -f7, f7);
} else
if (abu2.b() == abv.f)
{
float f8 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f8, -f8, f8);
GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
} else
if (abu2.b().f())
{
float f9 = 0.625F;
if (abu2.b().g())
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
if (bma1.bw() > 0 && acz1 == acz.d)
{
GL11.glTranslatef(0.05F, 0.0F, -0.1F);
GL11.glRotatef(-50F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-10F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-60F, 0.0F, 0.0F, 1.0F);
}
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
GL11.glScalef(f9, -f9, f9);
GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
} else
{
float f10 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f10, f10, f10);
GL11.glRotatef(60F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F);
}
if (abu2.b().b())
{
for (int j = 0; j <= 1; j++)
{
int l = abu2.b().a(abu2, j);
float f12 = (float)(l >> 16 & 0xff) / 255F;
float f14 = (float)(l >> 8 & 0xff) / 255F;
float f17 = (float)(l & 0xff) / 255F;
GL11.glColor4f(f12, f14, f17, 1.0F);
b.f.a(bma1, abu2, j);
}
} else
{
int k = abu2.b().a(abu2, 0);
float f11 = (float)(k >> 16 & 0xff) / 255F;
float f13 = (float)(k >> 8 & 0xff) / 255F;
float f15 = (float)(k & 0xff) / 255F;
GL11.glColor4f(f11, f13, f15, 1.0F);
b.f.a(bma1, abu2, 0);
}
GL11.glPopMatrix();
}
}
protected void b(bma bma1, float f1)
{
float f2 = 0.9375F;
GL11.glScalef(f2, f2, f2);
}
protected void a(bma bma1, double d, double d1, double d2,
String s, float f1, double d3)
{
if (d3 < 100D)
{
ayw ayw1 = bma1.bT();
ayr ayr1 = ayw1.a(2);
if (ayr1 != null)
{
ayt ayt1 = ayw1.a(bma1.b_(), ayr1);
if (bma1.bl())
a(((qr) (bma1)), (new StringBuilder()).append(ayt1.c()).append(" ").append(ayr1.d()).toString(), d, d1 - 1.5D, d2, 64);
else
a(((qr) (bma1)), (new StringBuilder()).append(ayt1.c()).append(" ").append(ayr1.d()).toString(), d, d1, d2, 64);
d1 += (float)c().a * 1.15F * f1;
}
}
super.a(bma1, d, d1, d2, s, f1, d3);
}
public void a(xq xq)
{
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
f.p = 0.0F;
f.a(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, xq);
f.f.a(0.0625F);
}
protected void a(bma bma1, double d, double d1, double d2)
{
if (bma1.Y() && bma1.bl())
super.a(bma1, d + (double)bma1.bC, d1 + (double)bma1.cc, d2 + (double)bma1.bD);
else
super.a(bma1, d, d1, d2);
}
protected void a(bma bma1, float f1, float f2, float f3)
{
if (bma1.Y() && bma1.bl())
{
GL11.glRotatef(bma1.bJ(), 0.0F, 1.0F, 0.0F);
GL11.glRotatef(a(((rm) (bma1))), 0.0F, 0.0F, 1.0F);
GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F);
} else
{
super.a(bma1, f1, f2, f3);
}
}
protected volatile void a(rm rm, double d, double d1, double d2,
String s, float f1, double d3)
{
a((bma)rm, d, d1, d2, s, f1, d3);
}
protected void a(rm rm, float f1)
{
b((bma)rm, f1);
}
protected void c(rm rm, int i, float f1)
{
b((bma)rm, i, f1);
}
protected volatile int a(rm rm, int i, float f1)
{
return a((bma)rm, i, f1);
}
protected void c(rm rm, float f1)
{
a((bma)rm, f1);
}
protected volatile void a(rm rm, float f1, float f2, float f3)
{
a((bma)rm, f1, f2, f3);
}
protected volatile void a(rm rm, double d, double d1, double d2)
{
a((bma)rm, d, d1, d2);
}
public volatile void a(rm rm, double d, double d1, double d2,
float f1, float f2)
{
a((bma)rm, d, d1, d2, f1, f2);
}
protected volatile brq a(qr qr)
{
return a((bma)qr);
}
public volatile void a(qr qr, double d, double d1, double d2,
float f1, float f2)
{
a((bma)qr, d, d1, d2, f1, f2);
}
}
-80
View File
@@ -1,80 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.util.concurrent.atomic.AtomicInteger;
public class bqk extends bqn
{
private static final AtomicInteger d = new AtomicInteger(0);
private final String e;
private final bmq f;
private BufferedImage g;
private Thread h;
private boolean i;
public bqk(String s, brq brq, bmq bmq)
{
super(brq);
e = s;
f = bmq;
}
private void e()
{
if (i)
return;
if (g != null)
{
if (b != null)
c();
brb.a(super.b(), g);
i = true;
}
}
public int b()
{
e();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
g = bufferedimage;
}
public void a(brr brr1)
{
if (g == null && b != null)
super.a(brr1);
if (h == null)
{
h = new bql(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
h.setDaemon(true);
h.setName((new StringBuilder()).append("Skin downloader: ").append(e).toString());
h.start();
}
}
public boolean a()
{
e();
return i;
}
static String a(bqk bqk1)
{
return bqk1.e;
}
static bmq b(bqk bqk1)
{
return bqk1.f;
}
}
-41
View File
@@ -1,41 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bql extends Thread
{
final bqk a;
bql(bqk bqk1, String s)
{
a = bqk1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bqk.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.4 Builder
echo Please Build with Minecraft 1.7.4 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building bmv.java[For HD Skin]
javac bmv.java
echo Building bqk.java[DownloadImage]
javac bqk.java
echo Building bql.java[ThreadDownloadImage]
javac bql.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
-124
View File
@@ -1,124 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: bnb.java
import java.awt.Graphics;
import java.awt.image.*;
public class bnb
implements bmw
{
private int a[];
private int w23;
private int h23;
public bnb()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
w23 = bufferedimage.getWidth(null);
h23 = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(w23, h23, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (w23 == 128 && h23 == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (w23 == 256 && h23 == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (w23 == 512 && h23 == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * w23];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
-82
View File
@@ -1,82 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.util.concurrent.atomic.AtomicInteger;
public class bqq extends bqt
{
private static final AtomicInteger d = new AtomicInteger(0);
private final String e;
private final bmw f;
private BufferedImage g;
private Thread h;
private boolean i;
public bqq(String s, brw brw, bmw bmw)
{
super(brw);
e = s;
f = bmw;
}
private void e()
{
if (i)
return;
if (g != null)
{
if (b != null)
c();
brh.a(super.b(), g);
i = true;
}
}
public int b()
{
e();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
g = bufferedimage;
}
public void a(brx brx1)
{
if (g == null && b != null)
super.a(brx1);
if (h == null)
{
h = new bqr(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
h.setDaemon(true);
h.setName((new StringBuilder()).append("Skin downloader: ").append(e).toString());
h.start();
}
}
public boolean a()
{
e();
return i;
}
public static String a(bqq bqq1)
{
return bqq1.e;
}
static bmw b(bqq bqq1)
{
return bqq1.f;
}
}
-37
View File
@@ -1,37 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bqr extends Thread
{
final bqq a;
bqr(bqq bqq1, String s)
{
a = bqq1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bqq.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.5 Builder
echo Please Build with Minecraft 1.7.5 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building bnb.java[For HD Skin]
javac bnb.java
echo Building bqq.java[DownloadImage]
javac bqq.java
echo Building bqr.java[ThreadDownloadImage]
javac bqr.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
-128
View File
@@ -1,128 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.Graphics;
import java.awt.image.*;
public class bom
implements boh
{
private int a[];
private int w23;
private int h23;
public bom()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
w23 = bufferedimage.getWidth(null);
h23 = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(w23, h23, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (w23 == 128 && h23 == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (w23 == 256 && h23 == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (w23 == 512 && h23 == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
public void a()
{
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * w23];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
-105
View File
@@ -1,105 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
public class bsb extends bse
{
private static final AtomicInteger d = new AtomicInteger(0);
private final File e;
private final String f;
private final boh g;
private BufferedImage h;
private Thread i;
private boolean j;
public bsb(File file, String s, bth bth, boh boh1)
{
super(bth);
e = file;
f = s;
g = boh1;
}
private void f()
{
if (j)
return;
if (h != null)
{
if (b != null)
c();
bss.a(super.b(), h);
j = true;
}
}
public int b()
{
f();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
h = bufferedimage;
if (g != null)
g.a();
}
public void a(bti bti1)
{
if (h == null && b != null)
super.a(bti1);
if (i == null)
if (e != null && e.isFile())
{
try
{
h = ImageIO.read(e);
if (g != null)
a(g.a(h));
}
catch (IOException ioexception)
{
a();
}
} else
{
a();
}
}
protected void a()
{
i = new bsc(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
i.setDaemon(true);
i.start();
}
static String a(bsb bsb1)
{
return bsb1.f;
}
static File b(bsb bsb1)
{
return bsb1.e;
}
static boh c(bsb bsb1)
{
return bsb1.g;
}
}
-37
View File
@@ -1,37 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bsc extends Thread
{
final bsb a;
bsc(bsb bsb1, String s)
{
a = bsb1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bsb.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.6 Builder
echo Please Build with Minecraft 1.7.6 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building bom.java[For HD Skin]
javac bom.java
echo Building bsb.java[DownloadImage]
javac bsb.java
echo Building bsc.java[ThreadDownloadImage]
javac bsc.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
-128
View File
@@ -1,128 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.Graphics;
import java.awt.image.*;
public class bom
implements boh
{
private int a[];
private int w23;
private int h23;
public bom()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
w23 = bufferedimage.getWidth(null);
h23 = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(w23, h23, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (w23 == 128 && h23 == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (w23 == 256 && h23 == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (w23 == 512 && h23 == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
public void a()
{
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * w23];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
-105
View File
@@ -1,105 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
public class bsb extends bse
{
private static final AtomicInteger d = new AtomicInteger(0);
private final File e;
private final String f;
private final boh g;
private BufferedImage h;
private Thread i;
private boolean j;
public bsb(File file, String s, bth bth, boh boh1)
{
super(bth);
e = file;
f = s;
g = boh1;
}
private void f()
{
if (j)
return;
if (h != null)
{
if (b != null)
c();
bss.a(super.b(), h);
j = true;
}
}
public int b()
{
f();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
h = bufferedimage;
if (g != null)
g.a();
}
public void a(bti bti1)
{
if (h == null && b != null)
super.a(bti1);
if (i == null)
if (e != null && e.isFile())
{
try
{
h = ImageIO.read(e);
if (g != null)
a(g.a(h));
}
catch (IOException ioexception)
{
a();
}
} else
{
a();
}
}
protected void a()
{
i = new bsc(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
i.setDaemon(true);
i.start();
}
static String a(bsb bsb1)
{
return bsb1.f;
}
static File b(bsb bsb1)
{
return bsb1.e;
}
static boh c(bsb bsb1)
{
return bsb1.g;
}
}
-37
View File
@@ -1,37 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bsc extends Thread
{
final bsb a;
bsc(bsb bsb1, String s)
{
a = bsb1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bsb.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.7 Builder
echo Please Build with Minecraft 1.7.7 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building bom.java[For HD Skin]
javac bom.java
echo Building bsb.java[DownloadImage]
javac bsb.java
echo Building bsc.java[ThreadDownloadImage]
javac bsc.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
-128
View File
@@ -1,128 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.Graphics;
import java.awt.image.*;
public class boo
implements boj
{
private int a[];
private int b;
private int c;
public boo()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
b = bufferedimage.getWidth(null);
c = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(b, c, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (b == 128 && c == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (b == 256 && c == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (b == 512 && c == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
public void a()
{
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * b] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * b] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * b];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
-106
View File
@@ -1,106 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
public class bsd extends bsg
{
private static final AtomicInteger d = new AtomicInteger(0);
private final File e;
private final String f;
private final boj g;
private BufferedImage h;
private Thread i;
private boolean j;
public bsd(File file, String s, btj btj, boj boj1)
{
super(btj);
e = file;
f = s;
g = boj1;
}
private void f()
{
if (j)
return;
if (h != null)
{
if (b != null)
c();
bsu.a(super.b(), h);
j = true;
}
}
public int b()
{
f();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
h = bufferedimage;
if (g != null)
g.a();
}
public void a(btk btk1)
{
if (h == null && b != null)
super.a(btk1);
if (i == null)
if (e != null && e.isFile())
{
try
{
h = ImageIO.read(e);
if (g != null)
a(g.a(h));
}
catch (IOException ioexception)
{
a();
}
} else
{
a();
}
}
protected void a()
{
i = new bse(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
i.setDaemon(true);
i.start();
}
static String a(bsd bsd1)
{
return bsd1.f;
}
static File b(bsd bsd1)
{
return bsd1.e;
}
static boj c(bsd bsd1)
{
return bsd1.g;
}
}
-38
View File
@@ -1,38 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bse extends Thread
{
final bsd a;
bse(bsd bsd1, String s)
{
a = bsd1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bsd.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.8 Builder
echo Please Build with Minecraft 1.7.8 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building boo.java[For HD Skin]
javac boo.java
echo Building bsd.java[DownloadImage]
javac bsd.java
echo Building bse.java[ThreadDownloadImage]
javac bse.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
-128
View File
@@ -1,128 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.Graphics;
import java.awt.image.*;
public class boo
implements boj
{
private int a[];
private int b;
private int c;
public boo()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
b = bufferedimage.getWidth(null);
c = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(b, c, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (b == 128 && c == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (b == 256 && c == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (b == 512 && c == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
public void a()
{
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * b] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * b] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * b];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
-106
View File
@@ -1,106 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
public class bsd extends bsg
{
private static final AtomicInteger d = new AtomicInteger(0);
private final File e;
private final String f;
private final boj g;
private BufferedImage h;
private Thread i;
private boolean j;
public bsd(File file, String s, btj btj, boj boj1)
{
super(btj);
e = file;
f = s;
g = boj1;
}
private void f()
{
if (j)
return;
if (h != null)
{
if (b != null)
c();
bsu.a(super.b(), h);
j = true;
}
}
public int b()
{
f();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
h = bufferedimage;
if (g != null)
g.a();
}
public void a(btk btk1)
{
if (h == null && b != null)
super.a(btk1);
if (i == null)
if (e != null && e.isFile())
{
try
{
h = ImageIO.read(e);
if (g != null)
a(g.a(h));
}
catch (IOException ioexception)
{
a();
}
} else
{
a();
}
}
protected void a()
{
i = new bse(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
i.setDaemon(true);
i.start();
}
static String a(bsd bsd1)
{
return bsd1.f;
}
static File b(bsd bsd1)
{
return bsd1.e;
}
static boj c(bsd bsd1)
{
return bsd1.g;
}
}
-38
View File
@@ -1,38 +0,0 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bse extends Thread
{
final bsd a;
bse(bsd bsd1, String s)
{
a = bsd1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bsd.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
-14
View File
@@ -1,14 +0,0 @@
@echo off
title CustomSkinLoader 1.7.9 Builder
echo Please Build with Minecraft 1.7.9 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building boo.java[For HD Skin]
javac boo.java
echo Building bsd.java[DownloadImage]
javac bsd.java
echo Building bse.java[ThreadDownloadImage]
javac bse.java
pause
-189
View File
@@ -1,189 +0,0 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}
@@ -1,357 +0,0 @@
package idv.jlchntoz;
import net.minecraft.client.Minecraft;
import java.io.*;
import java.math.BigInteger;
import java.net.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 12th Revision 9th Subversion 2016.2.10
*
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
*/
public class CustomSkinLoader {
public final static String VERSION="12.9";
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newResPattern = Pattern.compile("^http://textures.minecraft.net/texture/(.*?)?(Skin|Cloak)=(.*?)$"),
newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$"),
optifineCapeURLPattern = Pattern.compile("^http://s.optifine.net/capes/(.*?).png$");
public final static File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
CACHE_DIR=new File(DATA_DIR,"caches"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
SKIN_URL_FILE=new File(DATA_DIR,"skinurls.txt"),
CAPE_URL_FILE=new File(DATA_DIR,"capeurls.txt");
public final static MainLogger logger = getLogger(LOG_FILE);
public final static String[] DEFAULT_SKIN_URLS={
"http://skins.minecraft.net/MinecraftSkins/*.png",
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
"http://www.skinme.cc/MinecraftSkins/*.png"};
public final static String[] DEFAULT_CAPE_URLS={
"http://skins.minecraft.net/MinecraftCloaks/*.png",
"http://s.optifine.net/capes/*.png",
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
"http://www.skinme.cc/MinecraftCloaks/*.png"};
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
//Entrance
public InputStream getPlayerSkinStream(String path) {
if(!DATA_DIR.exists())
DATA_DIR.mkdir();
if(!CACHE_DIR.exists())
CACHE_DIR.mkdir();
logger.info("Get a request: "+path);
if(path.contains("NOCSL"))//Not to use CSL to load, prepared for json api
return getStream(path, false);
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//May be old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}else{
m = newResPattern.matcher(path);
if(m.matches()){
if (m.group(2).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(3));
else if (m.group(2).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(3));
}else{
m = optifineCapeURLPattern.matcher(path);
if(m.matches()){//Optifine Cape
logger.info("Ignore Optifine Cape.");
return null;//Not Load This
}
}
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if ((skinURLs == null|| skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))
refreshSkinURL(); // If the list is blank or null, try to load again.
InputStream S=null;
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
S = getStream(loc, true);
if (S == null){
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin") + " found in " + loc);
}else{
logger.info("Succeessfully load " + (isCloak ? "cloak" : "skin") + " in " + loc);
return S;
}
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
boolean success=false;
File cacheFile=new File(CACHE_DIR,MD5(URL));
boolean alreadyCached=false;
if(cacheFile.exists()&&cacheFile.length()>1){
alreadyCached=true;
logger.info("Cache File Found (LastModified: "+cacheFile.lastModified()+" , Size: "+cacheFile.length()+")");
}
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setReadTimeout(15000);
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
logger.info("Response Code: "+C.getResponseCode());
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful to get skin.
if(C.getContentLength()<=0){//Nothing got
logger.info("Nothing got.");
return null;
}
logger.info("Successfully Get Resource (LastModified: "+C.getLastModified()+" , ContentLength: "+C.getContentLength()+")");
if(alreadyCached && C.getLastModified()==cacheFile.lastModified() && C.getContentLength()==cacheFile.length()){
logger.info("Not Modified.");
return getStreamFromCache(cacheFile);
}
InputStream IS=new BufferedInputStream(C.getInputStream());
if (!CheckPNG){ // If no need to check PNG header, just skip it.
success=true;
saveToCache(IS,cacheFile);
return IS;
}
//logger.info(C.getContentLength()+" "+IS.available());
IS.mark(C.getContentLength()+10);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N' && ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
success=true;
saveToCache(IS,cacheFile);
return IS;
}
}
} catch (Exception ex) {
success=false;
logger.log(Level.WARNING, ex.getMessage());
if(alreadyCached)
return getStreamFromCache(cacheFile);
}finally{
if(!success)
disconnect();
}
return null;
}
private InputStream getStreamFromCache(File cacheFile) {
try{
logger.info("Try load local cache in " + cacheFile.getAbsolutePath());
InputStream in = new FileInputStream(cacheFile);
BufferedInputStream bis=new BufferedInputStream(in);
if(bis.available()<=0){
logger.info("Cannot load local cache in " + cacheFile.getAbsolutePath());
return null;
}else{
logger.info("Successfully load cache in " + cacheFile.getAbsolutePath());
return bis;
}
}catch(Exception e){
logger.log(Level.WARNING, e.getMessage());
return null;
}
}
private void saveToCache(InputStream is,File to){
logger.info("Try save local cache to " + to.getAbsolutePath());
FileOutputStream fs=null;
int times=0;
try{//Save to Local Skin File
if(to.exists()){
to.delete();
}
fs = new FileOutputStream(to);
int byteRead = 0;
byte[] buffer = new byte[1024];
while (( byteRead = is.read(buffer)) != -1) {
times+=byteRead;
fs.write(buffer, 0, byteRead);
if(times>=C.getContentLength()){
//logger.info(times+" "+C.getContentLength());
break;
}
}
if(to.length()>1){
to.setLastModified(C.getLastModified());
logger.info("Cache saved to " + to.getAbsolutePath()+" (LastModified: "+to.lastModified()+" , Size: "+to.length()+")");
}else{
to.delete();
logger.info("Cannot save local cache to " + to.getAbsolutePath());
}
}catch(Exception e){
logger.warning(e.getMessage());
}finally{
try {
if(fs!=null)
fs.close();
is.reset();
} catch (IOException e) {
logger.warning(e.getMessage());
}
}
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
if(!SKIN_URL_FILE.exists()){
logger.log(Level.INFO, "SKIN config not found, create a new one.");
SKIN_URL_FILE.createNewFile();
}
if(!CAPE_URL_FILE.exists()){
logger.log(Level.INFO, "CAPE config not found, create a new one.");
CAPE_URL_FILE.createNewFile();
}
skinURLs = readAllLines(SKIN_URL_FILE);
cloakURLs = readAllLines(CAPE_URL_FILE);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
if(skinURLs.length==0&&cloakURLs.length==0){
logger.info("No skinURLs and cloak URLS found, try to init and use default settings.");
initSkinURL();
refreshSkinURL();
}else{
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
}
private static void initSkinURL(){
//Init URL List
skinURLs=DEFAULT_SKIN_URLS;
writeToFile(new File(DATA_DIR,"skinurls.txt"),parseArrayToText(skinURLs));
cloakURLs=DEFAULT_CAPE_URLS;
writeToFile(new File(DATA_DIR,"capeurls.txt"),parseArrayToText(cloakURLs));
}
private static String[] readAllLines(File F) {
try {
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))//Remove note
re[i]=null;
else{//Remove same URL
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
private static String parseArrayToText(String[] data){
StringBuilder temp=new StringBuilder();
for(int i=0;i<data.length-1;i++)
temp.append(data[i]).append("\r\n");
temp.append(data[data.length-1]);
return temp.toString();
}
private static boolean writeToFile(File file,String Data){
System.out.print("Write to "+file.getAbsolutePath()+" ");
FileWriter fw=null;
try{
fw = new FileWriter(file);
fw.write(Data,0,Data.length());
fw.flush();
fw.close();
}catch(Exception ex){
ex.printStackTrace();
System.out.println("failed.");
return false;
}
System.out.println("succeed.");
return true;
}
public String MD5(String str){
byte [] buf = str.getBytes();
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(buf);
byte [] tmp = md5.digest();
StringBuilder sb = new StringBuilder();
for (byte b:tmp) {
sb.append(Integer.toHexString(b&0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
logger.warning(e.getMessage());
}
return "Fail";
}
private static MainLogger getLogger(File logFile){
MainLogger mainLogger = new MainLogger(logFile);
mainLogger.info("CustomSkinLoader " + VERSION);
return mainLogger;
}
}
@@ -1,71 +0,0 @@
package idv.jlchntoz;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
public class MainLogger {
private static final int LOWEST_DISPLAY_LEVEL=Level.INFO.intValue();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private BufferedWriter writer;
public MainLogger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(level.intValue()>=LOWEST_DISPLAY_LEVEL)
System.out.println(msg);
try {
writer.write("[");
writer.write(DATE_FORMAT.format(new Date()));
writer.write(" ");
writer.write(Thread.currentThread().getName());
writer.write(" ");
writer.write(level.getName());
writer.write("] ");
writer.write(msg);
writer.write("\r\n");
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void info(String msg){
log(Level.INFO,msg);
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(Exception e){
log(Level.WARNING,"Exception occurs while running: "+e.getMessage());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
log(Level.WARNING,"");
}
}
@@ -1,116 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.ImageObserver;
public class ImageBufferDownload implements IImageBuffer
{
private int[] imageData;
private int imageWidth;
private int imageHeight;
private static final String __OBFID = "CL_00000956";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (p_78432_1_ == null)
{
return null;
}
else
{
int ratio=p_78432_1_.getWidth()/64;
this.imageWidth = 64 * ratio;
this.imageHeight = 64 * ratio;
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
Graphics var3 = var2.getGraphics();
var3.drawImage(p_78432_1_, 0, 0, (ImageObserver)null);
if (p_78432_1_.getHeight() == 32 * ratio)
{
var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
}
var3.dispose();
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
return var2;
}
}
public void func_152634_a() {}
/**
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
* maker is just using an image editor without an alpha channel)
*/
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
{
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
{
for (int var5 = p_78434_1_; var5 < p_78434_3_; ++var5)
{
for (int var6 = p_78434_2_; var6 < p_78434_4_; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
}
}
}
}
/**
* Makes the given area of the image opaque
*/
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
{
for (int var5 = p_78433_1_; var5 < p_78433_3_; ++var5)
{
for (int var6 = p_78433_2_; var6 < p_78433_4_; ++var6)
{
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
}
}
}
/**
* Returns true if the given area of the image contains transparent pixels
*/
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
{
for (int var5 = p_78435_1_; var5 < p_78435_3_; ++var5)
{
for (int var6 = p_78435_2_; var6 < p_78435_4_; ++var6)
{
int var7 = this.imageData[var5 + var6 * this.imageWidth];
if ((var7 >> 24 & 255) < 128)
{
return true;
}
}
}
return false;
}
}
@@ -1,177 +0,0 @@
package net.minecraft.client.renderer;
import idv.jlchntoz.CustomSkinLoader;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ThreadDownloadImageData extends SimpleTexture
{
private static final Logger logger = LogManager.getLogger();
private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0);
private final File field_152434_e;
private final String imageUrl;
private final IImageBuffer imageBuffer;
private BufferedImage bufferedImage;
private Thread imageThread;
private boolean textureUploaded;
private static final String __OBFID = "CL_00001049";
//For Optifine
public Boolean imageFound = null;
public boolean pipeline = false;
public ThreadDownloadImageData(File p_i1049_1_, String p_i1049_2_, ResourceLocation p_i1049_3_, IImageBuffer p_i1049_4_)
{
super(p_i1049_3_);
this.field_152434_e = p_i1049_1_;
this.imageUrl = p_i1049_2_;
this.imageBuffer = p_i1049_4_;
}
private void checkTextureUploaded()
{
if (!this.textureUploaded)
{
if (this.bufferedImage != null)
{
if (this.textureLocation != null)
{
this.deleteGlTexture();
}
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
this.textureUploaded = true;
}
}
}
public int getGlTextureId()
{
this.checkTextureUploaded();
return super.getGlTextureId();
}
public void setBufferedImage(BufferedImage p_147641_1_)
{
this.bufferedImage = p_147641_1_;
if (this.imageBuffer != null)
{
this.imageBuffer.func_152634_a();
}
}
public void loadTexture(IResourceManager p_110551_1_) throws IOException
{
if (this.bufferedImage == null && this.textureLocation != null)
{
super.loadTexture(p_110551_1_);
}
if (this.imageThread == null)
{
if (this.field_152434_e != null && this.field_152434_e.isFile())
{
logger.debug("Loading http texture from local cache ({})", new Object[] {this.field_152434_e});
try
{
this.bufferedImage = ImageIO.read(this.field_152434_e);
if (this.imageBuffer != null)
{
this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage));
}
}
catch (IOException var3)
{
logger.error("Couldn\'t load skin " + this.field_152434_e, var3);
this.func_152433_a();
}
}
else
{
this.func_152433_a();
}
}
}
protected void func_152433_a()
{
this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet())
{
private static final String __OBFID = "CL_00001050";
public void run()
{
CustomSkinLoader loader=new CustomSkinLoader();
//HttpURLConnection var1 = null;
ThreadDownloadImageData.logger.info("Downloading http texture from {} to {}", new Object[] {ThreadDownloadImageData.this.imageUrl, ThreadDownloadImageData.this.field_152434_e});
try
{
/*
var1 = (HttpURLConnection)(new URL(ThreadDownloadImageData.this.imageUrl)).openConnection(Minecraft.getMinecraft().getProxy());
var1.setDoInput(true);
var1.setDoOutput(false);
var1.connect();
if (var1.getResponseCode() / 100 == 2)
{*/
BufferedImage var2;
/*
if (ThreadDownloadImageData.this.field_152434_e != null)
{
FileUtils.copyInputStreamToFile(var1.getInputStream(), ThreadDownloadImageData.this.field_152434_e);
var2 = ImageIO.read(ThreadDownloadImageData.this.field_152434_e);
}
else
{
var2 = TextureUtil.func_177053_a(var1.getInputStream());
}
*/
InputStream var9=loader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl);
var2 = TextureUtil.func_177053_a(var9);
if (ThreadDownloadImageData.this.imageBuffer != null)
{
var2 = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
}
ThreadDownloadImageData.this.setBufferedImage(var2);
return;
//}
}
catch (Exception var6)
{
ThreadDownloadImageData.logger.error("Couldn\'t download http texture", var6);
return;
}
finally
{
/*
if (var1 != null)
{
var1.disconnect();
}*/
loader.disconnect();
}
}
};
this.imageThread.setDaemon(true);
this.imageThread.start();
}
}
@@ -1,192 +0,0 @@
package net.minecraft.client.resources;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ImageBufferDownload;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public class SkinManager
{
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue());
private final TextureManager textureManager;
private final File skinCacheDir;
private final MinecraftSessionService sessionService;
private final LoadingCache skinCacheLoader;
private static final String __OBFID = "CL_00001830";
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService)
{
this.textureManager = textureManagerInstance;
this.skinCacheDir = skinCacheDirectory;
this.sessionService = sessionService;
this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).build(new CacheLoader()
{
private static final String __OBFID = "CL_00001829";
public Map func_152786_a(GameProfile p_152786_1_)
{
return Minecraft.getMinecraft().getSessionService().getTextures(p_152786_1_, false);
}
public Object load(Object p_load_1_)
{
return this.func_152786_a((GameProfile)p_load_1_);
}
});
}
/**
* Used in the Skull renderer to fetch a skin. May download the skin if it's not in the cache
*/
public ResourceLocation loadSkin(MinecraftProfileTexture p_152792_1_, Type p_152792_2_)
{
return this.loadSkin(p_152792_1_, p_152792_2_, (SkinManager.SkinAvailableCallback)null);
}
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
{
//final ResourceLocation var4 = new ResourceLocation("skins/" + p_152789_1_.getHash());
final ResourceLocation var4 = new ResourceLocation(p_152789_2_.name() + "/" + p_152789_1_.getHash());
//ITextureObject var5 = this.textureManager.getTexture(var4);
/*
if (var5 != null)
{
if (p_152789_3_ != null)
{
p_152789_3_.func_180521_a(p_152789_2_, var4, p_152789_1_);
}
}
else
{*/
File var6 = new File(this.skinCacheDir, p_152789_1_.getHash().substring(0, 2));
File var7 = new File(var6, p_152789_1_.getHash());
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData var9 = new ThreadDownloadImageData(var7, p_152789_1_.getUrl(), DefaultPlayerSkin.func_177335_a(), new IImageBuffer()
{
private static final String __OBFID = "CL_00001828";
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (var8 != null)
{
p_78432_1_ = var8.parseUserSkin(p_78432_1_);
}
return p_78432_1_;
}
public void func_152634_a()
{
if (var8 != null)
{
var8.func_152634_a();
}
if (p_152789_3_ != null)
{
p_152789_3_.func_180521_a(p_152789_2_, var4, p_152789_1_);
}
}
});
this.textureManager.loadTexture(var4, var9);
//}
return var4;
}
public void func_152790_a(final GameProfile p_152790_1_, final SkinManager.SkinAvailableCallback p_152790_2_, final boolean p_152790_3_)
{
THREAD_POOL.submit(new Runnable()
{
private static final String __OBFID = "CL_00001827";
public void run()
{
final HashMap var1 = Maps.newHashMap();
try
{
var1.putAll(SkinManager.this.sessionService.getTextures(p_152790_1_, p_152790_3_));
}
catch (InsecureTextureException var3)
{
;
}
if (var1.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId()))
{
var1.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false));
}
//CustomSkinLoader Begin
HashMap var2 = Maps.newHashMap();
if (var1.containsKey(Type.SKIN)){
MinecraftProfileTexture var3=((MinecraftProfileTexture)var1.get(Type.SKIN));
String var4=var3.getMetadata("model");
HashMap var5 = null;
if(var4!=null){
var5 = Maps.newHashMap();
var5.put("model", var4);
}
var2.put(Type.SKIN, new MinecraftProfileTexture(var3.getUrl()+"?Skin="+p_152790_1_.getName(),var5));
}else{
HashMap var5 = Maps.newHashMap();
//var5.put("model", "slim");
var2.put(Type.SKIN,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftSkins/"+p_152790_1_.getName()+".png",var5));
}
if (var1.containsKey(Type.CAPE)){
var2.put(Type.CAPE, new MinecraftProfileTexture(((MinecraftProfileTexture)var1.get(Type.CAPE)).getUrl()+"?Cloak="+p_152790_1_.getName(),null));
}else{
var2.put(Type.CAPE,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftCloaks/"+p_152790_1_.getName()+".png",null));
}
var1.clear();
var1.putAll(var2);
//CustomSkinLoader End
Minecraft.getMinecraft().addScheduledTask(new Runnable()
{
private static final String __OBFID = "CL_00001826";
public void run()
{
if (var1.containsKey(Type.SKIN))
{
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.get(Type.SKIN), Type.SKIN, p_152790_2_);
}
if (var1.containsKey(Type.CAPE))
{
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.get(Type.CAPE), Type.CAPE, p_152790_2_);
}
}
});
}
});
}
public Map loadSkinFromCache(GameProfile p_152788_1_)
{
return (Map)this.skinCacheLoader.getUnchecked(p_152788_1_);
}
public interface SkinAvailableCallback
{
void func_180521_a(Type p_180521_1_, ResourceLocation p_180521_2_, MinecraftProfileTexture p_180521_3_);
}
}
@@ -1,357 +0,0 @@
package idv.jlchntoz;
import net.minecraft.client.Minecraft;
import java.io.*;
import java.math.BigInteger;
import java.net.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 12th Revision 9th Subversion 2016.2.10
*
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
*/
public class CustomSkinLoader {
public final static String VERSION="12.9";
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newResPattern = Pattern.compile("^http://textures.minecraft.net/texture/(.*?)?(Skin|Cloak)=(.*?)$"),
newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$"),
optifineCapeURLPattern = Pattern.compile("^http://s.optifine.net/capes/(.*?).png$");
public final static File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
CACHE_DIR=new File(DATA_DIR,"caches"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
SKIN_URL_FILE=new File(DATA_DIR,"skinurls.txt"),
CAPE_URL_FILE=new File(DATA_DIR,"capeurls.txt");
public final static MainLogger logger = getLogger(LOG_FILE);
public final static String[] DEFAULT_SKIN_URLS={
"http://skins.minecraft.net/MinecraftSkins/*.png",
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
"http://www.skinme.cc/MinecraftSkins/*.png"};
public final static String[] DEFAULT_CAPE_URLS={
"http://skins.minecraft.net/MinecraftCloaks/*.png",
"http://s.optifine.net/capes/*.png",
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
"http://www.skinme.cc/MinecraftCloaks/*.png"};
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
//Entrance
public InputStream getPlayerSkinStream(String path) {
if(!DATA_DIR.exists())
DATA_DIR.mkdir();
if(!CACHE_DIR.exists())
CACHE_DIR.mkdir();
logger.info("Get a request: "+path);
if(path.contains("NOCSL"))//Not to use CSL to load, prepared for json api
return getStream(path, false);
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//May be old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}else{
m = newResPattern.matcher(path);
if(m.matches()){
if (m.group(2).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(3));
else if (m.group(2).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(3));
}else{
m = optifineCapeURLPattern.matcher(path);
if(m.matches()){//Optifine Cape
logger.info("Ignore Optifine Cape.");
return null;//Not Load This
}
}
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if ((skinURLs == null|| skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))
refreshSkinURL(); // If the list is blank or null, try to load again.
InputStream S=null;
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
S = getStream(loc, true);
if (S == null){
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin") + " found in " + loc);
}else{
logger.info("Succeessfully load " + (isCloak ? "cloak" : "skin") + " in " + loc);
return S;
}
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
boolean success=false;
File cacheFile=new File(CACHE_DIR,MD5(URL));
boolean alreadyCached=false;
if(cacheFile.exists()&&cacheFile.length()>1){
alreadyCached=true;
logger.info("Cache File Found (LastModified: "+cacheFile.lastModified()+" , Size: "+cacheFile.length()+")");
}
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setReadTimeout(15000);
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
logger.info("Response Code: "+C.getResponseCode());
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful to get skin.
if(C.getContentLength()<=0){//Nothing got
logger.info("Nothing got.");
return null;
}
logger.info("Successfully Get Resource (LastModified: "+C.getLastModified()+" , ContentLength: "+C.getContentLength()+")");
if(alreadyCached && C.getLastModified()==cacheFile.lastModified() && C.getContentLength()==cacheFile.length()){
logger.info("Not Modified.");
return getStreamFromCache(cacheFile);
}
InputStream IS=new BufferedInputStream(C.getInputStream());
if (!CheckPNG){ // If no need to check PNG header, just skip it.
success=true;
saveToCache(IS,cacheFile);
return IS;
}
//logger.info(C.getContentLength()+" "+IS.available());
IS.mark(C.getContentLength()+10);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N' && ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
success=true;
saveToCache(IS,cacheFile);
return IS;
}
}
} catch (Exception ex) {
success=false;
logger.log(Level.WARNING, ex.getMessage());
if(alreadyCached)
return getStreamFromCache(cacheFile);
}finally{
if(!success)
disconnect();
}
return null;
}
private InputStream getStreamFromCache(File cacheFile) {
try{
logger.info("Try load local cache in " + cacheFile.getAbsolutePath());
InputStream in = new FileInputStream(cacheFile);
BufferedInputStream bis=new BufferedInputStream(in);
if(bis.available()<=0){
logger.info("Cannot load local cache in " + cacheFile.getAbsolutePath());
return null;
}else{
logger.info("Successfully load cache in " + cacheFile.getAbsolutePath());
return bis;
}
}catch(Exception e){
logger.log(Level.WARNING, e.getMessage());
return null;
}
}
private void saveToCache(InputStream is,File to){
logger.info("Try save local cache to " + to.getAbsolutePath());
FileOutputStream fs=null;
int times=0;
try{//Save to Local Skin File
if(to.exists()){
to.delete();
}
fs = new FileOutputStream(to);
int byteRead = 0;
byte[] buffer = new byte[1024];
while (( byteRead = is.read(buffer)) != -1) {
times+=byteRead;
fs.write(buffer, 0, byteRead);
if(times>=C.getContentLength()){
//logger.info(times+" "+C.getContentLength());
break;
}
}
if(to.length()>1){
to.setLastModified(C.getLastModified());
logger.info("Cache saved to " + to.getAbsolutePath()+" (LastModified: "+to.lastModified()+" , Size: "+to.length()+")");
}else{
to.delete();
logger.info("Cannot save local cache to " + to.getAbsolutePath());
}
}catch(Exception e){
logger.warning(e.getMessage());
}finally{
try {
if(fs!=null)
fs.close();
is.reset();
} catch (IOException e) {
logger.warning(e.getMessage());
}
}
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
if(!SKIN_URL_FILE.exists()){
logger.log(Level.INFO, "SKIN config not found, create a new one.");
SKIN_URL_FILE.createNewFile();
}
if(!CAPE_URL_FILE.exists()){
logger.log(Level.INFO, "CAPE config not found, create a new one.");
CAPE_URL_FILE.createNewFile();
}
skinURLs = readAllLines(SKIN_URL_FILE);
cloakURLs = readAllLines(CAPE_URL_FILE);
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
if(skinURLs.length==0&&cloakURLs.length==0){
logger.info("No skinURLs and cloak URLS found, try to init and use default settings.");
initSkinURL();
refreshSkinURL();
}else{
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
}
private static void initSkinURL(){
//Init URL List
skinURLs=DEFAULT_SKIN_URLS;
writeToFile(new File(DATA_DIR,"skinurls.txt"),parseArrayToText(skinURLs));
cloakURLs=DEFAULT_CAPE_URLS;
writeToFile(new File(DATA_DIR,"capeurls.txt"),parseArrayToText(cloakURLs));
}
private static String[] readAllLines(File F) {
try {
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))//Remove note
re[i]=null;
else{//Remove same URL
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
private static String parseArrayToText(String[] data){
StringBuilder temp=new StringBuilder();
for(int i=0;i<data.length-1;i++)
temp.append(data[i]).append("\r\n");
temp.append(data[data.length-1]);
return temp.toString();
}
private static boolean writeToFile(File file,String Data){
System.out.print("Write to "+file.getAbsolutePath()+" ");
FileWriter fw=null;
try{
fw = new FileWriter(file);
fw.write(Data,0,Data.length());
fw.flush();
fw.close();
}catch(Exception ex){
ex.printStackTrace();
System.out.println("failed.");
return false;
}
System.out.println("succeed.");
return true;
}
public String MD5(String str){
byte [] buf = str.getBytes();
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(buf);
byte [] tmp = md5.digest();
StringBuilder sb = new StringBuilder();
for (byte b:tmp) {
sb.append(Integer.toHexString(b&0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
logger.warning(e.getMessage());
}
return "Fail";
}
private static MainLogger getLogger(File logFile){
MainLogger mainLogger = new MainLogger(logFile);
mainLogger.info("CustomSkinLoader " + VERSION);
return mainLogger;
}
}
@@ -1,71 +0,0 @@
package idv.jlchntoz;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
public class MainLogger {
private static final int LOWEST_DISPLAY_LEVEL=Level.INFO.intValue();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private BufferedWriter writer;
public MainLogger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(level.intValue()>=LOWEST_DISPLAY_LEVEL)
System.out.println(msg);
try {
writer.write("[");
writer.write(DATE_FORMAT.format(new Date()));
writer.write(" ");
writer.write(Thread.currentThread().getName());
writer.write(" ");
writer.write(level.getName());
writer.write("] ");
writer.write(msg);
writer.write("\r\n");
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void info(String msg){
log(Level.INFO,msg);
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(Exception e){
log(Level.WARNING,"Exception occurs while running: "+e.getMessage());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
log(Level.WARNING,"");
}
}
@@ -1,117 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.ImageObserver;
public class ImageBufferDownload implements IImageBuffer
{
private int[] imageData;
private int imageWidth;
private int imageHeight;
public BufferedImage parseUserSkin(BufferedImage image)
{
if (image == null)
{
return null;
}
else
{
int ratio=image.getWidth()/64;
this.imageWidth = 64 * ratio;
this.imageHeight = 64 * ratio;
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
Graphics var3 = var2.getGraphics();
var3.drawImage(image, 0, 0, (ImageObserver)null);
if (image.getHeight() == 32 * ratio)
{
var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
}
var3.dispose();
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
return var2;
}
}
public void skinAvailable()
{
}
/**
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
* maker is just using an image editor without an alpha channel)
*/
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
{
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
{
for (int i = p_78434_1_; i < p_78434_3_; ++i)
{
for (int j = p_78434_2_; j < p_78434_4_; ++j)
{
this.imageData[i + j * this.imageWidth] &= 16777215;
}
}
}
}
/**
* Makes the given area of the image opaque
*/
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
{
for (int i = p_78433_1_; i < p_78433_3_; ++i)
{
for (int j = p_78433_2_; j < p_78433_4_; ++j)
{
this.imageData[i + j * this.imageWidth] |= -16777216;
}
}
}
/**
* Returns true if the given area of the image contains transparent pixels
*/
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
{
for (int i = p_78435_1_; i < p_78435_3_; ++i)
{
for (int j = p_78435_2_; j < p_78435_4_; ++j)
{
int k = this.imageData[i + j * this.imageWidth];
if ((k >> 24 & 255) < 128)
{
return true;
}
}
}
return false;
}
}
@@ -1,148 +0,0 @@
package net.minecraft.client.renderer;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import idv.jlchntoz.CustomSkinLoader;
public class ThreadDownloadImageData extends SimpleTexture
{
private static final Logger logger = LogManager.getLogger();
private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0);
private final File cacheFile;
private final String imageUrl;
private final IImageBuffer imageBuffer;
private BufferedImage bufferedImage;
private Thread imageThread;
private boolean textureUploaded;
//For Optifine
public Boolean imageFound = null;
public boolean pipeline = false;
public ThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn)
{
super(textureResourceLocation);
this.cacheFile = cacheFileIn;
this.imageUrl = imageUrlIn;
this.imageBuffer = imageBufferIn;
}
private void checkTextureUploaded()
{
if (!this.textureUploaded)
{
if (this.bufferedImage != null)
{
if (this.textureLocation != null)
{
this.deleteGlTexture();
}
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
this.textureUploaded = true;
}
}
}
public int getGlTextureId()
{
this.checkTextureUploaded();
return super.getGlTextureId();
}
public void setBufferedImage(BufferedImage bufferedImageIn)
{
this.bufferedImage = bufferedImageIn;
if (this.imageBuffer != null)
{
this.imageBuffer.skinAvailable();
}
}
public void loadTexture(IResourceManager resourceManager) throws IOException
{
if (this.bufferedImage == null && this.textureLocation != null)
{
super.loadTexture(resourceManager);
}
if (this.imageThread == null)
{
if (this.cacheFile != null && this.cacheFile.isFile())
{
logger.info("Loading http texture from local cache ({})", new Object[] {this.cacheFile});
try
{
this.bufferedImage = ImageIO.read(this.cacheFile);
if (this.imageBuffer != null)
{
this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage));
}
}
catch (IOException ioexception)
{
logger.error((String)("Couldn\'t load skin " + this.cacheFile), (Throwable)ioexception);
this.loadTextureFromServer();
}
}
else
{
this.loadTextureFromServer();
}
}
}
protected void loadTextureFromServer()
{
this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet())
{
public void run()
{
CustomSkinLoader loader=new CustomSkinLoader();
ThreadDownloadImageData.logger.info("Downloading http texture from {} to {}", new Object[] {ThreadDownloadImageData.this.imageUrl, ThreadDownloadImageData.this.cacheFile});
try
{
BufferedImage bufferedimage;
bufferedimage = TextureUtil.readBufferedImage(loader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
if (ThreadDownloadImageData.this.imageBuffer != null)
{
bufferedimage = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(bufferedimage);
}
ThreadDownloadImageData.this.setBufferedImage(bufferedimage);
return;
}
catch (Exception exception)
{
ThreadDownloadImageData.logger.error((String)"Couldn\'t download http texture", (Throwable)exception);
return;
}
finally
{
loader.disconnect();
}
}
};
this.imageThread.setDaemon(true);
this.imageThread.start();
}
}
@@ -1,184 +0,0 @@
package net.minecraft.client.resources;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ImageBufferDownload;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public class SkinManager
{
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue());
private final TextureManager textureManager;
private final File skinCacheDir;
private final MinecraftSessionService sessionService;
private final LoadingCache<GameProfile, Map<Type, MinecraftProfileTexture>> skinCacheLoader;
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService)
{
this.textureManager = textureManagerInstance;
this.skinCacheDir = skinCacheDirectory;
this.sessionService = sessionService;
this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).<GameProfile, Map<Type, MinecraftProfileTexture>>build(new CacheLoader<GameProfile, Map<Type, MinecraftProfileTexture>>()
{
public Map<Type, MinecraftProfileTexture> load(GameProfile p_load_1_) throws Exception
{
return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false);
}
});
}
/**
* Used in the Skull renderer to fetch a skin. May download the skin if it's not in the cache
*/
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type p_152792_2_)
{
return this.loadSkin(profileTexture, p_152792_2_, (SkinManager.SkinAvailableCallback)null);
}
/**
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
*/
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
{
final ResourceLocation resourcelocation = new ResourceLocation(p_152789_2_.name() + "/" + profileTexture.getHash());
/*Remove cache
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)
{
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
else
{*/
File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx");
File file2 = new File(file1, profileTexture.getHash());
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage image)
{
if (iimagebuffer != null)
{
image = iimagebuffer.parseUserSkin(image);
}
return image;
}
public void skinAvailable()
{
if (iimagebuffer != null)
{
iimagebuffer.skinAvailable();
}
if (skinAvailableCallback != null)
{
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
}
}
});
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
//}
return resourcelocation;
}
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure)
{
THREAD_POOL.submit(new Runnable()
{
public void run()
{
final Map<Type, MinecraftProfileTexture> map = Maps.<Type, MinecraftProfileTexture>newHashMap();
try
{
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
}
catch (InsecureTextureException var3)
{
;
}
if (map.isEmpty() && profile.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId()))
{
profile.getProperties().clear();
profile.getProperties().putAll(Minecraft.getMinecraft().func_181037_M());
map.putAll(SkinManager.this.sessionService.getTextures(profile, false));
}
//CustomSkinLoader Begin
Map<Type, MinecraftProfileTexture> var2 = Maps.<Type, MinecraftProfileTexture>newHashMap();
if (map.containsKey(Type.SKIN)){
MinecraftProfileTexture var3=((MinecraftProfileTexture)map.get(Type.SKIN));
String var4=var3.getMetadata("model");
Map var5 = null;
if(var4!=null){
var5 = Maps.newHashMap();
var5.put("model", var4);
}
var2.put(Type.SKIN, new MinecraftProfileTexture(var3.getUrl()+"?Skin="+profile.getName(),var5));
}else{
Map var5 = Maps.newHashMap();
//var5.put("model", "slim");
var2.put(Type.SKIN,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftSkins/"+profile.getName()+".png",var5));
}
if (map.containsKey(Type.CAPE)){
var2.put(Type.CAPE, new MinecraftProfileTexture(((MinecraftProfileTexture)map.get(Type.CAPE)).getUrl()+"?Cloak="+profile.getName(),null));
}else{
var2.put(Type.CAPE,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftCloaks/"+profile.getName()+".png",null));
}
map.clear();
map.putAll(var2);
//CustomSkinLoader End
Minecraft.getMinecraft().addScheduledTask(new Runnable()
{
public void run()
{
if (map.containsKey(Type.SKIN))
{
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN, skinAvailableCallback);
}
if (map.containsKey(Type.CAPE))
{
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.CAPE), Type.CAPE, skinAvailableCallback);
}
}
});
}
});
}
public Map<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile)
{
return (Map)this.skinCacheLoader.getUnchecked(profile);
}
public interface SkinAvailableCallback
{
void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture);
}
}
+97
View File
@@ -0,0 +1,97 @@
/**
* Gradle Script for COS
* It can be used to upload or download file from Tencent Cloud COS.
* COS: https://cloud.tencent.com/document/product/436
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.qcloud:cos_api:5.4.6'
}
}
import com.qcloud.cos.COSClient
import com.qcloud.cos.ClientConfig
import com.qcloud.cos.auth.BasicCOSCredentials
import com.qcloud.cos.auth.COSCredentials
import com.qcloud.cos.model.PutObjectRequest
import com.qcloud.cos.model.GetObjectRequest
import com.qcloud.cos.region.Region
String getMcVersion(String filename) {
if (filename.endsWith(".json"))
return filename.substring(0, filename.indexOf('-'))
return filename.substring(filename.indexOf('_') + 1, filename.indexOf('-'))
}
String getKey(String filename) {
String name = filename.substring(0, filename.lastIndexOf('.'))
if (name.indexOf('-') == -1) return null;
if (filename.endsWith(".json"))
return String.format(
"versions/%s/%s",
name,
filename
)
if (filename.endsWith(".jar")){
if (filename.contains("Fabric") || filename.contains("Forge")){
return String.format(
"mods/%s",
filename
)
}else{
return String.format(
"libraries/customskinloader/%s/%s/%s",
name.substring(0, name.indexOf('-')),
name.substring(name.indexOf('-') + 1),
filename
)
}
}
return filename
}
ext.bucketName = System.getenv("COS_BUCKET")
ext.cosUrl = "https://csl.littleservice.cn/"
ext.cosClient0 = null
COSClient getCosClient() {
if (cosClient0 != null) return cosClient0
COSCredentials cred = new BasicCOSCredentials(System.getenv("COS_SECRET_ID"), System.getenv("COS_SECRET_KEY"))
ClientConfig clientConfig = new ClientConfig(new Region("ap-shanghai"))
cosClient0 = new COSClient(cred, clientConfig)
}
void uploadFile(String key, File file) {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, file)
getCosClient().putObject(putObjectRequest)
}
void downloadFile(String key, File file) {
GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, key)
getCosClient().getObject(getObjectRequest, file)
}
void uploadArtifacts(String shortVersion) {
String cslversion = shortVersion.replace(".", "")
File dir = rootProject.file("build/libs")
if (!dir.isDirectory()) return
File[] files = dir.listFiles()
for (file in files) {
String key = getKey(file.getName())
if (key == null) continue;
uploadFile(key, file)
String url = cosUrl + key
String mcversion = getMcVersion(file.getName()).replace(".", "").toLowerCase()
println(String.format("csl-%s-%s\t%s", mcversion, cslversion, url))
}
}
ext {
uploadArtifacts = this.&uploadArtifacts
}
+62
View File
@@ -0,0 +1,62 @@
/**
* Gradle Script for Remap
* Designed for remapping jar.
* Remap Jar: mcp<->srg<->notch
*/
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
import net.md_5.specialsource.JarMapping
import net.md_5.specialsource.JarRemapper
import net.md_5.specialsource.provider.JarProvider
import net.md_5.specialsource.provider.JointProvider
void reobfSrgToNotch() {
def srgName = "${archivesBaseName}-${version}-srg.jar"
def notchName = srgName.replace('-srg', '')
if (config.srg_notch_map == null) {
//Default Map
def mcpName = srgName.replace('-srg', '-dev')
applySpecialSource(srgName, mcpName, getDefaultMap("srg-mcp"))
applySpecialSource(mcpName, notchName, getDefaultMap("mcp-notch"))
} else {
//Custom Map
applySpecialSource(srgName, notchName, config.srg_notch_map)
}
}
void applySpecialSource(String inputName, String outputName, String mapFile) {
def mapping = new JarMapping()
def srgFile = file(mapFile)
def inputFile = file("build/libs/${inputName}")
def outputFile = file("build/libs/${outputName}")
def remapper = new JarRemapper(null, mapping)
def inputJar = net.md_5.specialsource.Jar.init(inputFile)
def inheritanceProviders = new JointProvider()
def jarProvider = new JarProvider(inputJar)
inheritanceProviders.add(jarProvider)
mapping.loadMappings(srgFile)
mapping.setFallbackInheritanceProvider(inheritanceProviders)
remapper.remapJar(inputJar, outputFile)
}
String getDefaultMap(String srgType) {
def mcpVersion = minecraft.mappings.replace('_', "/")
return System.getProperty('user.home') + "/.gradle/caches/minecraft/de/oceanlabs/mcp/mcp_${mcpVersion}/${config.forge_mc_version}/srgs/${srgType}.srg"
}
ext {
reobfSrgToNotch = this.&reobfSrgToNotch
}
+35
View File
@@ -0,0 +1,35 @@
/**
* Gradle Script for Version
* Format Version String
*/
boolean isRelease() {
String s = rootProject.ext.config.snapshot
return s == null || s == "" || s == "0"
}
boolean isSnapshot() {
return !isRelease()
}
String getBuildNum() {
if (System.getenv("CIRCLE_BUILD_NUM") != null)
return System.getenv("CIRCLE_BUILD_NUM")
return "00"
}
//Example: 14.10a-SNAPSHOT-33
String getCSLVersion() {
return rootProject.ext.config.version + rootProject.ext.config.dev_version +
(isRelease() ? '' : ('-SNAPSHOT-' + getBuildNum()))
}
//Example: 14.10a-s33
String getShortVersion() {
return getCSLVersion().replace("SNAPSHOT-", "s")
}
ext {
getCSLVersion = this.&getCSLVersion
getShortVersion = this.&getShortVersion
}
-3
View File
@@ -1,3 +0,0 @@
Manifest-Version: 1.0
TweakClass: idv.jlchntoz.tweaker.ForgeTweaker
TweakOrder: -10
@@ -1,99 +0,0 @@
package idv.jlchntoz.tweaker;
import idv.jlchntoz.CustomSkinLoader;
import java.io.*;
import java.net.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import net.minecraft.launchwrapper.IClassTransformer;
public class ClassTransformer implements IClassTransformer {
private ZipFile zipFile = null;
public ClassTransformer() {
ForgeTweaker.logger.info("ClassTransformer Begin");
try {
URLClassLoader ucl = (URLClassLoader)idv.jlchntoz.tweaker.ClassTransformer.class.getClassLoader();
URL urls[] = ucl.getURLs();
for (int i = 0; i < urls.length; i++) {
URL url = urls[i];
ZipFile tempZipFile = getZipFile(url);
if (tempZipFile == null)
continue;
zipFile = tempZipFile;
ForgeTweaker.logger.info("Jar File URL: " + url);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
if (zipFile == null) {
ForgeTweaker.logger.info("Can not find needed JAR in the classpath.");
}
}
private static ZipFile getZipFile(URL url)
{
ZipFile zipFile0;
try {
URI uri = url.toURI();
File file = new File(uri);
zipFile0 = new ZipFile(file);
if (zipFile0.getEntry("idv/jlchntoz/tweaker/ClassTransformer.class") != null){
ForgeTweaker.logger.info("JAR Found!");
return zipFile0;
}
zipFile0.close();
} catch (Exception e) {
}
return null;
}
public byte[] transform(String name, String transformedName, byte bytes[]) {
byte diBytes[] = getClass(name);
if (diBytes != null) {
ForgeTweaker.logger.info("Class '" + name + "' transformed.");
return diBytes;
}
else
return bytes;
}
private byte[] getClass(String name) {
if (zipFile == null)
return null;
String fullName = name + ".class";
ZipEntry ze = zipFile.getEntry(fullName);
if (ze == null)
return null;
try {
InputStream in = zipFile.getInputStream(ze);
byte[] bytes = readAll(in);
if ((long)bytes.length == ze.getSize())
return bytes;
ForgeTweaker.logger.info("Failed: " + fullName + " " + bytes.length + " / " + ze.getSize());
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static byte[] readAll(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buffer[] = new byte[1024];
do {
int len = is.read(buffer);
if (len >= 0) {
baos.write(buffer, 0, len);
} else {
is.close();
byte bytes[] = baos.toByteArray();
return bytes;
}
} while (true);
}
}
@@ -1,39 +0,0 @@
package idv.jlchntoz.tweaker;
import idv.jlchntoz.MainLogger;
import java.io.File;
import java.util.List;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader;
public class ForgeTweaker implements ITweaker {
private static final File TWEAKER_LOG_FILE = new File("CustomSkinLoader/Tweaker.log");
public static MainLogger logger = new MainLogger(TWEAKER_LOG_FILE);
public ForgeTweaker() {
logger.info("Using ForgeTweaker");
}
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
logger.info("ForgeTweaker: acceptOptions");
}
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
logger.info("ForgeTweaker: injectIntoClassLoader");
classLoader.registerTransformer("idv.jlchntoz.tweaker.ClassTransformer");
logger.info("ClassTransformer Registered");
}
public String getLaunchTarget() {
logger.info("ForgeTweaker: getLaunchTarget");
return "net.minecraft.client.main.Main";
}
public String[] getLaunchArguments() {
logger.info("ForgeTweaker: getLaunchArguments");
return new String[0];
}
}
@@ -1,54 +0,0 @@
package idv.jlchntoz.tweaker;
import idv.jlchntoz.MainLogger;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader;
public class Tweaker implements ITweaker {
private List args;
private String gameDir;
private String assetsDir;
private String profile;
private static final File TWEAKER_LOG_FILE = new File("CustomSkinLoader/Tweaker.log");
public static MainLogger logger = new MainLogger(TWEAKER_LOG_FILE);
public Tweaker() {
logger.info("Using Tweaker");
}
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
logger.info("Tweaker: acceptOptions");
this.args = new ArrayList(args);
this.gameDir = gameDir.getAbsolutePath();
this.assetsDir = assetsDir.getAbsolutePath();
this.profile = profile;
}
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
logger.info("Tweaker: injectIntoClassLoader");
logger.info("Loaded as a library.");
}
public String getLaunchTarget() {
logger.info("Tweaker: getLaunchTarget");
return "net.minecraft.client.main.Main";
}
public String[] getLaunchArguments() {
logger.info("Tweaker: getLaunchArguments");
this.args.add("--gameDir");
this.args.add(gameDir);
this.args.add("--assetsDir");
this.args.add(assetsDir);
this.args.add("--version");
this.args.add(profile);
return (String[])args.toArray(new String[args.size()]);
}
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "CustomSkinLoader",
"version": "${modVersion}",
"fullVersion": "${modFullVersion}",
"mcVersion": "${mcVersion}",
"mcFullVersions": "${mcFullVersions}",
"forgeVersion": "${forgeVersion}",
"gitVersion": "${gitVersion}",
"buildUrl": "${buildUrl}"
}
+36
View File
@@ -0,0 +1,36 @@
English(en)
LICENSE - Binary File
You could not modify binary file.
Feel free to use and share this mod and unmodified file in anyway like modpack.
When using in modpack, you must put 'CustomSkinLoader' in mod list.
You could not repost this mod to any website without permission.
You could not earn money with this mod excluding modpack.
LICENSE - Source Code
GPLv3: http://www.gnu.org/licenses/gpl.html
When using the code, you should change the name of package to avoid others' misunderstanding.
OTHER - Useful Link
Source Code: https://github.com/xfl03/MCCustomSkinLoader
Release Page: http://www.mcbbs.net/thread-269807-1-1.html
Build Server: https://ci.infstudio.net/job/CustomSkinLoader/
中文简体(zh_cn)
许可 - 编译产物
您不得对CustomSkinLoader的成品jar内部内容进行任何修改
您可以在不经我许可的情况下,以任意方式传播这一mod以及jar文件(例如加入整合包)。
在加入整合包时,请必须在帖子内mod列表中明确写上"万用皮肤补丁"或者"CustomSkinLoader"或者附上发布页面地址。
您不得在未经许可的情况下,在国内外任何网站进行二次发布(包括皮肤站)。
您不得以任何形式出售CustomSkinLoader或任何使用或参考CustomSkinLoader源代码的作品。
许可 - 源代码
GPLv3: http://www.gnu.org/licenses/gpl.html
为避免他人误解,您在使用代码时必须修改包名。
其他 - 有用的链接
源代码: https://github.com/xfl03/MCCustomSkinLoader
发布页面: http://www.mcbbs.net/thread-269807-1-1.html
构建服务器: https://ci.infstudio.net/job/CustomSkinLoader/
+24
View File
@@ -0,0 +1,24 @@
{
"id": "${mcVersion}-CSL-${modShortFullVersion}",
"inheritsFrom": "${mcVersion}",
"jar": "${mcVersion}",
"releaseTime": "2013-01-02T21:10:00+08:00",
"time": "2013-01-02T21:10:00+08:00",
"type": "release",
"arguments": {
"game": [
"--tweakClass",
"customskinloader.tweaker.Tweaker"
]
},
"mainClass": "net.minecraft.launchwrapper.Launch",
"libraries": [
{
"name": "customskinloader:CustomSkinLoader_${mcVersion}:${modFullVersion}",
"url": "https://csl.littleservice.cn/libraries/"
},
{
"name": "net.minecraft:launchwrapper:1.12"
}
]
}
@@ -0,0 +1,181 @@
package customskinloader;
import java.io.File;
import java.util.Map;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import customskinloader.config.Config;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.*;
import customskinloader.profile.DynamicSkullManager;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.ProfileCache;
import customskinloader.profile.UserProfile;
import customskinloader.utils.MinecraftUtil;
/**
* Custom skin loader mod for Minecraft.
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2018
* @version @MOD_FULL_VERSION@
*/
public class CustomSkinLoader {
public static final String CustomSkinLoader_VERSION="@MOD_VERSION@";
public static final String CustomSkinLoader_FULL_VERSION="@MOD_FULL_VERSION@";
public static final File DATA_DIR=new File(MinecraftUtil.getMinecraftDataDir(),"CustomSkinLoader"),
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
CONFIG_FILE=new File(DATA_DIR,"CustomSkinLoader.json");
public static final SkinSiteProfile[] DEFAULT_LOAD_LIST={
SkinSiteProfile.createMojangAPI("Mojang"),
SkinSiteProfile.createCustomSkinAPI("LittleSkin","https://littleskin.cn/"),
SkinSiteProfile.createCustomSkinAPI("BlessingSkin","http://skin.prinzeugen.net/"),
//OneSkin has been removed temporarily
//SkinSiteProfile.createCustomSkinAPI("OneSkin","http://fleey.cn/skin/skin_user/skin_json.php/"),
//Minecrack could not load skin correctly
//SkinSiteProfile.creatLegacy("Minecrack","http://minecrack.fr.nf/mc/skinsminecrackd/{USERNAME}.png","http://minecrack.fr.nf/mc/cloaksminecrackd/{USERNAME}.png",null),
SkinSiteProfile.createElyByAPI("ElyBy"),
SkinSiteProfile.createUniSkinAPI("SkinMe","http://www.skinme.cc/uniskin/"),
SkinSiteProfile.createLegacy("LocalSkin","LocalSkin/skins/{USERNAME}.png","LocalSkin/capes/{USERNAME}.png","LocalSkin/elytras/{USERNAME}.png"),
SkinSiteProfile.createGlitchlessAPI("GlitchlessGames","https://games.glitchless.ru/api/minecraft/users/profiles/textures/?nickname=")};
public static final Gson GSON=new GsonBuilder().setPrettyPrinting().create();
public static final Logger logger=initLogger();
public static final Config config=Config.loadConfig0();
private static final ProfileCache profileCache=new ProfileCache();
private static final DynamicSkullManager dynamicSkullManager=new DynamicSkullManager();
//For User Skin
public static Map<Type, MinecraftProfileTexture> loadProfile(GameProfile gameProfile){
String username=gameProfile.getName();
String credential=MinecraftUtil.getCredential(gameProfile);
//Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713
if(username==null){
logger.warning("Could not load profile: username is null.");
return Maps.newHashMap();
}
String tempName=Thread.currentThread().getName();
Thread.currentThread().setName(username);//Change Thread Name
UserProfile profile;
if(profileCache.isReady(credential)){
logger.info("Cached profile will be used.");
profile=profileCache.getProfile(credential);
if(profile==null){
logger.warning("(!Cached Profile is empty!) Expiry:"+profileCache.getExpiry(credential));
if(profileCache.isExpired(credential))//force load
profile=loadProfile0(gameProfile);
}
else
logger.info(profile.toString(profileCache.getExpiry(credential)));
}else{
profileCache.setLoading(credential, true);
profile=loadProfile0(gameProfile);
}
Thread.currentThread().setName(tempName);
return ModelManager0.fromUserProfile(profile);
}
//Core
public static UserProfile loadProfile0(GameProfile gameProfile){
String username=gameProfile.getName();
String credential=MinecraftUtil.getCredential(gameProfile);
profileCache.setLoading(credential, true);
logger.info("Loading "+username+"'s profile.");
if(config.loadlist==null||config.loadlist.isEmpty()){
logger.info("LoadList is Empty.");
return null;
}
UserProfile profile0=new UserProfile();
for(int i=0;i<config.loadlist.size();i++){
SkinSiteProfile ssp=config.loadlist.get(i);
logger.info((i+1)+"/"+config.loadlist.size()+" Try to load profile from '"+ssp.name+"'.");
ProfileLoader.IProfileLoader loader=ProfileLoader.LOADERS.get(ssp.type.toLowerCase());
if(loader==null){
logger.info("Type '"+ssp.type+"' is not defined.");
continue;
}
UserProfile profile=null;
try{
profile=loader.loadProfile(ssp, gameProfile);
}catch(Exception e){
logger.warning("Exception occurs while loading.");
logger.warning(e);
if(e.getCause()!=null) {
logger.warning("Caused By:");
logger.warning(e.getCause());
}
}
if(profile==null)
continue;
if(!config.forceLoadAllTextures){
profile0=profile;
break;
}
profile0.mix(profile);
if(profile0.isFull())
break;
}
if(!profile0.isEmpty()){
logger.info(username+"'s profile loaded.");
if(!config.enableCape)
profile0.capeUrl = null;
profileCache.updateCache(credential, profile0);
profileCache.setLoading(credential, false);
logger.info(profile0.toString(profileCache.getExpiry(credential)));
return profile0;
}
logger.info(username+"'s profile not found in load list.");
if(config.enableLocalProfileCache){
UserProfile profile=profileCache.getLocalProfile(credential);
if(profile==null)
logger.info(username+"'s LocalProfile not found.");
else{
profileCache.updateCache(credential, profile, false);
profileCache.setLoading(credential, false);
logger.info(username+"'s LocalProfile will be used.");
logger.info(profile.toString(profileCache.getExpiry(credential)));
return profile;
}
}
profileCache.setLoading(credential, false);
return null;
}
//For Skull
public static Map<Type, MinecraftProfileTexture> loadProfileFromCache(final GameProfile gameProfile) {
String username=gameProfile.getName();
String credential=MinecraftUtil.getCredential(gameProfile);
if(username == null || credential == null)
return dynamicSkullManager.getTexture(gameProfile);
if(config.enableUpdateSkull?profileCache.isReady(credential):profileCache.isExist(credential)){
UserProfile profile=profileCache.getProfile(credential);
return ModelManager0.fromUserProfile(profile);
}
//profileCache.setLoading(username, true);
Thread loadThread=new Thread(){
public void run(){
loadProfile0(gameProfile);//Load in thread
}
};
loadThread.setName(username+"'s skull");
loadThread.start();
return Maps.newHashMap();
}
private static Logger initLogger() {
Logger logger=new Logger(LOG_FILE);
logger.info("CustomSkinLoader "+CustomSkinLoader_FULL_VERSION);
logger.info("DataDir: "+DATA_DIR.getAbsolutePath());
logger.info("Minecraft: "+MinecraftUtil.getMinecraftMainVersion()+"("+MinecraftUtil.getMinecraftVersionText()+")");
return logger;
}
}
+106
View File
@@ -0,0 +1,106 @@
package customskinloader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@SuppressWarnings("ResultOfMethodCallIgnored")
public class Logger {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public enum Level{
DEBUG("DEBUG",false),
INFO("INFO",true),
WARNING("WARNING",true);
String name;
boolean display;
Level(String name,boolean display){
this.name=name;
this.display=display;
}
public String getName(){
return name;
}
public boolean display(){
return display;
}
}
private BufferedWriter writer=null;
public Logger(){
//Logger isn't created.
}
public Logger(String logFile) {
this(new File(logFile));
}
public Logger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
System.out.println("Log Path: " + logFile.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(!level.display()&&writer==null)
return;
String sb = String.format("[%s %s] %s", Thread.currentThread().getName(), level.getName(), msg);
if(level.display())
System.out.println(sb);
if(writer==null)
return;
try {
String sb2 = String.format("[%s] %s\r\n", DATE_FORMAT.format(new Date()), sb);
writer.write(sb2);
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void debug(String msg){
log(Level.DEBUG,msg);
}
public void debug(String format, Object... objs) {
debug(String.format(format, objs));
}
public void info(String msg){
log(Level.INFO,msg);
}
public void info(String format, Object... objs){
info(String.format(format, objs));
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(String format, Object... objs){
warning(String.format(format, objs));
}
public void warning(Throwable e){
log(Level.WARNING,"Exception: "+e.toString());
StackTraceElement[] stes=e.getStackTrace();
for(StackTraceElement ste : stes){
log(Level.WARNING,ste.toString());
}
}
}
@@ -0,0 +1,192 @@
package customskinloader.config;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import customskinloader.utils.Version;
import org.apache.commons.io.FileUtils;
import customskinloader.CustomSkinLoader;
import customskinloader.loader.ProfileLoader;
import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.HttpUtil0;
@SuppressWarnings("ResultOfMethodCallIgnored")
public class Config {
//Program
public String version;
public List<SkinSiteProfile> loadlist;
//Function
public boolean enableDynamicSkull=true;
public boolean enableTransparentSkin=true;
public boolean ignoreHttpsCertificate=false;
public boolean forceLoadAllTextures=false;
public boolean enableCape = true;
//Cache
public int cacheExpiry=30;
public boolean enableUpdateSkull=false;
public boolean enableLocalProfileCache=false;
public boolean enableCacheAutoClean=false;
//Init config
public Config(SkinSiteProfile[] loadlist){
this.version=CustomSkinLoader.CustomSkinLoader_VERSION;
this.loadlist=Arrays.asList(loadlist);
}
public static Config loadConfig0() {
Config config=loadConfig();
//LoadList null checker
if(config.loadlist==null){
config.loadlist=new ArrayList<SkinSiteProfile>();
}else{
for(int i=0;i<config.loadlist.size();i++){
if(config.loadlist.get(i)==null)
config.loadlist.remove(i--);
}
}
//Init program
config.loadExtraList();
config.initLocalFolder();
if(config.ignoreHttpsCertificate)
HttpUtil0.ignoreHttpsCertificate();
if(config.enableCacheAutoClean && !config.enableLocalProfileCache){
try{
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
FileUtils.deleteDirectory(HttpTextureUtil.getCacheDir());
CustomSkinLoader.logger.info("Successfully cleaned cache.");
}catch(Exception e){
CustomSkinLoader.logger.warning("Exception occurs while cleaning cache: "+e.toString());
}
}
//Check config version
Version configVersion = Version.of(config.version);
if (configVersion.compareTo(CustomSkinLoader.CustomSkinLoader_VERSION) < 0) {
CustomSkinLoader.logger.info("Config File is out of date: " + config.version);
config.version = CustomSkinLoader.CustomSkinLoader_VERSION;
//Update some config
if (configVersion.compareTo("14.10") < 0)//Lower than 14.10
config.enableCape = true;
writeConfig(config, true);
}
//Output config
for (Field field : config.getClass().getDeclaredFields()) {
try {
Object value = field.get(config);
if (value instanceof String || value instanceof Integer || value instanceof Boolean)
CustomSkinLoader.logger.info(field.getName() + " : " + value);
} catch (Exception ignored) { }
}
CustomSkinLoader.logger.info("loadList : " + (config.loadlist == null ? 0 : config.loadlist.size()));
return config;
}
private static Config loadConfig() {
CustomSkinLoader.logger.info("Config File: "+CustomSkinLoader.CONFIG_FILE.getAbsolutePath());
if(!CustomSkinLoader.CONFIG_FILE.exists()){
CustomSkinLoader.logger.info("Config file not found, use default instead.");
return initConfig();
}
try {
CustomSkinLoader.logger.info("Try to load config.");
String json=FileUtils.readFileToString(CustomSkinLoader.CONFIG_FILE, "UTF-8");
Config config=CustomSkinLoader.GSON.fromJson(json, Config.class);
CustomSkinLoader.logger.info("Successfully load config.");
return config;
}catch (Exception e) {
CustomSkinLoader.logger.info("Failed to load config, use default instead.("+e.toString()+")");
File brokenFile=new File(CustomSkinLoader.DATA_DIR,"BROKEN-CustomSkinLoader.json");
if(brokenFile.exists())
brokenFile.delete();
CustomSkinLoader.CONFIG_FILE.renameTo(brokenFile);
return initConfig();
}
}
private void loadExtraList(){
File listAddition=new File(CustomSkinLoader.DATA_DIR,"ExtraList");
if(!listAddition.isDirectory()){
listAddition.mkdirs();
return;
}
List<SkinSiteProfile> adds=new ArrayList<SkinSiteProfile>();
File[] files=listAddition.listFiles();
for(File file: files != null ? files : new File[0]){
if(!file.getName().toLowerCase().endsWith(".json")&&!file.getName().toLowerCase().endsWith(".txt"))
continue;
try {
CustomSkinLoader.logger.info("Try to load Extra List.("+file.getName()+")");
String json=FileUtils.readFileToString(file, "UTF-8");
SkinSiteProfile ssp=CustomSkinLoader.GSON.fromJson(json, SkinSiteProfile.class);
CustomSkinLoader.logger.info("Successfully load Extra List.");
file.delete();
ProfileLoader.IProfileLoader loader=ProfileLoader.LOADERS.get(ssp.type.toLowerCase());
if(loader==null){
CustomSkinLoader.logger.info("Extra List will be ignore: Type '"+ssp.type+"' is not defined.");
continue;
}
boolean duplicate=false;
for(SkinSiteProfile ssp0:this.loadlist){
if(!ssp0.type.equalsIgnoreCase(ssp.type))
continue;
if(loader.compare(ssp0, ssp)){
duplicate=true;
break;
}
}
if(!duplicate){
adds.add(ssp);
CustomSkinLoader.logger.info("Successfully apply Extra List.("+ssp.name+")");
}else{
CustomSkinLoader.logger.info("Extra List will be ignore: Duplicate.("+ssp.name+")");
}
}catch (Exception e) {
CustomSkinLoader.logger.info("Failed to load Extra List.("+e.toString()+")");
}
}
if(adds.size()!=0){
adds.addAll(this.loadlist);
this.loadlist=adds;
writeConfig(this,true);
}
}
private void initLocalFolder(){
for(SkinSiteProfile ssp:this.loadlist){
ProfileLoader.IProfileLoader loader=ProfileLoader.LOADERS.get(ssp.type.toLowerCase());
if(loader==null)
continue;
loader.initLocalFolder(ssp);
}
}
private static Config initConfig() {
Config config=new Config(CustomSkinLoader.DEFAULT_LOAD_LIST);
writeConfig(config,false);
return config;
}
private static void writeConfig(Config config,boolean update){
String json=CustomSkinLoader.GSON.toJson(config);
if(CustomSkinLoader.CONFIG_FILE.exists())
CustomSkinLoader.CONFIG_FILE.delete();
try {
CustomSkinLoader.CONFIG_FILE.createNewFile();
FileUtils.write(CustomSkinLoader.CONFIG_FILE, json, "UTF-8");
CustomSkinLoader.logger.info("Successfully "+(update?"update":"create")+" config.");
} catch (Exception e) {
CustomSkinLoader.logger.info("Failed to "+(update?"update":"create")+" config.("+e.toString()+")");
}
}
}
@@ -0,0 +1,70 @@
package customskinloader.config;
public class SkinSiteProfile {
public String name;
public String type;
public String userAgent;
public String root;
public Boolean checkPNG;//Not suitable for local skin
public String skin;
public String model;
public String cape;
public String elytra;
public static SkinSiteProfile createMojangAPI(String name){
SkinSiteProfile ssp=new SkinSiteProfile();
ssp.name=name;
ssp.type="MojangAPI";
return ssp;
}
public static SkinSiteProfile createCustomSkinAPI(String name,String root){
SkinSiteProfile ssp=new SkinSiteProfile();
ssp.name=name;
ssp.type="CustomSkinAPI";
ssp.root=root;
return ssp;
}
public static SkinSiteProfile creatCustomSkinAPIPlus(String name,String root){
SkinSiteProfile ssp=new SkinSiteProfile();
ssp.name=name;
ssp.type="CustomSkinAPIPlus";
ssp.root=root;
return ssp;
}
public static SkinSiteProfile createGlitchlessAPI(String name, String root) {
SkinSiteProfile ssp = new SkinSiteProfile();
ssp.name = name;
ssp.type = "GlitchlessAPI";
ssp.root = root;
return ssp;
}
public static SkinSiteProfile createUniSkinAPI(String name, String root) {
SkinSiteProfile ssp = new SkinSiteProfile();
ssp.name = name;
ssp.type = "UniSkinAPI";
ssp.root = root;
return ssp;
}
public static SkinSiteProfile createLegacy(String name,String skin,String cape,String elytra){
SkinSiteProfile ssp=new SkinSiteProfile();
ssp.name=name;
ssp.type="Legacy";
ssp.checkPNG=false;
ssp.skin=skin;
ssp.model="auto";
ssp.cape=cape;
ssp.elytra=elytra;
return ssp;
}
public static SkinSiteProfile createElyByAPI(String name) {
SkinSiteProfile ssp = new SkinSiteProfile();
ssp.name = name;
ssp.type = "ElyByAPI";
return ssp;
}
}
@@ -0,0 +1,89 @@
package customskinloader.fake;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import customskinloader.CustomSkinLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
public class FakeClientPlayer {
//For Legacy Skin
public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) {
//CustomSkinLoader.logger.debug("FakeClientPlayer/getDownloadImageSkin "+username);
TextureManager textman = Minecraft.getMinecraft().getTextureManager();
ITextureObject ito = textman.getTexture(resourceLocationIn);
if (ito == null || !(ito instanceof ThreadDownloadImageData)) {
//if Legacy Skin for username not loaded yet
SkinManager skinman = Minecraft.getMinecraft().getSkinManager();
UUID offlineUUID = getOfflineUUID(username);
GameProfile offlineProfile = new GameProfile(offlineUUID, username);
//Load Default Skin
ResourceLocation defaultSkin = DefaultPlayerSkin.getDefaultSkin(offlineUUID);
ITextureObject defaultSkinObj = new SimpleTexture(defaultSkin);
textman.loadTexture(resourceLocationIn, defaultSkinObj);
//Load Skin from SkinManager
skinman.loadProfileTextures(offlineProfile, new LegacyBuffer(resourceLocationIn), false);
}
if (ito instanceof ThreadDownloadImageData)
return (ThreadDownloadImageData) ito;
else
return null;
}
public static ResourceLocation getLocationSkin(String username) {
//CustomSkinLoader.logger.debug("FakeClientPlayer/getLocationSkin "+username);
return new ResourceLocation("skins/legacy-" + StringUtils.stripControlCodes(username));
}
public static UUID getOfflineUUID(String username)
{
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes());
}
public static Map<ResourceLocation, ITextureObject> textureCache = Maps.newHashMap();
public static class LegacyBuffer implements SkinAvailableCallback {
ResourceLocation resourceLocationIn;
boolean loaded = false;
public LegacyBuffer(ResourceLocation resourceLocationIn) {
CustomSkinLoader.logger.debug("Loading Legacy Texture (" + resourceLocationIn + ")");
this.resourceLocationIn = resourceLocationIn;
}
@Override
public void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
if (typeIn != Type.SKIN || loaded)
return;
TextureManager textman = Minecraft.getMinecraft().getTextureManager();
ITextureObject ito = textman.getTexture(location);
if (ito == null)
ito = textureCache.get(location);
if (ito == null)
return;
loaded = true;
textman.loadTexture(resourceLocationIn, ito);
CustomSkinLoader.logger.debug("Legacy Texture (" + resourceLocationIn + ") Loaded as " +
ito.toString() + " (" + location + ")");
}
}
}
@@ -0,0 +1,151 @@
package customskinloader.fake;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.texture.FakeBufferedImage;
import customskinloader.fake.texture.FakeImage;
import customskinloader.fake.texture.FakeNativeImage;
import java.awt.image.BufferedImage;
public class FakeSkinBuffer implements net.minecraft.client.renderer.IImageBuffer {
private int ratio = 1;
private FakeImage image = null;
//parseUserSkin for 1.13+
public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image) {
if (image == null)
return null;
FakeImage img = parseUserSkin(new FakeNativeImage(image));
if (img instanceof FakeNativeImage)
return ((FakeNativeImage) img).getImage();
CustomSkinLoader.logger.warning("Failed to parseUserSkin(func_195786_a).");
return null;
}
//parseUserSkin for 1.12.2-
public BufferedImage parseUserSkin(BufferedImage image) {
if (image == null)
return null;
FakeImage img = parseUserSkin(new FakeBufferedImage(image));
if (img instanceof FakeBufferedImage)
return ((FakeBufferedImage) img).getImage();
CustomSkinLoader.logger.warning("Failed to parseUserSkin.");
return null;
}
public FakeImage parseUserSkin(FakeImage image) {
if (image == null) return null;
this.ratio = image.getWidth() / 64;
if (image.getHeight() != image.getWidth()) {//Single Layer
//Create a new image and copy origin image data
FakeImage img = image.createImage(64 * ratio, 64 * ratio);
img.copyImageData(image); image.close(); image = img;
image.fillArea(0 * ratio, 32 * ratio, 64 * ratio, 32 * ratio);
//Right Leg -> Left Leg
image.copyArea( 4 * ratio, 16 * ratio, 16 * ratio, 32 * ratio, 4 * ratio, 4 * ratio, true, false);//Top
image.copyArea( 8 * ratio, 16 * ratio, 16 * ratio, 32 * ratio, 4 * ratio, 4 * ratio, true, false);//Bottom
image.copyArea( 0 * ratio, 20 * ratio, 24 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Right
image.copyArea( 4 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Front
image.copyArea( 8 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Left
image.copyArea(12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Back
//Right Arm -> Left Arm
image.copyArea(44 * ratio, 16 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 4 * ratio, true, false);//Top
image.copyArea(48 * ratio, 16 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 4 * ratio, true, false);//Bottom
image.copyArea(40 * ratio, 20 * ratio, 0 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Right
image.copyArea(44 * ratio, 20 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Front
image.copyArea(48 * ratio, 20 * ratio,-16 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Left
image.copyArea(52 * ratio, 20 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Back
}
this.image = image;
setAreaDueToConfig( 0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio);//Head - 1
setAreaTransparent(32 * ratio, 0 * ratio, 64 * ratio, 16 * ratio);//Head - 2
setAreaDueToConfig(16 * ratio, 16 * ratio, 40 * ratio, 32 * ratio);//Body - 1
setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);//Body - 2
setAreaDueToConfig(40 * ratio, 16 * ratio, 56 * ratio, 32 * ratio);//Right Arm - 1
setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);//Right Arm - 2
setAreaDueToConfig( 0 * ratio, 16 * ratio, 16 * ratio, 32 * ratio);//Right Leg - 1
setAreaTransparent( 0 * ratio, 32 * ratio, 16 * ratio, 48 * ratio);//Right Leg - 2
setAreaDueToConfig(32 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);//Left Arm - 1
setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);//Left Arm - 2
setAreaDueToConfig(16 * ratio, 48 * ratio, 32 * ratio, 64 * ratio);//Left Leg - 1
setAreaTransparent( 0 * ratio, 48 * ratio, 16 * ratio, 64 * ratio);//Left Leg - 2
return image;
}
/**
* Judge the type of skin
* Must be called after parseUserSkin
*
* @return type of skin (slim / default)
* @since 14.9
*/
public String judgeType() {
if (this.image == null)
return null;
if (((image.getRGBA(55 * ratio, 20 * ratio) & B) >>> 24) == 0)//if (55,20) is transparent
return "slim";
return "default";
}
/* 2^24-1
* 00000000 11111111 11111111 11111111 */
private static final int A = 16777215;
private static final int WHITE = getARGB(255, 255, 255, 255);
private static final int BLACK = getARGB(255, 0, 0, 0);
private boolean isFilled(int x0, int y0, int x1, int y1) {
int data = image.getRGBA(x0, y0);
if (data != WHITE && data != BLACK)
return false;
for (int x = x0; x < x1; ++x)
for (int y = y0; y < y1; ++y)
if (image.getRGBA(x, y) != data)
return false;
return true;
}
private void setAreaTransparent(int x0, int y0, int x1, int y1) {
if (!isFilled(x0, y0, x1, y1))
return;
for (int x = x0; x < x1; ++x)
for (int y = y0; y < y1; ++y)
image.setRGBA(x, y, image.getRGBA(x,y) & A);
}
/* -2^24
* 00000001 00000000 00000000 00000000 ->
* 11111110 11111111 11111111 11111111 ->
* 11111111 00000000 00000000 00000000 */
private static final int B = -16777216;
private void setAreaOpaque(int x0, int y0, int x1, int y1) {
for (int x = x0; x < x1; ++x)
for (int y = y0; y < y1; ++y)
image.setRGBA(x, y, image.getRGBA(x,y) | B);
}
private void setAreaDueToConfig(int x0, int y0, int x1, int y1) {
if (customskinloader.CustomSkinLoader.config.enableTransparentSkin)
setAreaTransparent(x0, y0, x1, y1);
else
setAreaOpaque(x0, y0, x1, y1);
}
public void skinAvailable() {
//A callback when skin loaded, nothing to do
}
private static int getARGB(int a, int r, int g, int b) {
return (a << 24) | (r << 16) | (g << 8) | b;
}
}
@@ -0,0 +1,129 @@
package customskinloader.fake;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.HttpTextureUtil.HttpTextureInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
import net.minecraft.util.ResourceLocation;
public class FakeSkinManager {
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>());
private final TextureManager textureManager;
public FakeSkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) {
this.textureManager = textureManagerInstance;
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
}
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type textureType) {
return this.loadSkin(profileTexture, textureType, null);
}
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, final SkinAvailableCallback skinAvailableCallback) {
HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
if (itextureobject != null)//Have already loaded
makeCallback(skinAvailableCallback, textureType, resourcelocation, profileTexture);
else {
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(),
new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture));
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer)//Cache for client player
FakeClientPlayer.textureCache.put(resourcelocation, threaddownloadimagedata);
this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata);
}
return resourcelocation;
}
public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) {
THREAD_POOL.submit(new Runnable() {
public void run() {
final Map<Type, MinecraftProfileTexture> map = Maps.newHashMap();
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
public void run() {
for (Type type : Type.values()) {
if (map.containsKey(type)) {
CustomSkinLoader.logger.debug("Loading type:" + type);
FakeSkinManager.this.loadSkin(map.get(type), type, skinAvailableCallback);
}
}
}
});
}
});
}
public Map<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
return CustomSkinLoader.loadProfileFromCache(profile);
}
private static void makeCallback(SkinAvailableCallback callback, Type type, ResourceLocation location, MinecraftProfileTexture texture) {
if (callback != null)
callback.skinAvailable(type, location, texture);
}
private class BaseBuffer implements IImageBuffer {
private IImageBuffer buffer;
private SkinAvailableCallback callback;
private Type type;
private ResourceLocation location;
private MinecraftProfileTexture texture;
public BaseBuffer(SkinAvailableCallback callback, Type type, ResourceLocation location, MinecraftProfileTexture texture) {
this.buffer = (type == Type.SKIN ? new FakeSkinBuffer() : null);
this.callback = callback;
this.type = type;
this.location = location;
this.texture = texture;
}
public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image) {
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image;
}
public BufferedImage parseUserSkin(BufferedImage image) {
return buffer == null ? image : buffer.parseUserSkin(image);
}
public void skinAvailable() {
if (buffer != null) {
buffer.skinAvailable();
if ("auto".equals(texture.getMetadata("model")) && buffer instanceof FakeSkinBuffer) {
//Auto judge skin type
Map<String, String> metadata = Maps.newHashMap();
metadata.put("model", ((FakeSkinBuffer) buffer).judgeType());
texture = new MinecraftProfileTexture(texture.getUrl(), metadata);
}
}
FakeSkinManager.makeCallback(callback, type, location, texture);
}
}
}
@@ -0,0 +1,67 @@
package customskinloader.fake.texture;
import java.awt.*;
import java.awt.image.BufferedImage;
public class FakeBufferedImage implements FakeImage {
private BufferedImage image;
private Graphics graphics;
public FakeBufferedImage(int width, int height) {
this(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB));
}
public FakeBufferedImage(BufferedImage image) {
this.image = image;
graphics = image.getGraphics();
}
public BufferedImage getImage() {
graphics.dispose();
return image;
}
public FakeImage createImage(int width, int height) {
return new FakeBufferedImage(width, height);
}
public int getWidth() {
return image.getWidth();
}
public int getHeight() {
return image.getHeight();
}
public int getRGBA(int x, int y) {
return image.getRGB(x, y);
}
public void setRGBA(int x, int y, int rgba) {
image.setRGB(x, y, rgba);
}
public void copyImageData(FakeImage image) {
if (!(image instanceof FakeBufferedImage)) return;
BufferedImage img = ((FakeBufferedImage) image).getImage();
graphics.drawImage(img, 0, 0, null);
}
public void fillArea(int x0, int y0, int width, int height) {
graphics.setColor(new Color(0, 0, 0, 0));
graphics.fillRect(x0, y0, width, height);
}
public void copyArea(int x0, int y0, int dx, int dy, int width, int height, boolean reversex, boolean reversey) {
int x1 = x0 + width, x2 = x0 + dx, x3 = x2 + width;
int y1 = y0 + height, y2 = y0 + dy, y3 = y2 + height;
graphics.drawImage(image,
reversex ? x3 : x2, reversey ? y3 : y2,
reversex ? x2 : x3, reversey ? y2 : y3,
x0, y0, x1, y1, null);
}
public void close() {
graphics.dispose();
}
}
@@ -0,0 +1,21 @@
package customskinloader.fake.texture;
public interface FakeImage {
FakeImage createImage(int width, int height);
int getWidth();
int getHeight();
int getRGBA(int x, int y);
void setRGBA(int x, int y, int rgba);
void copyImageData(FakeImage image);
void fillArea(int x0, int y0, int width, int height);
void copyArea(int x0, int y0, int dx, int dy, int width, int height, boolean reversex, boolean reversey);
void close();
}
@@ -0,0 +1,55 @@
package customskinloader.fake.texture;
import net.minecraft.client.renderer.texture.NativeImage;
public class FakeNativeImage implements FakeImage {
private NativeImage image;
public FakeNativeImage(int width, int height) {
this(new NativeImage(width, height, true));
}
public FakeNativeImage(NativeImage image) {
this.image = image;
}
public NativeImage getImage() {
return image;
}
public FakeImage createImage(int width, int height) {
return new FakeNativeImage(width, height);
}
public int getWidth() {
return image.func_195702_a();
}
public int getHeight() {
return image.func_195714_b();
}
public int getRGBA(int x, int y) {
return image.func_195709_a(x, y);
}
public void setRGBA(int x, int y, int rgba) {
image.func_195700_a(x, y, rgba);
}
public void copyImageData(FakeImage image) {
if (!(image instanceof FakeNativeImage)) return;
this.image.func_195703_a(((FakeNativeImage) image).getImage());
}
public void fillArea(int x0, int y0, int width, int height) {
image.func_195715_a(x0, y0, width, height, 0);
}
public void copyArea(int x0, int y0, int dx, int dy, int width, int height, boolean reversex, boolean reversey) {
image.func_195699_a(x0, y0, dx, dy, width, height, reversex, reversey);
}
public void close() {
}
}
@@ -0,0 +1,106 @@
package customskinloader.loader;
import java.io.File;
import java.io.FileInputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import com.mojang.authlib.GameProfile;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.jsonapi.*;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpUtil0;
import customskinloader.utils.HttpRequestUtil.HttpRequest;
import customskinloader.utils.HttpRequestUtil.HttpResponce;
public class JsonAPILoader implements ProfileLoader.IProfileLoader {
public interface IJsonAPI {
String toJsonUrl(String root, String username);
String getPayload(SkinSiteProfile ssp);
UserProfile toUserProfile(String root, String json, boolean local);
String getName();
}
public static class ErrorProfile{
public int errno;
public String msg;
}
public enum Type{
CustomSkinAPI(new CustomSkinAPI()),
CustomSkinAPIPlus(new CustomSkinAPIPlus()),
UniSkinAPI(new UniSkinAPI()),
ElyByAPI(new ElyByAPI()),
GlitchlessAPI(new GlitchlessAPI());
public IJsonAPI jsonAPI;
Type(IJsonAPI jsonAPI){
this.jsonAPI=jsonAPI;
}
}
private Type type;
public JsonAPILoader(Type type){
this.type=type;
}
@Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
String username=gameProfile.getName();
if(StringUtils.isEmpty(ssp.root) && type!=Type.ElyByAPI){
CustomSkinLoader.logger.info("Root not defined.");
return null;
}
boolean local = HttpUtil0.isLocal(ssp.root);
String jsonUrl=type.jsonAPI.toJsonUrl(ssp.root, username);
String json;
if(local){
File jsonFile = new File(CustomSkinLoader.DATA_DIR, jsonUrl);
if(!jsonFile.exists()){
CustomSkinLoader.logger.info("Profile File not found.");
return null;
}
json=IOUtils.toString(new FileInputStream(jsonFile), "UTF-8");
}else{
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(jsonUrl).setCacheTime(90).setUserAgent(ssp.userAgent).setPayload(type.jsonAPI.getPayload(ssp)));
json=responce.content;
}
if(json==null||json.equals("")){
CustomSkinLoader.logger.info("Profile not found.");
return null;
}
ErrorProfile profile=CustomSkinLoader.GSON.fromJson(json, ErrorProfile.class);
if(profile.errno!=0){
CustomSkinLoader.logger.info("Error "+profile.errno+": "+profile.msg);
return null;
}
UserProfile p=type.jsonAPI.toUserProfile(ssp.root, json, local);
if(p==null||p.isEmpty()){
CustomSkinLoader.logger.info("Both skin and cape not found.");
return null;
}else{
return p;
}
}
@Override
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
return !StringUtils.isNoneEmpty(ssp0.root) || ssp0.root.equalsIgnoreCase(ssp1.root);
}
@Override
public String getName() {
return type.jsonAPI.getName();
}
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
public void initLocalFolder(SkinSiteProfile ssp) {
if(HttpUtil0.isLocal(ssp.root)){
File f=new File(ssp.root);
if(!f.exists())
f.mkdirs();
}
}
}
@@ -0,0 +1,95 @@
package customskinloader.loader;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import com.mojang.authlib.GameProfile;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpRequestUtil.HttpRequest;
import customskinloader.utils.HttpRequestUtil.HttpResponce;
import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.HttpUtil0;
public class LegacyLoader implements ProfileLoader.IProfileLoader {
public static final String USERNAME_PLACEHOLDER="{USERNAME}";
@Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
String username=gameProfile.getName();
UserProfile profile=new UserProfile();
if(StringUtils.isNoneEmpty(ssp.skin)){
String skin=ssp.skin.replace(USERNAME_PLACEHOLDER, username);
if(HttpUtil0.isLocal(ssp.skin)){
File skinFile=new File(CustomSkinLoader.DATA_DIR,skin);
if(skinFile.exists()&&skinFile.isFile())
profile.skinUrl=HttpTextureUtil.getLocalLegacyFakeUrl(skin, HttpTextureUtil.getHash(skin, skinFile.length(), skinFile.lastModified()));
}else{
HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null && ssp.checkPNG).setLoadContent(false).setCacheTime(90));
if(responce.success)
profile.skinUrl=HttpTextureUtil.getLegacyFakeUrl(skin);
}
profile.model=profile.hasSkinUrl()?ssp.model:null;
}
if(StringUtils.isNoneEmpty(ssp.cape)){
String cape=ssp.cape.replace(USERNAME_PLACEHOLDER, username);
if(HttpUtil0.isLocal(ssp.cape)){
File capeFile=new File(CustomSkinLoader.DATA_DIR,cape);
if(capeFile.exists()&&capeFile.isFile())
profile.capeUrl=HttpTextureUtil.getLocalLegacyFakeUrl(cape, HttpTextureUtil.getHash(cape, capeFile.length(), capeFile.lastModified()));
}else{
HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequest(cape).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null && ssp.checkPNG).setLoadContent(false).setCacheTime(90));
if(responce.success)
profile.capeUrl=HttpTextureUtil.getLegacyFakeUrl(cape);
}
}
if(ModelManager0.isElytraSupported()&&StringUtils.isNoneEmpty(ssp.elytra)){
String elytra=ssp.elytra.replace(USERNAME_PLACEHOLDER, username);
if(HttpUtil0.isLocal(ssp.elytra)){
File elytraFile=new File(CustomSkinLoader.DATA_DIR,elytra);
if(elytraFile.exists()&&elytraFile.isFile())
profile.elytraUrl=HttpTextureUtil.getLocalLegacyFakeUrl(elytra, HttpTextureUtil.getHash(elytra, elytraFile.length(), elytraFile.lastModified()));
}else{
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(elytra).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null && ssp.checkPNG).setLoadContent(false).setCacheTime(90));
if(responce.success)
profile.elytraUrl=HttpTextureUtil.getLegacyFakeUrl(elytra);
}
}
if(profile.isEmpty()){
CustomSkinLoader.logger.info("Both skin and cape not found.");
return null;
}
return profile;
}
@Override
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
return (!StringUtils.isNoneEmpty(ssp0.skin) || ssp0.skin.equalsIgnoreCase(ssp1.skin)) || (!StringUtils.isNoneEmpty(ssp0.cape) || ssp0.cape.equalsIgnoreCase(ssp1.cape));
}
@Override
public String getName() {
return "Legacy";
}
@Override
public void initLocalFolder(SkinSiteProfile ssp) {
if(HttpUtil0.isLocal(ssp.skin))
initFolder(ssp.skin);
if(HttpUtil0.isLocal(ssp.cape))
initFolder(ssp.cape);
if(HttpUtil0.isLocal(ssp.elytra))
initFolder(ssp.elytra);
}
@SuppressWarnings("ResultOfMethodCallIgnored")
private void initFolder(String target){
String file=target.replace(USERNAME_PLACEHOLDER, "init");
File folder=new File(CustomSkinLoader.DATA_DIR,file).getParentFile();
if(folder!=null&&!folder.exists())
folder.mkdirs();
}
}
@@ -0,0 +1,121 @@
package customskinloader.loader;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.Maps;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Iterables;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import com.mojang.util.UUIDTypeAdapter;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpRequestUtil.HttpRequest;
import customskinloader.utils.HttpRequestUtil.HttpResponce;
import customskinloader.utils.MinecraftUtil;
public class MojangAPILoader implements ProfileLoader.IProfileLoader {
public static final MinecraftSessionService defaultSessionService=MinecraftUtil.getSessionService();
@Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
Map<MinecraftProfileTexture.Type,MinecraftProfileTexture> map=getTextures(gameProfile);
if(!map.isEmpty()){
CustomSkinLoader.logger.info("Default profile will be used.");
return ModelManager0.toUserProfile(map);
}
String username=gameProfile.getName();
GameProfile newGameProfile=loadGameProfile(username);
if(newGameProfile==null){
CustomSkinLoader.logger.info("Profile not found.("+username+"'s profile not found.)");
return null;
}
newGameProfile=fillGameProfile(newGameProfile);
map=getTextures(newGameProfile);
if(!map.isEmpty()){
gameProfile.getProperties().putAll(newGameProfile.getProperties());
return ModelManager0.toUserProfile(map);
}
CustomSkinLoader.logger.info("Profile not found.("+username+" doesn't have skin/cape.)");
return null;
}
//Username -> UUID
public static GameProfile loadGameProfile(String username) {
//Doc (http://wiki.vg/Mojang_API#Username_-.3E_UUID_at_time)
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest("https://api.mojang.com/users/profiles/minecraft/"+username).setCacheTime(0));
if(StringUtils.isEmpty(responce.content))
return null;
Gson gson=new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
GameProfile gameProfile=gson.fromJson(responce.content, GameProfile.class);
if(gameProfile.getId()==null)
return null;
return new GameProfile(gameProfile.getId(),gameProfile.getName());
}
//UUID -> Profile
public static GameProfile fillGameProfile(GameProfile profile) {
//Doc (http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape)
HttpResponce responce = HttpRequestUtil.makeHttpRequest(
new HttpRequest("https://sessionserver.mojang.com/session/minecraft/profile/"
+ UUIDTypeAdapter.fromUUID(profile.getId())).setCacheTime(90));
if(StringUtils.isEmpty(responce.content))
return profile;
Gson gson=new GsonBuilder()
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer())
.create();
MinecraftProfilePropertiesResponse propertiesResponce=gson.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
GameProfile newGameProfile=new GameProfile(propertiesResponce.getId(),propertiesResponce.getName());
newGameProfile.getProperties().putAll(propertiesResponce.getProperties());
return newGameProfile;
}
public static Map<MinecraftProfileTexture.Type,MinecraftProfileTexture> getTextures(GameProfile gameProfile) {
if(gameProfile==null)
return Maps.newHashMap();
Property textureProperty=Iterables.getFirst(gameProfile.getProperties().get("textures"), null);
if (textureProperty==null)
return Maps.newHashMap();
String value=textureProperty.getValue();
if(StringUtils.isBlank(value))
return Maps.newHashMap();
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
Gson gson=new GsonBuilder().registerTypeAdapter(UUID.class,new UUIDTypeAdapter()).create();
MinecraftTexturesPayload result=gson.fromJson(json,MinecraftTexturesPayload.class);
if (result==null||result.getTextures()==null)
return Maps.newHashMap();
return result.getTextures();
}
@Override
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
return true;
}
@Override
public String getName() {
return "MojangAPI";
}
@Override
public void initLocalFolder(SkinSiteProfile ssp) {
}
}
@@ -0,0 +1,38 @@
package customskinloader.loader;
import java.util.HashMap;
import com.mojang.authlib.GameProfile;
import customskinloader.config.SkinSiteProfile;
import customskinloader.plugin.PluginLoader;
import customskinloader.profile.UserProfile;
public class ProfileLoader {
private static final IProfileLoader[] DEFAULT_LOADERS={
new MojangAPILoader(),
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPI),
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPIPlus),
new JsonAPILoader(JsonAPILoader.Type.UniSkinAPI),
new JsonAPILoader(JsonAPILoader.Type.ElyByAPI),
new JsonAPILoader(JsonAPILoader.Type.GlitchlessAPI),
new LegacyLoader()};
public static final HashMap<String,IProfileLoader> LOADERS=initLoaders();
private static HashMap<String, IProfileLoader> initLoaders() {
HashMap<String, IProfileLoader> loaders=new HashMap<String, IProfileLoader>();
for(IProfileLoader loader:DEFAULT_LOADERS){
loaders.put(loader.getName().toLowerCase(), loader);
}
loaders.putAll(PluginLoader.loadPlugins());
return loaders;
}
public interface IProfileLoader {
UserProfile loadProfile(SkinSiteProfile ssp,GameProfile gameProfile) throws Exception;
boolean compare(SkinSiteProfile ssp0,SkinSiteProfile ssp1);
String getName();
void initLocalFolder(SkinSiteProfile ssp);
}
}
@@ -0,0 +1,90 @@
package customskinloader.loader.jsonapi;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader.IJsonAPI;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.ModelManager0.Model;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpTextureUtil;
public class CustomSkinAPI implements IJsonAPI {
private static final String TEXTURES="textures/";
private static final String SUFFIX=".json";
@Override
public String toJsonUrl(String root, String username) {
return root + username + SUFFIX;
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
CustomSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class);
UserProfile p=new UserProfile();
if(StringUtils.isNotBlank(profile.skin)){
p.skinUrl=root+TEXTURES+profile.skin;
if(local)
p.skinUrl=HttpTextureUtil.getLocalFakeUrl(p.skinUrl);
}
if(StringUtils.isNotBlank(profile.cape)){
p.capeUrl=root+TEXTURES+profile.cape;
if(local)
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
}
if(StringUtils.isNotBlank(profile.elytra)){
p.elytraUrl=root+TEXTURES+profile.elytra;
if(local)
p.elytraUrl=HttpTextureUtil.getLocalFakeUrl(p.elytraUrl);
}
Map<String,String> textures=new LinkedHashMap<String,String>();
if(profile.skins!=null)
textures.putAll(profile.skins);
if(profile.textures!=null)
textures.putAll(profile.textures);
if(textures.isEmpty())
return p;
boolean hasSkin=false;
for(String model:textures.keySet()){
Model enumModel=ModelManager0.getEnumModel(model);
if(enumModel==null||StringUtils.isEmpty(textures.get(model)))
continue;
if(ModelManager0.isSkin(enumModel))
if(hasSkin)
continue;
else
hasSkin=true;
String url=root+TEXTURES+textures.get(model);
if(local)
url=HttpTextureUtil.getLocalFakeUrl(url);
p.put(enumModel, url);
}
return p;
}
private class CustomSkinAPIProfile{
public String username;
public LinkedHashMap<String,String> textures;
public LinkedHashMap<String,String> skins;
public String skin;
public String cape;
public String elytra;
}
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override
public String getName() {
return "CustomSkinAPI";
}
}
@@ -0,0 +1,70 @@
package customskinloader.loader.jsonapi;
import java.io.File;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import com.google.gson.Gson;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader;
import customskinloader.loader.JsonAPILoader.IJsonAPI;
import customskinloader.profile.UserProfile;
import customskinloader.utils.MinecraftUtil;
public class CustomSkinAPIPlus implements IJsonAPI {
private static String clientID=null;
public CustomSkinAPIPlus(){
File clientIDFile=new File(CustomSkinLoader.DATA_DIR,"CustomSkinAPIPlus-ClientID");
if(clientIDFile.isFile())
try{
clientID=FileUtils.readFileToString(clientIDFile, "UTF-8");
}catch(Exception e){
e.printStackTrace();
}
if(clientID==null){
clientID=UUID.randomUUID().toString();
try {
FileUtils.write(clientIDFile, clientID, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public String toJsonUrl(String root, String username) {
return JsonAPILoader.Type.CustomSkinAPI.jsonAPI.toJsonUrl(root, username);
}
@Override
public String getPayload(SkinSiteProfile ssp) {
return new Gson().toJson(new CustomSkinAPIPlusPayload());
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
return JsonAPILoader.Type.CustomSkinAPI.jsonAPI.toUserProfile(root, json, local);
}
@Override
public String getName() {
return "CustomSKinAPIPlus";
}
public static class CustomSkinAPIPlusPayload{
String gameVersion;//minecraft version
String modVersion;//mod version
String serverAddress;//ip:port
String clientID;//Minecraft Client ID
CustomSkinAPIPlusPayload(){
gameVersion = MinecraftUtil.getMinecraftMainVersion();
modVersion = CustomSkinLoader.CustomSkinLoader_VERSION;
serverAddress = MinecraftUtil.isLanServer() ? null : MinecraftUtil.getStandardServerAddress();
clientID = CustomSkinAPIPlus.clientID;
}
}
}
@@ -0,0 +1,50 @@
package customskinloader.loader.jsonapi;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.utils.MinecraftUtil;
import java.net.URI;
import java.util.Map;
public class ElyByAPI implements JsonAPILoader.IJsonAPI {
@Override
public String toJsonUrl(String root, String username) {
return "http://skinsystem.ely.by/textures/" + username + "?version=2&minecraft_version=" + MinecraftUtil.getMinecraftMainVersion();
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
Map<Type, MinecraftProfileTexture> result = new Gson().fromJson(json, new TypeToken<Map<Type, MinecraftProfileTexture>>() {
}.getType());
if (!result.containsKey(Type.SKIN))
return null;
//Check URL
try {
URI uri = new URI(result.get(Type.SKIN).getUrl());
if (!uri.getHost().endsWith("ely.by"))
return null;
} catch (Exception e) {
return null;
}
return ModelManager0.toUserProfile(result);
}
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override
public String getName() {
return "ElyByAPI";
}
}
@@ -0,0 +1,40 @@
package customskinloader.loader.jsonapi;
import com.google.gson.Gson;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import java.util.Map;
public class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
@Override
public String toJsonUrl(String root, String username) {
return root + username;
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
GlitchlessApiResponse result = new Gson().fromJson(json, GlitchlessApiResponse.class);
if (!result.textures.containsKey(MinecraftProfileTexture.Type.SKIN))
return null;
return ModelManager0.toUserProfile(result.textures);
}
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override
public String getName() {
return "GlitchlessAPI";
}
public static class GlitchlessApiResponse {
protected Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures;
}
}
@@ -0,0 +1,80 @@
package customskinloader.loader.jsonapi;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader.IJsonAPI;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.profile.ModelManager0.Model;
import customskinloader.utils.HttpTextureUtil;
public class UniSkinAPI implements IJsonAPI {
private static final String TEXTURES="textures/";
private static final String SUFFIX=".json";
@Override
public String toJsonUrl(String root, String username) {
return root + username + SUFFIX;
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
UniSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, UniSkinAPIProfile.class);
UserProfile p=new UserProfile();
if(StringUtils.isNotBlank(profile.cape)){
p.capeUrl=root+TEXTURES+profile.cape;
if(local)
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
}
if(profile.skins==null||profile.skins.isEmpty())
return p;
if(profile.model_preference==null||profile.model_preference.isEmpty())
return p;
boolean hasSkin=false;
for(String model:profile.model_preference){
Model enumModel=ModelManager0.getEnumModel(model);
if(enumModel==null||StringUtils.isEmpty(profile.skins.get(model)))
continue;
if(ModelManager0.isSkin(enumModel))
if(hasSkin)
continue;
else
hasSkin=true;
String url=root+TEXTURES+profile.skins.get(model);
if(local)
url=HttpTextureUtil.getLocalFakeUrl(url);
p.put(enumModel, url);
}
return p;
}
/**
* Json profile for UniSkinAPI
* Source Code: https://github.com/RecursiveG/UniSkinMod/blob/master/src/main/java/org/devinprogress/uniskinmod/UniSkinApiProfile.java#L18-L22
* @author RecursiveG
*/
private class UniSkinAPIProfile{
public String player_name;
public long last_update;
public List<String> model_preference;
public Map<String,String> skins;
public String cape;
}
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override
public String getName() {
return "UniSkinAPI";
}
}
@@ -0,0 +1,7 @@
package customskinloader.plugin;
import customskinloader.loader.ProfileLoader;
public interface ICustomSkinLoaderPlugin {
ProfileLoader.IProfileLoader getProfileLoader();
}
@@ -0,0 +1,39 @@
package customskinloader.plugin;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ServiceLoader;
import org.apache.commons.io.FileUtils;
import customskinloader.CustomSkinLoader;
import customskinloader.loader.ProfileLoader;
public class PluginLoader {
public static HashMap<String, ProfileLoader.IProfileLoader> loadPlugins() {
File pluginsDir = new File(CustomSkinLoader.DATA_DIR, "Plugins");
ArrayList<URL> urls = new ArrayList<URL>();
if (!pluginsDir.isDirectory()) {
pluginsDir.mkdirs();
} else {
for (File plugin : FileUtils.listFiles(pluginsDir, new String[] {"jar", "zip"}, false)) {
try {
urls.add(plugin.toURI().toURL());
CustomSkinLoader.logger.info("Found a jar or zip file: " + plugin.getName());
} catch (MalformedURLException ignored) {}
}
}
ServiceLoader<ICustomSkinLoaderPlugin> sl = ServiceLoader.load(ICustomSkinLoaderPlugin.class, new URLClassLoader(urls.toArray(new URL[0]), PluginLoader.class.getClassLoader()));
HashMap<String, ProfileLoader.IProfileLoader> profileLoaders = new HashMap<String, ProfileLoader.IProfileLoader>();
for (ICustomSkinLoaderPlugin cslPlugin : sl) {
ProfileLoader.IProfileLoader profileLoader = cslPlugin.getProfileLoader();
profileLoaders.put(profileLoader.getName().toLowerCase(), profileLoader);
CustomSkinLoader.logger.info("Add profile loader: " + profileLoader.getName());
}
return profileLoaders;
}
}
@@ -0,0 +1,159 @@
package customskinloader.profile;
import java.io.File;
import java.util.*;
import com.google.common.collect.Lists;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mojang.authlib.properties.Property;
import com.mojang.util.UUIDTypeAdapter;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpRequestUtil.HttpRequest;
import customskinloader.utils.HttpRequestUtil.HttpResponce;
import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.HttpUtil0;
public class DynamicSkullManager {
public static class SkullTexture{
public Map<Type,MinecraftProfileTexture> textures;
public String index;//Index File
public ArrayList<String> skins;
public int interval;
public boolean fromZero;
//For program
public long startTime;
public int period;
}
private Map<GameProfile,SkullTexture> dynamicTextures=new HashMap<GameProfile,SkullTexture>();
private Map<GameProfile,Map<Type,MinecraftProfileTexture>> staticTextures=new HashMap<GameProfile,Map<Type,MinecraftProfileTexture>>();
private List<GameProfile> loadingList=new ArrayList<GameProfile>();
private void parseGameProfile(GameProfile profile){
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
if (textureProperty==null){
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
return;
}
String value=textureProperty.getValue();
if(StringUtils.isBlank(value)){
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
return;
}
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
Gson gson=new GsonBuilder().registerTypeAdapter(UUID.class,new UUIDTypeAdapter()).create();
SkullTexture result=gson.fromJson(json,SkullTexture.class);
if(result==null){
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
return;
}
staticTextures.put(profile, (result.textures==null || !result.textures.containsKey(Type.SKIN)) ?
Maps.<Type, MinecraftProfileTexture>newHashMap() : parseTextures(result.textures));
if(StringUtils.isNotEmpty(result.index)){
File indexFile=new File(CustomSkinLoader.DATA_DIR,result.index);
try{
String index=FileUtils.readFileToString(indexFile, "UTF-8");
if(StringUtils.isNotEmpty(index)){
String[] skins = CustomSkinLoader.GSON.fromJson(index, String[].class);
if(skins != null && skins.length != 0)
result.skins = Lists.newArrayList(skins);
}
}catch(Exception e){
CustomSkinLoader.logger.warning("Exception occurs while parsing index file: "+e.toString());
}
}
if(!CustomSkinLoader.config.enableDynamicSkull||result.skins==null||result.skins.isEmpty())
return;
CustomSkinLoader.logger.info("Try to load Dynamic Skull: "+json);
for(int i=0;i<result.skins.size();i++){//check and cache skins
String skin=result.skins.get(i);
if(HttpUtil0.isLocal(skin)){
//Local Skin
File skinFile=new File(CustomSkinLoader.DATA_DIR,skin);
if(skinFile.isFile()&&skinFile.length()>0){
//Skin found
String fakeUrl=HttpTextureUtil.getLocalFakeUrl(skin);
result.skins.set(i, fakeUrl);
}else{
//Could not find skin
result.skins.remove(i--);
}
}else{
//Online Skin
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setCacheFile(HttpTextureUtil.getCacheFile(FilenameUtils.getBaseName(skin))).setCacheTime(0).setLoadContent(false));
if(!responce.success){
//Could not load skin
result.skins.remove(i--);
}
}
}
if(result.skins.isEmpty()){//Nothing loaded
CustomSkinLoader.logger.info("Failed: Nothing loaded.");
return;
}
result.interval=Math.max(result.interval, 50);
if(result.fromZero)
result.startTime=System.currentTimeMillis();
result.period=result.interval*result.skins.size();
CustomSkinLoader.logger.info("Successfully loaded Dynamic Skull: "+new Gson().toJson(result));
dynamicTextures.put(profile, result);
staticTextures.remove(profile);
}
//Support local skin for skull
public Map<Type, MinecraftProfileTexture> parseTextures(Map<Type, MinecraftProfileTexture> textures) {
MinecraftProfileTexture skin=textures.get(Type.SKIN);
String skinUrl=skin.getUrl();
if(!HttpUtil0.isLocal(skinUrl))
return textures;
File skinFile=new File(CustomSkinLoader.DATA_DIR,skinUrl);
if(!skinFile.isFile())
return Maps.newHashMap();
textures.put(Type.SKIN, ModelManager0.getProfileTexture(HttpTextureUtil.getLocalFakeUrl(skinUrl), null));
return textures;
}
public Map<Type,MinecraftProfileTexture> getTexture(final GameProfile profile){
if(staticTextures.get(profile)!=null)
return staticTextures.get(profile);
if(loadingList.contains(profile))
return Maps.newHashMap();
if(dynamicTextures.containsKey(profile)){
SkullTexture texture=dynamicTextures.get(profile);
long time=System.currentTimeMillis()-texture.startTime;
int index=(int)Math.floor((time%texture.period)/texture.interval);
Map<Type,MinecraftProfileTexture> map=Maps.newHashMap();
map.put(Type.SKIN, ModelManager0.getProfileTexture(texture.skins.get(index), null));
return map;
}
loadingList.add(profile);
Thread loadThread=new Thread(){
public void run(){
parseGameProfile(profile);//Load in thread
loadingList.remove(profile);
}
};
loadThread.setName("Skull "+profile.hashCode());
loadThread.start();
return Maps.newHashMap();
}
}
@@ -0,0 +1,121 @@
package customskinloader.profile;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Maps;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
/**
* Model Manager for 1.8 and higher.
* A manager to check if model is available.
* It is the only class in package 'customskinloader' which has differences in different Minecraft version.
* @since 13.1
*/
public class ModelManager0 {
public enum Model{
SKIN_DEFAULT,
SKIN_SLIM,
CAPE,
ELYTRA
}
private static HashMap<String,Model> models=new HashMap<String,Model>();
private static Type typeElytra=null;
static{
for(Type type:Type.values()){
if(type.ordinal()==2)//ELYTRA
typeElytra=type;
}
models.put("default", Model.SKIN_DEFAULT);
models.put("slim", Model.SKIN_SLIM);
models.put("cape", Model.CAPE);
if(typeElytra!=null)
models.put("elytra", Model.ELYTRA);
}
/**
* Get enum for the model.
* @param model - string model
* @since 14.5
*/
public static Model getEnumModel(String model){
return models.get(model);
}
/**
* Check if model is skin.
* @since 14.5
* */
public static boolean isSkin(Model model){
return model==Model.SKIN_DEFAULT||model==Model.SKIN_SLIM;
}
/**
* Check if elytra is supported.
* @since 14.5
*/
public static boolean isElytraSupported(){
return typeElytra!=null;
}
/**
* Parse hashMapProfile to UserProfile
* @param profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
* @return profile - UserProfile instance
* @since 13.1
*/
public static UserProfile toUserProfile(Map<Type, MinecraftProfileTexture> profile){
UserProfile userProfile=new UserProfile();
if(profile==null)
return userProfile;
MinecraftProfileTexture skin = profile.get(Type.SKIN);
userProfile.skinUrl= skin==null?null:skin.getUrl();//Avoid NullPointerException
userProfile.model= skin==null?null:skin.getMetadata("model");
if(StringUtils.isEmpty(userProfile.model))
userProfile.model="default";
MinecraftProfileTexture cape = profile.get(Type.CAPE);
userProfile.capeUrl= cape==null?null:cape.getUrl();
return userProfile;
}
/**
* Parse UserProfile to hashMapProfile
* @param profile - UserProfile instance
* @return profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
* @since 13.1
*/
public static Map<Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile){
Map<Type, MinecraftProfileTexture> map=Maps.newHashMap();
if(profile==null)
return map;
if(profile.skinUrl!=null){
Map<String,String> metadata = null;
if("slim".equals(profile.model) || "auto".equals(profile.model)){
metadata = Maps.newHashMap();
metadata.put("model", profile.model);
}
map.put(Type.SKIN, getProfileTexture(profile.skinUrl,metadata));
}
if(profile.capeUrl!=null)
map.put(Type.CAPE, getProfileTexture(profile.capeUrl,null));
if(typeElytra!=null && profile.elytraUrl!=null)
map.put(typeElytra, getProfileTexture(profile.elytraUrl,null));
return map;
}
/**
* Parse url to MinecraftProfileTexture
*
* @param url - textureUrl
* metadata - metadata
* @return MinecraftProfileTexture
* @since 14.5
*/
public static MinecraftProfileTexture getProfileTexture(String url,Map<String,String> metadata){
return new MinecraftProfileTexture(url,metadata);
}
}
@@ -0,0 +1,105 @@
package customskinloader.profile;
import java.io.File;
import java.util.HashMap;
import org.apache.commons.io.FileUtils;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.TimeUtil;
public class ProfileCache {
public static File PROFILE_CACHE_DIR=new File(CustomSkinLoader.DATA_DIR,"ProfileCache");
private HashMap<String,CachedProfile> cachedProfiles=new HashMap<String,CachedProfile>();
private HashMap<String,UserProfile> localProfiles=new HashMap<String,UserProfile>();
@SuppressWarnings("ResultOfMethodCallIgnored")
public ProfileCache(){
if(!PROFILE_CACHE_DIR.exists())
PROFILE_CACHE_DIR.mkdir();
}
public boolean isExist(String username){
return cachedProfiles.containsKey(username.toLowerCase());
}
public boolean isReady(String username){
CachedProfile cp=cachedProfiles.get(username.toLowerCase());
return cp != null && (cp.loading || cp.expiryTime > TimeUtil.getCurrentUnixTimestamp());
}
public boolean isExpired(String username){
CachedProfile cp=cachedProfiles.get(username.toLowerCase());
return cp == null || (cp.expiryTime <= TimeUtil.getCurrentUnixTimestamp());
}
public UserProfile getProfile(String username){
return getCachedProfile(username).profile;
}
public long getExpiry(String username){
return getCachedProfile(username).expiryTime;
}
public UserProfile getLocalProfile(String username){
if(localProfiles.containsKey(username.toLowerCase()))
return localProfiles.get(username.toLowerCase());
return loadLocalProfile(username);
}
public void setLoading(String username,boolean loading){
getCachedProfile(username).loading=loading;
}
public void updateCache(String username,UserProfile profile){
updateCache(username,profile,CustomSkinLoader.config.enableLocalProfileCache);
}
public void updateCache(String username,UserProfile profile,boolean saveLocalProfile){
CachedProfile cp=getCachedProfile(username);
cp.profile=profile;
cp.expiryTime=TimeUtil.getUnixTimestampRandomDelay(CustomSkinLoader.config.cacheExpiry);
if(!saveLocalProfile)
return;
saveLocalProfile(username,profile);
}
private CachedProfile getCachedProfile(String username){
CachedProfile cp=cachedProfiles.get(username.toLowerCase());
if(cp!=null)
return cp;
cp=new CachedProfile();
cachedProfiles.put(username.toLowerCase(), cp);
return cp;
}
private UserProfile loadLocalProfile(String username){
File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json");
if(!localProfile.exists()){
localProfiles.put(username.toLowerCase(), null);
}
try{
String json = FileUtils.readFileToString(localProfile, "UTF-8");
UserProfile profile=CustomSkinLoader.GSON.fromJson(json, UserProfile.class);
localProfiles.put(username.toLowerCase(), profile);
CustomSkinLoader.logger.info("Successfully load LocalProfile.");
return profile;
}catch(Exception e){
CustomSkinLoader.logger.info("Failed to load LocalProfile.("+e.toString()+")");
localProfiles.put(username.toLowerCase(), null);
}
return null;
}
@SuppressWarnings("ResultOfMethodCallIgnored")
private void saveLocalProfile(String username, UserProfile profile){
String json=CustomSkinLoader.GSON.toJson(profile);
File localProfile=new File(PROFILE_CACHE_DIR,username+".json");
if(localProfile.exists())
localProfile.delete();
try {
FileUtils.write(localProfile, json, "UTF-8");
CustomSkinLoader.logger.info("Successfully save LocalProfile.");
} catch (Exception e) {
CustomSkinLoader.logger.info("Failed to save LocalProfile.("+e.toString()+")");
}
}
}
class CachedProfile{
public UserProfile profile;
public long expiryTime=0;
public boolean loading=false;
}
@@ -0,0 +1,103 @@
package customskinloader.profile;
import org.apache.commons.lang3.StringUtils;
import customskinloader.profile.ModelManager0.Model;
/**The instance to storage user's profile in memory temporarily.
* In this manner, it could be easier to pass profile in program.
* @since 13.1
*/
public class UserProfile {
/**
* Direct url for skin.
* @since 13.1
*/
public String skinUrl=null;
/**
* Model for skin.
* default/slim
* @since 13.1
*/
public String model=null;
/**
* Direct url for cape.
* @since 13.1
*/
public String capeUrl=null;
/**
* Direct url for elytra.
* @since 14.5
*/
public String elytraUrl=null;
public void put(Model model,String url){
if(model==null||StringUtils.isEmpty(url))
return;
switch(model){
case SKIN_DEFAULT:
this.skinUrl=url;
this.model="default";
return;
case SKIN_SLIM:
this.skinUrl=url;
this.model="slim";
return;
case CAPE:
this.capeUrl=url;
return;
case ELYTRA:
this.capeUrl=url;
}
}
/**
* Get parsed String to output the instance.
*/
@Override
public String toString(){
return toString(0);
}
public String toString(long expiry){
return "(SkinUrl: "+skinUrl+
" , Model: "+model+
" , CapeUrl: "+capeUrl+
(StringUtils.isBlank(elytraUrl)?" ":" , ElytraUrl: "+elytraUrl)+
(expiry==0?"":(" , Expiry: "+expiry))+")";
}
/**
* Check if the instance is empty.
* @return status (true - empty)
*/
public boolean isEmpty(){
return StringUtils.isEmpty(skinUrl) && StringUtils.isEmpty(capeUrl) && StringUtils.isEmpty(elytraUrl);
}
/**
* Check if the instance is full(Both skin and cape).
* @return status (true - full)
* @since 14.7
*/
public boolean isFull(){
return StringUtils.isNoneBlank(skinUrl,capeUrl);
}
public boolean hasSkinUrl(){
return StringUtils.isNotEmpty(skinUrl);
}
public void mix(UserProfile profile){
if(profile==null)
return;
if(StringUtils.isEmpty(this.skinUrl)) {
this.skinUrl = profile.skinUrl;
this.model = profile.model;
}
if(StringUtils.isEmpty(this.capeUrl))
this.capeUrl=profile.capeUrl;
if(StringUtils.isEmpty(this.elytraUrl))
this.elytraUrl=profile.elytraUrl;
}
}
@@ -0,0 +1,232 @@
package customskinloader.utils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import customskinloader.CustomSkinLoader;
public class HttpRequestUtil {
public static class HttpRequest{
public String url;
public String userAgent=null;
public String payload=null;
public boolean loadContent=true;
public boolean checkPNG=false;
public int cacheTime=600;//-1=No Cache 0=Always Cache t=Default Cache Time(second)
public File cacheFile=null;//Default Cache File
public HttpRequest(String url){
this.url=url;
}
public HttpRequest setUserAgent(String userAgent){
this.userAgent=userAgent;
return this;
}
public HttpRequest setPayload(String payload){
this.payload=payload;
return this;
}
public HttpRequest setLoadContent(boolean loadContent){
this.loadContent=loadContent;
return this;
}
public HttpRequest setCheckPNG(boolean checkPNG){
this.checkPNG=checkPNG;
return this;
}
public HttpRequest setCacheTime(int cacheTime){
this.cacheTime=cacheTime;
return this;
}
public HttpRequest setCacheFile(File cacheFile){
this.cacheFile=cacheFile;
return this;
}
}
public static class HttpResponce{
public String content=null;
public int responceCode=-1;
public boolean success=false;
public boolean fromCache=false;
}
public static class CacheInfo{
public String url;
public String etag=null;
public long lastModified=-1;//ms
public long expire=-1;//UNIX timestamp
}
public static final File CACHE_DIR=new File(CustomSkinLoader.DATA_DIR,"caches");
public static HttpResponce makeHttpRequest(HttpRequest request){
return makeHttpRequest(request, 0);
}
public static HttpResponce makeHttpRequest(HttpRequest request, int redirectTime){
try{
CustomSkinLoader.logger.debug("Try to request '"+request.url+(request.userAgent==null?"'.":"' with user agent '"+request.userAgent+"'."));
//Check Cache
if(StringUtils.isNotEmpty(request.payload))
request.cacheTime=-1;//No Cache
File cacheInfoFile=null;
CacheInfo cacheInfo=new CacheInfo();
if(request.cacheFile==null && request.cacheTime>=0){
String hash=DigestUtils.sha1Hex(request.url);
request.cacheFile=new File(CACHE_DIR,hash);
cacheInfoFile=new File(CACHE_DIR,hash+".json");
}
if(request.cacheTime==0 && request.cacheFile.isFile())
return loadFromCache(request,new HttpResponce());
if(cacheInfoFile!=null&&cacheInfoFile.isFile()){
String json=FileUtils.readFileToString(cacheInfoFile, "UTF-8");
if(StringUtils.isNotEmpty(json))
cacheInfo=CustomSkinLoader.GSON.fromJson(json, CacheInfo.class);
if(cacheInfo==null)
cacheInfo=new CacheInfo();
if(cacheInfo.expire>=TimeUtil.getCurrentUnixTimestamp())
return loadFromCache(request,new HttpResponce(),cacheInfo.expire);
}
//Init Connection
String url=new URI(request.url).toASCIIString();
if(!url.equalsIgnoreCase(request.url))
CustomSkinLoader.logger.debug("Encoded URL: "+url);
HttpURLConnection c = (HttpURLConnection) (new URL(url)).openConnection();
c.setReadTimeout(1000 * 10);
c.setConnectTimeout(1000 * 10);
c.setDoInput(true);
c.setUseCaches(false);
c.setInstanceFollowRedirects(true);
//Make Connection
if(cacheInfo.lastModified>=0)
c.setIfModifiedSince(cacheInfo.lastModified);
if(cacheInfo.etag!=null)
c.setRequestProperty("If-None-Match",cacheInfo.etag);
c.setRequestProperty("Accept-Encoding","gzip");
if(request.userAgent!=null)
c.setRequestProperty("User-Agent",request.userAgent);
if(StringUtils.isNotEmpty(request.payload)){
CustomSkinLoader.logger.info("Payload: "+request.payload);
c.setDoOutput(true);
OutputStream os=c.getOutputStream();
IOUtils.write(request.payload, os, "UTF-8");
IOUtils.closeQuietly(os);
}
c.connect();
//Check Connection
HttpResponce responce=new HttpResponce();
responce.responceCode=c.getResponseCode();
int res = c.getResponseCode();
if (res / 100 == 4 || res / 100 == 5) {//Failed
CustomSkinLoader.logger.debug("Failed to request (Response Code: " + res + ")");
return responce;
}
if (res == HttpURLConnection.HTTP_MOVED_PERM || res == HttpURLConnection.HTTP_MOVED_TEMP) {
//Redirect
if (redirectTime >= 4) {
CustomSkinLoader.logger.debug("Failed to request (Too many redirection)");
return responce;
}
request.url = c.getHeaderField("Location");//Get redirecting location
if (request.url == null) {
CustomSkinLoader.logger.debug("Failed to request (Redirecting location not found)");
return responce;
}
CustomSkinLoader.logger.debug("Redirect to: " + request.url);
return makeHttpRequest(request, redirectTime + 1);//Recursion
}
responce.success=true;
CustomSkinLoader.logger.debug("Successfully request (Response Code: " + res + " , Content Length: " + c.getContentLength() + ")");
if(responce.responceCode==HttpURLConnection.HTTP_NOT_MODIFIED)
return loadFromCache(request,responce);
if (responce.responceCode == HttpURLConnection.HTTP_NO_CONTENT)
request.cacheTime = 3600;
//Load Content
InputStream is="gzip".equals(c.getContentEncoding())?new GZIPInputStream(c.getInputStream()):c.getInputStream();
byte [] bytes = IOUtils.toByteArray(is);
if(request.checkPNG&&(bytes.length<=4||bytes[1]!=(byte)'P'||bytes[2]!=(byte)'N'||bytes[3]!=(byte)'G')){
CustomSkinLoader.logger.debug("Failed to request (Not Standard PNG)");
responce.success=false;
return responce;
}
if(request.cacheFile!=null){
FileUtils.writeByteArrayToFile(request.cacheFile, bytes);
if(cacheInfoFile!=null){
cacheInfo.url=request.url;
cacheInfo.etag=c.getHeaderField("ETag");
cacheInfo.lastModified=c.getLastModified();
cacheInfo.expire=getExpire(c,request.cacheTime);
FileUtils.write(cacheInfoFile, CustomSkinLoader.GSON.toJson(cacheInfo), "UTF-8");
}
CustomSkinLoader.logger.debug("Saved to cache (Length: "+request.cacheFile.length()+" , Path: '"+request.cacheFile.getAbsolutePath()+"' , Expire: "+cacheInfo.expire+")");
}
if(!request.loadContent)
return responce;
responce.content=new String(bytes, "UTF-8");
CustomSkinLoader.logger.debug("Content: "+responce.content);
return responce;
}catch(Exception e){
CustomSkinLoader.logger.debug("Failed to request (Exception: "+e.toString()+")");
return loadFromCache(request,new HttpResponce());
}
}
public static File getCacheFile(String hash){
return new File(CACHE_DIR,hash);
}
private static HttpResponce loadFromCache(HttpRequest request,HttpResponce responce){
return loadFromCache(request,responce,0);
}
private static HttpResponce loadFromCache(HttpRequest request,HttpResponce responce,long expireTime){
if(request.cacheFile==null||!request.cacheFile.isFile())
return responce;
CustomSkinLoader.logger.debug("Cache file found (Length: "+request.cacheFile.length()+" , Path: '"+request.cacheFile.getAbsolutePath()+"' , Expire: "+expireTime+"')");
responce.fromCache=true;
responce.success=true;
if(!request.loadContent)
return responce;
CustomSkinLoader.logger.info("Try to load from cache '"+request.cacheFile.getAbsolutePath()+"'.");
try {
responce.content=FileUtils.readFileToString(request.cacheFile, "UTF-8");
CustomSkinLoader.logger.debug("Successfully load from cache");
CustomSkinLoader.logger.debug("Content: "+responce.content);
} catch (IOException e) {
CustomSkinLoader.logger.debug("Failed to load from cache (Exception: "+e.toString()+")");
responce.success=false;
}
return responce;
}
private final static Pattern MAX_AGE_PATTERN = Pattern.compile(".*?max-age=(\\d+).*?");
private static long getExpire(HttpURLConnection connection,int cacheTime){
String cacheControl=connection.getHeaderField("Cache-Control");
if(StringUtils.isNotEmpty(cacheControl)){
Matcher m=MAX_AGE_PATTERN.matcher(cacheControl);
if(m.matches())
return TimeUtil.getUnixTimestamp(Long.parseLong(m.group(m.groupCount())));
}
long expires=connection.getExpiration();
if(expires>0)
return expires/1000;
return TimeUtil.getUnixTimestampRandomDelay(cacheTime==0 ? 86400 : cacheTime);
}
}
@@ -0,0 +1,83 @@
package customskinloader.utils;
import java.io.File;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import customskinloader.CustomSkinLoader;
public class HttpTextureUtil {
public static class HttpTextureInfo{
public String url="";
public File cacheFile;
public String hash;
}
private static final String
LEGACY_MARK="(LEGACY)",
LOCAL_MARK="(LOCAL)",
LOCAL_LEGACY_MARK="(LOCAL_LEGACY)";
public static File defaultCacheDir;
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void cleanCacheDir(){
if(defaultCacheDir!=null){
defaultCacheDir.delete();
defaultCacheDir.mkdirs();
}
}
public static File getCacheDir(){
return defaultCacheDir==null?new File(MinecraftUtil.getMinecraftDataDir(),"assets/skins"):defaultCacheDir;
}
public static HttpTextureInfo toHttpTextureInfo(String fakeUrl){
HttpTextureInfo info=new HttpTextureInfo();
if(fakeUrl.startsWith("http")){
info.url=fakeUrl;
info.hash=FilenameUtils.getBaseName(fakeUrl);
info.cacheFile=getCacheFile(info.hash);
return info;
}
if(fakeUrl.startsWith(LOCAL_LEGACY_MARK)){
fakeUrl=fakeUrl.replace(LOCAL_LEGACY_MARK, "");
String[] t=fakeUrl.split(",",2);
if(t.length!=2)
return info;
info.cacheFile=new File(CustomSkinLoader.DATA_DIR,t[1]);
info.hash=t[0];
return info;
}
if(fakeUrl.startsWith(LOCAL_MARK)){
fakeUrl=fakeUrl.replace(LOCAL_MARK, "");
info.cacheFile=new File(CustomSkinLoader.DATA_DIR,fakeUrl);
info.hash=FilenameUtils.getBaseName(fakeUrl);
return info;
}
if(fakeUrl.startsWith(LEGACY_MARK)){
fakeUrl=fakeUrl.replace(LEGACY_MARK, "");
info.url=fakeUrl;
info.hash=DigestUtils.sha1Hex(info.url);
info.cacheFile = HttpRequestUtil.getCacheFile(info.hash);
return info;
}
return info;
}
public static String getLegacyFakeUrl(String url){
return LEGACY_MARK+url;
}
public static String getLocalFakeUrl(String path){
return LOCAL_MARK+path;
}
public static String getLocalLegacyFakeUrl(String path,String hash){
return LOCAL_LEGACY_MARK+hash+","+path;
}
public static String getHash(String url,long size,long lastModified){
return DigestUtils.sha1Hex(size+url+lastModified);
}
public static File getCacheFile(String hash){
return getCacheFile(defaultCacheDir,hash);
}
public static File getCacheFile(File cacheDir,String hash){
return new File(new File(cacheDir,hash.length()>2?hash.substring(0,2):"xx"), hash);
}
}
@@ -0,0 +1,122 @@
package customskinloader.utils;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.cert.X509Certificate;
import javax.net.ssl.*;
import org.apache.commons.lang3.StringUtils;
public class HttpUtil0 {
public static boolean isLocal(String url){
return url != null && !url.startsWith("http");
}
//From: http://blog.csdn.net/xiyushiyi/article/details/46685387
public static void ignoreHttpsCertificate(){
HostnameVerifier doNotVerify = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[] {};
}
public void checkClientTrusted(X509Certificate[] chain, String authType){}
public void checkServerTrusted(X509Certificate[] chain, String authType){}
}};
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryFacade());
HttpsURLConnection.setDefaultHostnameVerifier(doNotVerify);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String parseAddress(String address) {
if(StringUtils.isEmpty(address))
return null;
String[] addresses=address.split(":");
InetAddress add;
try {
add = InetAddress.getByName(addresses[0]);
} catch (UnknownHostException e) {
e.printStackTrace();
return null;
}
return add.getHostAddress()+(addresses.length==2 ? addresses[1] : "25565");
}
public static boolean isLanServer(String standardAddress){
if(StringUtils.isEmpty(standardAddress))
return true;
String[] addresses=standardAddress.split(":");
int numIp=getNumIp(addresses[0]);
return numIp==0||numIp==getNumIp("127.0.0.1")||
(numIp>=getNumIp("192.168.0.0")&&numIp<=getNumIp("192.168.255.255"))||
(numIp>=getNumIp("10.0.0.0")&&numIp<=getNumIp("10.255.255.255"))||
(numIp>=getNumIp("172.16.0.0")&&numIp<=getNumIp("172.31.255.255"));
}
public static int getNumIp(String ip){
int num=0;
String[] ips=ip.split("\\.");
if(ips.length!=4)
return 0;
for(int i=0;i<4;i++)
num+=Integer.parseInt(ips[i])*(256^(3-i));
return num;
}
//https://stackoverflow.com/questions/30817934/extended-server-name-sni-extension-not-sent-with-jdk1-8-0-but-send-with-jdk1-7
public static class SSLSocketFactoryFacade extends SSLSocketFactory {
SSLSocketFactory sslsf;
public SSLSocketFactoryFacade() {
sslsf = (SSLSocketFactory) SSLSocketFactory.getDefault();;
}
@Override
public String[] getDefaultCipherSuites() {
return sslsf.getDefaultCipherSuites();
}
@Override
public String[] getSupportedCipherSuites() {
return sslsf.getSupportedCipherSuites();
}
@Override
public Socket createSocket(Socket socket, String s, int i, boolean b) throws IOException {
return sslsf.createSocket(socket, s, i, b);
}
@Override
public Socket createSocket(String s, int i) throws IOException, UnknownHostException {
return sslsf.createSocket(s, i);
}
@Override
public Socket createSocket(String s, int i, InetAddress inetAddress, int i1) throws IOException, UnknownHostException {
return sslsf.createSocket(s, i, inetAddress, i1);
}
@Override
public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
return createSocket(inetAddress, i);
}
@Override
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1) throws IOException {
return createSocket(inetAddress, i, inetAddress1, i1);
}
}
}
@@ -0,0 +1,34 @@
package customskinloader.utils;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.LinkedList;
public class JavaUtil {
public static URL[] getClasspath() {
if (JavaUtil.class.getClassLoader() instanceof URLClassLoader) {
//Java 8-
//Use URLClassLoader Directly
URLClassLoader ucl = (URLClassLoader) JavaUtil.class.getClassLoader();
return ucl.getURLs();
} else {
//Java 9+
//It uses APPClassLoader instead of URLClassLoader
//Get Classpath from properties and parse it to URL array
String classpath = System.getProperty("java.class.path");
String[] elements = classpath.split(File.pathSeparator);
if (elements.length == 0)
return new URL[0];
LinkedList<URL> urls = new LinkedList<URL>();
for (String ele : elements) {
try {
urls.add(new File(ele).toURI().toURL());
} catch (Exception ignored) {
}
}
return urls.toArray(new URL[0]);
}
}
}
@@ -0,0 +1,125 @@
package customskinloader.utils;
import java.io.File;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
/**
* @author Alexander Xia
* @since 13.6
*
*/
public class MinecraftUtil {
public static File getMinecraftDataDir(){
return Minecraft.getMinecraft().gameDir;
}
public static MinecraftSessionService getSessionService(){
return Minecraft.getMinecraft().getSessionService();
}
public static TextureManager getTextureManager(){
return Minecraft.getMinecraft().getTextureManager();
}
private static ArrayList<String> minecraftVersion=new ArrayList<String>();
private static String minecraftMainVersion=null;
private final static Pattern MINECRAFT_VERSION_PATTERN = Pattern.compile(".*?(\\d+\\.\\d+[\\.]?\\d*).*?");
public static ArrayList<String> getMinecraftVersions(){
if(minecraftVersion!=null&&!minecraftVersion.isEmpty())
return minecraftVersion;
testProbe();
return minecraftVersion;
}
public static String getMinecraftVersionText(){
StringBuilder sb=new StringBuilder();
for(String version:getMinecraftVersions())
sb.append(version).append(" ");
return StringUtils.trim(sb.toString());
}
public static String getMinecraftMainVersion(){
if(minecraftMainVersion!=null)
return minecraftMainVersion;
for(String version:getMinecraftVersions()){
Matcher m = null;
try{
m=MINECRAFT_VERSION_PATTERN.matcher(version);
}catch(Exception e){
e.printStackTrace();
}
if(m==null || !m.matches())
continue;
minecraftMainVersion=m.group(m.groupCount());
break;
}
return minecraftMainVersion;
}
// (domain|ip)(:port)
public static String getServerAddress(){
net.minecraft.client.multiplayer.ServerData data = Minecraft.getMinecraft().getCurrentServerData();
if(data==null)//Single Player
return null;
return data.serverIP;
}
// ip:port
public static String getStandardServerAddress(){
return HttpUtil0.parseAddress(getServerAddress());
}
public static boolean isLanServer(){
return HttpUtil0.isLanServer(getStandardServerAddress());
}
public static String getCurrentUsername(){
return Minecraft.getMinecraft().getSession().getProfile().getName();
}
private final static Pattern MINECRAFT_CORE_FILE_PATTERN = Pattern.compile("^(.*?)/versions/([^\\/\\\\]*?)/([^\\/\\\\]*?).jar$");
private static void testProbe(){
minecraftVersion.clear();
URL urls[] = JavaUtil.getClasspath();
for(URL url:urls){
Matcher m = null;
try{
m=MINECRAFT_CORE_FILE_PATTERN.matcher(URLDecoder.decode(url.getPath(),"UTF-8"));
}catch(Exception e){
e.printStackTrace();
}
if(m==null || !m.matches())
continue;
minecraftVersion.add(m.group(2));
}
}
public static boolean isCoreFile(URL url) {
return regexMatch(url, MINECRAFT_CORE_FILE_PATTERN);
}
private final static Pattern LIBRARY_FILE_PATTERN = Pattern.compile("^(.*?)/libraries/(.*?)/([^\\/\\\\]*?).jar$");
public static boolean isLibraryFile(URL url) {
return regexMatch(url, LIBRARY_FILE_PATTERN);
}
private static boolean regexMatch(URL url, Pattern p) {
Matcher m;
try {
m=p.matcher(URLDecoder.decode(url.getPath(), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
return false;
}
return m.matches();
}
public static String getCredential(GameProfile profile) {
return (profile==null || profile.hashCode()==0) ? null :
(profile.getId()==null ? profile.getName() : String.format("%s-%s", profile.getName(),profile.getId()));
}
}
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more