public interface IStatus extends ITagSerializable
IExtendedEntityProperties.
Use EntityHandler to attach this on an entity.
IExtendedEntityProperties,
EntityHandler| 限定符和类型 | 方法和说明 |
|---|---|
void |
build(net.minecraft.entity.Entity entity,
VarSyncFactory factory)
The initialization method of this status.
|
readFromNBT, writeToNBTvoid build(net.minecraft.entity.Entity entity,
VarSyncFactory factory)
The factory here can create the variables that sync automatically between client and server. So you don't need to consider about the sync problem when you use these variables.
They are implemented by DataWatcher which has a maximum limit. So use this only
if you want a value
showing on screen or having any other usages in client side.
The variable created by factory also doesn't need to be saved and loaded when
ITagSerializable.readFromNBT(NBTTagCompound) and ITagSerializable.writeToNBT(NBTTagCompound), since they
will be saved automatically.
The name of the variable when you create it is the reference for save/load. So, changing its name will lost the old data.
entity - The entity.factory - The factory which provide the variable auto-synchronized between Server and Client sides.