UpdateHealthPacket
This commit is contained in:
@@ -60,6 +60,7 @@ public enum State {
|
||||
JoinGamePacket.class, 0x23,
|
||||
PlayerAbilitiesPacket.class,0x2C,
|
||||
SPlayerPositionAndLookPacket.class, 0x2F,
|
||||
UpdateHealthPacket.class, 0x41,
|
||||
SpawnPositionPacket.class, 0x46
|
||||
)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
|
||||
/**
|
||||
* Update Health Packet.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |-----------------|--------|----------------------------------|
|
||||
* | Health | Float | 0 = смерть; 20 = полное здоровье |
|
||||
* | Food | VarInt | 0-20 |
|
||||
* | Food Saturation | Float | 0-5 |
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Update_Health">Update Health</a>
|
||||
* @see <a href="https://minecraft.fandom.com/wiki/Food#Hunger_and_saturation">Food: Hunger and saturation</a>
|
||||
*/
|
||||
@Data
|
||||
public class UpdateHealthPacket implements ServerSidePacket {
|
||||
|
||||
private float health;
|
||||
private int food;
|
||||
private float foodSaturation;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeFloat(this.health);
|
||||
netByteBuf.writeVarInt(this.food);
|
||||
netByteBuf.writeFloat(this.foodSaturation);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user