use of net.minecraft.network.play.server.SPlaySoundPacket in project Magma-1.16.x by magmafoundation.
the class CraftWorld method playSound.
@Override
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
if (loc == null || sound == null || category == null)
return;
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
SPlaySoundPacket packet = new SPlaySoundPacket(new ResourceLocation(sound), SoundCategory.valueOf(category.name()), new Vector3d(x, y, z), volume, pitch);
world.getServer().getPlayerList().broadcast(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension(), packet);
}
use of net.minecraft.network.play.server.SPlaySoundPacket in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method playSound.
@Override
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
if (loc == null || sound == null || category == null || getHandle().connection == null)
return;
SPlaySoundPacket packet = new SPlaySoundPacket(new ResourceLocation(sound), net.minecraft.util.SoundCategory.valueOf(category.name()), new Vector3d(loc.getX(), loc.getY(), loc.getZ()), volume, pitch);
getHandle().connection.send(packet);
}
use of net.minecraft.network.play.server.SPlaySoundPacket in project LoliServer by Loli-Server.
the class CraftPlayer method playSound.
@Override
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
if (loc == null || sound == null || category == null || getHandle().connection == null)
return;
SPlaySoundPacket packet = new SPlaySoundPacket(new ResourceLocation(sound), net.minecraft.util.SoundCategory.valueOf(category.name()), new Vector3d(loc.getX(), loc.getY(), loc.getZ()), volume, pitch);
getHandle().connection.send(packet);
}
use of net.minecraft.network.play.server.SPlaySoundPacket in project LoliServer by Loli-Server.
the class CraftWorld method playSound.
@Override
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
if (loc == null || sound == null || category == null)
return;
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
SPlaySoundPacket packet = new SPlaySoundPacket(new ResourceLocation(sound), SoundCategory.valueOf(category.name()), new Vector3d(x, y, z), volume, pitch);
world.getServer().getPlayerList().broadcast(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension(), packet);
}
use of net.minecraft.network.play.server.SPlaySoundPacket in project Magma-1.16.x by magmafoundation.
the class CraftPlayer method playSound.
@Override
public void playSound(final net.kyori.adventure.sound.Sound sound, final double x, final double y, final double z) {
final ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name());
final java.util.Optional<SoundEvent> event = Registry.SOUND_EVENT.getOptional(name);
if (event.isPresent()) {
this.getHandle().connection.send(new SPlaySoundEffectPacket(event.get(), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), x, y, z, sound.volume(), sound.pitch()));
} else {
this.getHandle().connection.send(new SPlaySoundPacket(name, io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), new Vector3d(x, y, z), sound.volume(), sound.pitch()));
}
}
Aggregations