Class EntityStorage

java.lang.Object
net.glowstone.io.entity.EntityStorage

public final class EntityStorage extends Object
The class responsible for mapping entity types to their storage methods and reading and writing entity data using those storage methods.
  • Method Details

    • create

      public static <T extends GlowEntity> T create(Class<T> clazz, org.bukkit.Location location)
      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 entity
      location - the entity's initial location
    • bind

      public static <T extends GlowEntity> void bind(EntityStore<T> store)
      Binds a store by adding entries for it to the tables.
      Type Parameters:
      T - The type of entity.
      Parameters:
      store - The store object.
    • loadEntity

      public static GlowEntity loadEntity(GlowWorld world, CompoundTag compound)
      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

      public static void save(GlowEntity entity, CompoundTag compound)
      Save an entity's data to the given compound tag.
      Parameters:
      entity - The entity to save.
      compound - The target tag.
    • load

      public static void load(GlowEntity entity, CompoundTag compound)
      Load an entity's data from the given compound tag.
      Parameters:
      entity - The target entity.
      compound - The tag to load from.