Interface DataContainer

All Known Implementing Classes:
AnvilInventory, BeaconInventory, BrewingStandInventory, Chunk, DamageType, DynamicChunk, EnchantmentTableInventory, Entity, EntityAreaEffectCloud, EntityArmorStand, EntityBat, EntityBee, EntityBlaze, EntityBoat, EntityCat, EntityCaveSpider, EntityChicken, EntityCow, EntityCreature, EntityCreeper, EntityDamage, EntityDolphin, EntityEndermite, EntityEyeOfEnder, EntityFox, EntityGhast, EntityGiant, EntityGuardian, EntityIronGolem, EntityItemFrame, EntityMooshroom, EntityOcelot, EntityPanda, EntityPhantom, EntityPig, EntityPolarBear, EntityPotion, EntityProjectileDamage, EntityRabbit, EntitySilverfish, EntitySlime, EntitySnowman, EntitySpider, EntityWitch, EntityZombie, EntityZombifiedPiglin, ExperienceOrb, FakePlayer, FurnaceInventory, Instance, InstanceContainer, Inventory, ItemEntity, ItemStack, LivingEntity, ObjectEntity, Player, PlayerInventory, SharedInstance, VillagerInventory

public interface DataContainer
Represents an element which can have a Data attached to it.

The data will always be optional and can therefore be null.

  • Method Summary

    Modifier and Type Method Description
    Data getData()
    Gets the Data of this container.
    void setData​(Data data)
    Sets the Data of this container.
  • Method Details

    • getData

      @Nullable Data getData()
      Gets the Data of this container.

      A DataContainer data is always optional, meaning that this will be null if no data has been defined.

      Returns:
      the Data of this container, can be null
    • setData

      void setData​(@Nullable Data data)
      Sets the Data of this container.

      Default implementations are DataImpl and SerializableDataImpl depending on your use-case.

      Parameters:
      data - the new Data of this container, null to remove it