use of com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound in project DragonProxy by DragonetMC.
the class PCPlaySoundPacketTranslator method translate.
public PEPacket[] translate(UpstreamSession session, ServerPlaySoundPacket packet) {
try {
String soundName;
if (BuiltinSound.class.isAssignableFrom(packet.getSound().getClass())) {
BuiltinSound sound = (BuiltinSound) packet.getSound();
soundName = sound.name();
} else {
soundName = ((CustomSound) packet.getSound()).getName();
}
if (soundName == null) {
return null;
}
PlaySoundPacket pk = new PlaySoundPacket();
pk.blockPosition = new BlockPosition((int) packet.getX(), (int) packet.getY(), (int) packet.getZ());
pk.name = soundName;
pk.volume = packet.getVolume();
pk.pitch = packet.getPitch();
return new PEPacket[] { pk };
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Aggregations