mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Add EntitySoundEffectPacket
This commit is contained in:
parent
c1a9d298ad
commit
f1856bcd5c
2 changed files with 70 additions and 2 deletions
|
@ -58,6 +58,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareRecip
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDifficultyPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDisconnectPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerEntitySoundEffectPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket;
|
||||
|
@ -443,7 +444,7 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerIncoming(0x4D, ServerSpawnPositionPacket.class);
|
||||
this.registerIncoming(0x4E, ServerUpdateTimePacket.class);
|
||||
this.registerIncoming(0x4F, ServerTitlePacket.class);
|
||||
// 0x50 Entity Sound Effect
|
||||
this.registerIncoming(0x50, ServerEntitySoundEffectPacket.class);
|
||||
this.registerIncoming(0x51, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerIncoming(0x52, ServerStopSoundPacket.class);
|
||||
this.registerIncoming(0x53, ServerPlayerListDataPacket.class);
|
||||
|
@ -633,7 +634,7 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerOutgoing(0x4D, ServerSpawnPositionPacket.class);
|
||||
this.registerOutgoing(0x4E, ServerUpdateTimePacket.class);
|
||||
this.registerOutgoing(0x4F, ServerTitlePacket.class);
|
||||
// 0x50 Entity Sound Effect
|
||||
this.registerOutgoing(0x50, ServerEntitySoundEffectPacket.class);
|
||||
this.registerOutgoing(0x51, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerOutgoing(0x52, ServerStopSoundPacket.class);
|
||||
this.registerOutgoing(0x53, ServerPlayerListDataPacket.class);
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.sound.SoundCategory;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
public class ServerEntitySoundEffectPacket extends MinecraftPacket {
|
||||
|
||||
private int soundId;
|
||||
private SoundCategory soundCategory;
|
||||
private int entityId;
|
||||
private float volume;
|
||||
private float pitch;
|
||||
|
||||
public ServerEntitySoundEffectPacket() {
|
||||
}
|
||||
|
||||
public ServerEntitySoundEffectPacket(int soundId, SoundCategory soundCategory, int entityId, float volume, float pitch) {
|
||||
this.soundId = soundId;
|
||||
this.soundCategory = soundCategory;
|
||||
this.entityId = entityId;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public int getSoundId() {
|
||||
return soundId;
|
||||
}
|
||||
|
||||
public SoundCategory getSoundCategory() {
|
||||
return soundCategory;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.soundId = in.readVarInt();
|
||||
this.soundCategory = MagicValues.key(SoundCategory.class, in.readVarInt());
|
||||
this.entityId = in.readVarInt();
|
||||
this.volume = in.readFloat();
|
||||
this.pitch = in.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.soundId);
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.soundCategory));
|
||||
out.writeVarInt(this.entityId);
|
||||
out.writeFloat(this.volume);
|
||||
out.writeFloat(this.pitch);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue