Add get/set customName to Skull block (#12302)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user