Download player_head/skull texture even if no owner name present #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there.
I'm really not much of a Java person but I did want to fix a small functionality bug that wasn't captured as part of #156's fix. Please let me know if there are any "Java-isms" I'm not following or any other feedback. Happy to revise this PR/add evidence if necessary.
While the minecraft wiki currently states "Name: Username of owner. If missing or empty, the head appears as a Steve head.", this is observably incorrect.
Below are three valid player skulls where only the third one renders as the default steve head. The first one contains a texture value but no name while the second one contains both name and texture value. (Data captured via F3+I in-game)
This commit fixes the incorrect assumption that any valid textured player head has a
Name
tag as well. The downloaded texture name will use the player name if present asplayer_<name>.png
. If no name is present, it will fall back to using the textures.minecraft.net's texture ID from the URL decoded from the B64 texture url asplayer_<tex_id>.png
.FWIW, I'm getting these skulls via a Bukkit/Spigot plugin - Head Database. Presumably the plugin doesn't bother adding the owner name in the NBT data since the skulls render fine without it.