Details
Description
Getting a null pointer when using ItemStack isSimilar on skulls using base64 textures.
Using the following code:
public class Main extends JavaPlugin { @Override public void onEnable() { ItemStack head1 = new ItemStack(Material.PLAYER_HEAD); UUID uuid = UUID.randomUUID(); GameProfile profile1 = new GameProfile(uuid, null); profile1.getProperties().put("textures", new Property("textures", "some random skin value")); setProfile(head1, profile1); ItemStack head2 = head1.clone(); if(head1.isSimilar(head2)) { // NPE here System.out.println("Is similar"); } } private void setProfile(ItemStack item, GameProfile profile) { ItemMeta meta = item.getItemMeta(); try { Field field = meta.getClass().getDeclaredField("profile"); field.setAccessible(true); field.set(meta, profile); } catch (NoSuchFieldException | IllegalAccessException ex) { ex.printStackTrace(); } item.setItemMeta(meta); } }
NOTE: Code works fine using 1.14.4