cn.nukkit.network.protocol.RespawnPacket 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;
/**
* @author Nukkit Project Team
*/
@ToString
public class RespawnPacket extends DataPacket {
public static final byte NETWORK_ID = ProtocolInfo.RESPAWN_PACKET;
public static final int STATE_SEARCHING_FOR_SPAWN = 0;
public static final int STATE_READY_TO_SPAWN = 1;
public static final int STATE_CLIENT_READY_TO_SPAWN = 2;
public float x;
public float y;
public float z;
public int respawnState = STATE_SEARCHING_FOR_SPAWN;
public long runtimeEntityId;
@Override
public void decode() {
Vector3f v = this.getVector3f();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.respawnState = this.getByte();
this.runtimeEntityId = this.getEntityRuntimeId();
}
@Override
public void encode() {
this.reset();
this.putVector3f(this.x, this.y, this.z);
this.putByte((byte) respawnState);
this.putEntityRuntimeId(runtimeEntityId);
}
@Override
public byte pid() {
return NETWORK_ID;
}
}