cn.nukkit.network.protocol.LevelSoundEventPacketV2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.network.protocol;
import cn.nukkit.math.Vector3f;
import lombok.ToString;
@ToString
public class LevelSoundEventPacketV2 extends LevelSoundEventPacket {
public static final byte NETWORK_ID = ProtocolInfo.LEVEL_SOUND_EVENT_PACKET_V2;
public int sound;
public float x;
public float y;
public float z;
public int extraData = -1;
public String entityIdentifier;
public boolean isBabyMob;
public boolean isGlobal;
@Override
public void decode() {
this.sound = this.getByte();
Vector3f v = this.getVector3f();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.extraData = this.getVarInt();
this.entityIdentifier = this.getString();
this.isBabyMob = this.getBoolean();
this.isGlobal = this.getBoolean();
}
@Override
public void encode() {
this.reset();
this.putByte((byte) this.sound);
this.putVector3f(this.x, this.y, this.z);
this.putVarInt(this.extraData);
this.putString(this.entityIdentifier);
this.putBoolean(this.isBabyMob);
this.putBoolean(this.isGlobal);
}
@Override
public byte pid() {
return NETWORK_ID;
}
}