public class DataTracker extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DataTracker.Entry<T> |
Modifier and Type | Field and Description |
---|---|
private boolean |
dirty |
private boolean |
empty |
private Map<Integer,DataTracker.Entry<?>> |
entries |
private ReadWriteLock |
lock |
private static Logger |
LOGGER |
private static Map<Class<? extends Entity>,Integer> |
TRACKED_ENTITIES |
private Entity |
trackedEntity |
Constructor and Description |
---|
DataTracker(Entity trackedEntity) |
private static final Logger LOGGER
private final Entity trackedEntity
private final Map<Integer,DataTracker.Entry<?>> entries
private final ReadWriteLock lock
private boolean empty
private boolean dirty
public DataTracker(Entity trackedEntity)
public static <T> TrackedData<T> registerData(Class<? extends Entity> entityClass, TrackedDataHandler<T> dataHandler)
public <T> void startTracking(TrackedData<T> key, T initialValue)
private <T> void addTrackedData(TrackedData<T> trackedData, T t)
private <T> DataTracker.Entry<T> getEntry(TrackedData<T> trackedData)
public <T> T get(TrackedData<T> trackedData)
public <T> void set(TrackedData<T> key, T t)
public boolean isDirty()
public static void entriesToPacket(List<DataTracker.Entry<?>> list, PacketByteBuf packetByteBuf)
@Nullable public List<DataTracker.Entry<?>> getDirtyEntries()
@Nullable public List<DataTracker.Entry<?>> getAllEntries()
private static <T> void writeEntryToPacket(PacketByteBuf packetByteBuf, DataTracker.Entry<T> entry)
@Nullable public static List<DataTracker.Entry<?>> deserializePacket(PacketByteBuf packetByteBuf)
private static <T> DataTracker.Entry<T> entryFromPacket(PacketByteBuf packetByteBuf, int int2, TrackedDataHandler<T> trackedDataHandler)
@Environment(value=CLIENT) public void writeUpdatedEntries(List<DataTracker.Entry<?>> list)
@Environment(value=CLIENT) private <T> void copyToFrom(DataTracker.Entry<T> entry, DataTracker.Entry<?> entry2)
public boolean isEmpty()
public void clearDirty()