@@ -1,7 +1,7 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.sounds.SoundEffect;
|
||||
import org.bukkit.Registry;
|
||||
@@ -11,20 +11,20 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
public class CraftSound {
|
||||
|
||||
public static SoundEffect getSoundEffect(String s) {
|
||||
SoundEffect effect = IRegistry.SOUND_EVENT.get(new MinecraftKey(s));
|
||||
SoundEffect effect = BuiltInRegistries.SOUND_EVENT.get(new MinecraftKey(s));
|
||||
Preconditions.checkArgument(effect != null, "Sound effect %s does not exist", s);
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
public static SoundEffect getSoundEffect(Sound s) {
|
||||
SoundEffect effect = IRegistry.SOUND_EVENT.get(CraftNamespacedKey.toMinecraft(s.getKey()));
|
||||
SoundEffect effect = BuiltInRegistries.SOUND_EVENT.get(CraftNamespacedKey.toMinecraft(s.getKey()));
|
||||
Preconditions.checkArgument(effect != null, "Sound effect %s does not exist", s);
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
public static Sound getBukkit(SoundEffect soundEffect) {
|
||||
return Registry.SOUNDS.get(CraftNamespacedKey.fromMinecraft(IRegistry.SOUND_EVENT.getKey(soundEffect)));
|
||||
return Registry.SOUNDS.get(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.SOUND_EVENT.getKey(soundEffect)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user