Package net.glowstone.io.entity
Class EntityStorage
java.lang.Object
net.glowstone.io.entity.EntityStorage
The class responsible for mapping entity types to their storage methods and reading and writing
entity data using those storage methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends GlowEntity>
voidbind
(EntityStore<T> store) Binds a store by adding entries for it to the tables.static <T extends GlowEntity>
TCreates an entity of the given Glowstone class, by deserializing an empty tag.static void
load
(GlowEntity entity, CompoundTag compound) Load an entity's data from the given compound tag.static GlowEntity
loadEntity
(GlowWorld world, CompoundTag compound) Load a new entity in the given world from the given data tag.static void
save
(GlowEntity entity, CompoundTag compound) Save an entity's data to the given compound tag.
-
Method Details
-
create
Creates an entity of the given Glowstone class, by deserializing an empty tag.- Type Parameters:
T
- the type of entity- Parameters:
clazz
- the type of entitylocation
- the entity's initial location
-
bind
Binds a store by adding entries for it to the tables.- Type Parameters:
T
- The type of entity.- Parameters:
store
- The store object.
-
loadEntity
Load a new entity in the given world from the given data tag.- Parameters:
world
- The target world.compound
- The tag to load from.- Returns:
- The newly constructed entity.
- Throws:
IllegalArgumentException
- if there is an error in the data.
-
save
Save an entity's data to the given compound tag.- Parameters:
entity
- The entity to save.compound
- The target tag.
-
load
Load an entity's data from the given compound tag.- Parameters:
entity
- The target entity.compound
- The tag to load from.
-