Expression for Skull Texture#8500
Conversation
| } | ||
| @Override |
There was a problem hiding this comment.
| } | |
| @Override | |
| } | |
| @Override |
| } | ||
| @Override |
There was a problem hiding this comment.
| } | |
| @Override | |
| } | |
| @Override |
| @Name("Skull Texture") | ||
| @Description("The skull texture for a player head.") | ||
| @Example("set the skull texture of {_i} to \"<base64>\"") | ||
| @Since("2.15") |
There was a problem hiding this comment.
| @Since("2.15") | |
| @Since("INSERT VERSION") |
|
|
||
| @Name("Skull Texture") | ||
| @Description("The skull texture for a player head.") | ||
| @Example("set the skull texture of {_i} to \"<base64>\"") |
There was a problem hiding this comment.
can you use an example base64 string here so that its more clear here. should probably return notch's skull or someone else's
| public void change(Event event, Object @Nullable [] delta, ChangeMode mode) { | ||
| String value = delta == null ? null : (String) delta[0]; | ||
| switch (mode) { | ||
| case DELETE, RESET: |
| @Nullable | ||
| @Override | ||
| public String convert(ItemType item) { |
There was a problem hiding this comment.
| @Nullable | |
| @Override | |
| public String convert(ItemType item) { | |
| @Override | |
| public @Nullable String convert(ItemType item) { |
| @Nullable | ||
| @Override | ||
| public String convert(ItemType item) { | ||
| if (!(item.getMaterial() == Material.PLAYER_HEAD)) { |
There was a problem hiding this comment.
| if (!(item.getMaterial() == Material.PLAYER_HEAD)) { | |
| if (item.getMaterial() != Material.PLAYER_HEAD) { |
lol havent seen this in a while
| return null; | ||
| } | ||
| ProfileProperty texture = profile.getProperties().stream() | ||
| .filter(p -> p.getName().equals("textures")) |
There was a problem hiding this comment.
| .filter(p -> p.getName().equals("textures")) | |
| .filter(property -> property.getName().equals("textures")) |
p doesnt really explain what you're checking here
| if (!(texture == null)) { | ||
| return texture.getValue(); | ||
| } else{ | ||
| return null; | ||
| } |
There was a problem hiding this comment.
| if (!(texture == null)) { | |
| return texture.getValue(); | |
| } else{ | |
| return null; | |
| } | |
| if (texture == null) { | |
| return null; | |
| } | |
| return texture.getValue(); |
also use !=
| return "skull texture"; | ||
| } | ||
|
|
||
| } |
|
additionally you should target the dev/feature branch |
|
Will rewrite this to use 2.15 registersyntax system soon |
I presume you mean the registration api (2.10/2.14)? There weren't really any syntax registration changes in 2.15, just event-value stuff. |
Idk I just call it 2.15's registersyntax stuff |
Problem
Skript doesn't have it and Skbee sort of has it
Its a very useful utility used by almost every server
Solution
Adds an expression to set/get/reset/delete the skull texture of a player head
eg
set the head texture of {_i} to "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNhNDA3ZDNiZGI1ZDBkODAzYjViZmU1MWU4NmU5MWY4YTI5ZTg2NWZjNGNkMzYwMmVhZjA3N2EwYjg1ZGQ2NSJ9fX0="or
reset head texture of {_i}Testing Completed
Compiled and tested on 1.21.11 with no other addons it appears to work fine
Supporting Information
From testing upon texturing a player head if the name is minecraft's default value for the name (eg OwlBe's Head) then it will rename it to " 's head" else if its named eg "&cTest" it won't be renamed
Completes: none
Related: #8448
AI assistance: Tiny bit for retrieving texture value of a player head