#1125: Add support for NoteBlock sounds in Skulls

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2022-12-23 12:26:06 +11:00
parent 7f7ce313db
commit be664f5cc4
3 changed files with 107 additions and 2 deletions

View File

@@ -2,9 +2,11 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.block.entity.TileEntitySkull;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType;
import org.bukkit.World;
@@ -15,7 +17,9 @@ import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.Nullable;
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
@@ -120,6 +124,21 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
}
}
@Override
public NamespacedKey getNoteBlockSound() {
MinecraftKey key = getSnapshot().getNoteBlockSound();
return (key != null) ? CraftNamespacedKey.fromMinecraft(key) : null;
}
@Override
public void setNoteBlockSound(@Nullable NamespacedKey namespacedKey) {
if (namespacedKey == null) {
this.getSnapshot().noteBlockSound = null;
return;
}
this.getSnapshot().noteBlockSound = CraftNamespacedKey.toMinecraft(namespacedKey);
}
@Override
public BlockFace getRotation() {
BlockData blockData = getBlockData();