Problem occurs when I try to use custom SkullMeta
twseer67875 opened this issue ยท 1 comments
Confirmation
- I have read the FAQ.
- I have tested the latest development build of Holographic Displays and the bug is still present.
- I have updated Spigot to the latest release for my particular Minecraft version.
- I made sure the bug hasn't already been reported on the issue tracker.
Description
Problem occurs when I try to use custom SkullMeta
public static void setupHologram(Location location, String name, Material material, Player player){
ItemStack itemStack = new ItemStack(material);
if (material.equals(Material.PLAYER_HEAD)){
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
itemStack.setItemMeta(getCustomTextureHead(skullMeta, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmRmODYxZDViOTI1NTQxMTQwN2ZjOTJjZGM1NzdhNDc3MzU4NzM4NjY0M2Y1NTE4ODM0NDgyM2MwM2IxNzlkIn19fQ=="));
}
Hologram hologram = HologramsAPI.createHologram(plugin, location.add(0.0, 3.2, 0.0));
hologram.appendTextLine(name);
hologram.appendItemLine(itemStack);
BetterDecoratePlugin.holograms.put(player.getUniqueId(), hologram);
}
private static SkullMeta getCustomTextureHead(SkullMeta skullMeta, String base64){
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property(("textures"), base64));
Field profileField = null;
try {
profileField = skullMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skullMeta, profile);
return skullMeta;
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException exception){
exception.printStackTrace();
return null;
}
}
How to reproduce
- Trying to create a custom hologram using the API
- Try using the API to teleport the hologram you just created
- The following error occurs
[15:15:03 ERROR]: [HolographicDisplays] Error while ticking holograms
java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.NBTTagCompound.equals(Object)" because "this.serializedProfile" is null
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaSkull.equalsCommon(CraftMetaSkull.java:247) ~[paper-1.19.2.jar:git-Paper-258]
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemFactory.equals(CraftItemFactory.java:333) ~[paper-1.19.2.jar:git-Paper-258]
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemFactory.equals(CraftItemFactory.java:320) ~[paper-1.19.2.jar:git-Paper-258]
at org.bukkit.inventory.ItemStack.isSimilar(ItemStack.java:297) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.inventory.ItemStack.equals(ItemStack.java:278) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at java.util.Objects.equals(Objects.java:64) ~[?:?]
at me.filoghost.holographicdisplays.core.tracking.ItemLineTracker.detectChanges(ItemLineTracker.java:74) ~[HolographicDisplays-3.0.1-SNAPSHOT.jar:?]
at me.filoghost.holographicdisplays.core.tracking.LineTracker.update(LineTracker.java:64) ~[HolographicDisplays-3.0.1-SNAPSHOT.jar:?]
at me.filoghost.holographicdisplays.core.tracking.ItemLineTracker.update(ItemLineTracker.java:47) ~[HolographicDisplays-3.0.1-SNAPSHOT.jar:?]
at me.filoghost.holographicdisplays.core.tracking.LineTrackerManager.update(LineTrackerManager.java:62) ~[HolographicDisplays-3.0.1-SNAPSHOT.jar:?]
at me.filoghost.holographicdisplays.core.tick.TickingTask.run(TickingTask.java:80) ~[HolographicDisplays-3.0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.2.jar:git-Paper-258]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.2.jar:git-Paper-258]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1473) ~[paper-1.19.2.jar:git-Paper-258]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.2.jar:git-Paper-258]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.2.jar:git-Paper-258]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.2.jar:git-Paper-258]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-258]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Server version
This server is running Paper version git-Paper-258 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: ab1c072) You are running the latest version
Holographic Displays version
HolographicDisplays version 3.0.1-SNAPSHOT-b236
Installed plugins that allow players to join with multiple Minecraft versions
none
Additional information
No response