mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
pitch Calculation (sound effect)
This commit is contained in:
parent
de8545eeb5
commit
3f65962581
@ -23,10 +23,11 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
|||||||
|
|
||||||
|
|
||||||
public class PacketSoundEffect implements ClientboundPacket {
|
public class PacketSoundEffect implements ClientboundPacket {
|
||||||
|
static float pitchCalc = 100.0F / 63.0F;
|
||||||
Location location;
|
Location location;
|
||||||
Sounds sound;
|
Sounds sound;
|
||||||
float volume;
|
float volume;
|
||||||
byte pitch;
|
int pitch;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||||
@ -35,7 +36,7 @@ public class PacketSoundEffect implements ClientboundPacket {
|
|||||||
sound = Sounds.byName(buffer.readString());
|
sound = Sounds.byName(buffer.readString());
|
||||||
location = new Location(buffer.readInteger() * 8, buffer.readInteger() * 8, buffer.readInteger() * 8);
|
location = new Location(buffer.readInteger() * 8, buffer.readInteger() * 8, buffer.readInteger() * 8);
|
||||||
volume = buffer.readFloat();
|
volume = buffer.readFloat();
|
||||||
pitch = buffer.readByte(); // ToDo 63 is 100%
|
pitch = (int) (buffer.readByte() * pitchCalc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +55,10 @@ public class PacketSoundEffect implements ClientboundPacket {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getPitch() {
|
/**
|
||||||
|
* @return Pitch in Percent * 100
|
||||||
|
*/
|
||||||
|
public int getPitch() {
|
||||||
return pitch;
|
return pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user