Add get/set customName to Skull block (#12302)

This commit is contained in:
Shane Bee
2025-03-21 09:52:00 -07:00
committed by GitHub
parent 7cc6cb5013
commit f49d18df89
3 changed files with 36 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import io.papermc.paper.adventure.PaperAdventure;
import net.kyori.adventure.text.Component;
import net.minecraft.Util;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
@@ -216,4 +218,16 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
public CraftSkull copy(Location location) {
return new CraftSkull(this, location);
}
@Override
public @Nullable Component customName() {
SkullBlockEntity snapshot = getSnapshot();
return snapshot.customName == null ? null : PaperAdventure.asAdventure(snapshot.customName);
}
@Override
public void customName(@Nullable Component customName) {
SkullBlockEntity snapshot = getSnapshot();
snapshot.customName = customName == null ? null : PaperAdventure.asVanilla(customName);
}
}