Expand on entity serialization API (#11807)

This commit is contained in:
SoSeDiK
2024-12-27 01:08:00 +02:00
committed by GitHub
parent 0efd3012c9
commit aac246ae29
8 changed files with 275 additions and 77 deletions

View File

@@ -0,0 +1,38 @@
package io.papermc.paper.entity;
import org.bukkit.UnsafeValues;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
/**
* Represents flags for entity serialization.
*
* @see UnsafeValues#serializeEntity(Entity, EntitySerializationFlag... serializationFlags)
* @since 1.21.4
*/
public enum EntitySerializationFlag {
/**
* Serialize entities that wouldn't be serialized normally
* (e.g. dead, despawned, non-persistent, etc.).
*
* @see Entity#isValid()
* @see Entity#isPersistent()
*/
FORCE,
/**
* Serialize misc non-saveable entities like lighting bolts, fishing bobbers, etc.
* <br>Note: players require a separate flag: {@link #PLAYER}.
*/
MISC,
/**
* Include passengers in the serialized data.
*/
PASSENGERS,
/**
* Allow serializing {@link Player}s.
* <p>Note: deserializing player data will always fail.
*/
PLAYER
}