Interface EntityCompatibility


public interface EntityCompatibility
  • Method Details

    • injectInventoryConsumer

      void injectInventoryConsumer(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull EquipmentChangeConsumer consumer)
      Internal use only.

      Overrides the player's handle's inventory with a proxy that calls the consumer. The consumer will have the old item, the new item, and the modified slot.

      Parameters:
      player - The player to override
      consumer - The callback on inventory modifications
    • generateFakeEntity

      FakeEntity generateFakeEntity(org.bukkit.Location location, org.bukkit.entity.EntityType type, Object data)
      Generates a FakeEntity with the given entity type as a disguise.
      Parameters:
      location - The non-null starting location of the entity.
      type - The non-null type of the entity.
      data - The nullable extra data for item/fallingblock/armorstand.
      Returns:
      The fake entity.
    • generateFakeEntity

      default FakeEntity generateFakeEntity(org.bukkit.Location location, org.bukkit.inventory.ItemStack item)
      Shorthand for generateFakeEntity(Location, EntityType, Object). Generates a Item.
      Parameters:
      location - The non-null starting location of the entity.
      item - The non-null item to show.
      Returns:
      The fake entity.
    • generateFakeEntity

      default FakeEntity generateFakeEntity(org.bukkit.Location location, org.bukkit.block.BlockState block)
      Shorthand for generateFakeEntity(Location, EntityType, Object). Generates a FallingBlock.
      Parameters:
      location - The non-null starting location of the entity.
      block - The non-null block state to show.
      Returns:
      The fake entity.
    • generateFakeDisplay

      default <T extends FakeEntity & FakeDisplayEntity> T generateFakeDisplay(org.bukkit.Location location, org.bukkit.entity.EntityType type, @Nullable @Nullable Object data)
      Generates a packet based FakeDisplayEntity.
      Type Parameters:
      T - The returned object is both a FakeEntity and a FakeDisplayEntity.
      Parameters:
      location - The non-null starting location of the entity.
      type - The non-null display type (EntityType.BLOCK_DISPLAY, EntityType.ITEM_DISPLAY, or EntityType.TEXT_DISPLAY).
      data - The nullable initial data: a BlockData for block displays, an ItemStack for item displays, or a Component for text displays.
      Returns:
      The fake display entity.
    • generateFakeBlockDisplay

      default <T extends FakeEntity & FakeDisplayEntity> T generateFakeBlockDisplay(org.bukkit.Location location, org.bukkit.block.data.BlockData block)
      Shorthand for generateFakeDisplay(Location, EntityType, Object). Generates a BlockDisplay.
      Type Parameters:
      T - The returned object is both a FakeEntity and a FakeDisplayEntity.
      Parameters:
      location - The non-null starting location of the entity.
      block - The non-null block to show.
      Returns:
      The fake display entity.
    • generateFakeItemDisplay

      default <T extends FakeEntity & FakeDisplayEntity> T generateFakeItemDisplay(org.bukkit.Location location, org.bukkit.inventory.ItemStack item)
      Shorthand for generateFakeDisplay(Location, EntityType, Object). Generates an ItemDisplay.
      Type Parameters:
      T - The returned object is both a FakeEntity and a FakeDisplayEntity.
      Parameters:
      location - The non-null starting location of the entity.
      item - The non-null item to show.
      Returns:
      The fake display entity.
    • generateFakeTextDisplay

      default <T extends FakeEntity & FakeDisplayEntity> T generateFakeTextDisplay(org.bukkit.Location location, net.kyori.adventure.text.Component text)
      Shorthand for generateFakeDisplay(Location, EntityType, Object). Generates a TextDisplay.
      Type Parameters:
      T - The returned object is both a FakeEntity and a FakeDisplayEntity.
      Parameters:
      location - The non-null starting location of the entity.
      text - The non-null text to show.
      Returns:
      The fake display entity.
    • setSlot

      void setSlot(org.bukkit.entity.Player player, org.bukkit.inventory.EquipmentSlot slot, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Uses a packet to spawn a fake item in the player's inventory. If the player is in GameMode.CREATIVE, then they will be able to grab the item, regardless. This issue isn't present with standard players.
      Parameters:
      player - The non-null player to see the change
      slot - The slot number to set.
      item - Which item to replace, or null.
    • generateMetaPacket

      Object generateMetaPacket(org.bukkit.entity.Entity entity)
      Creates a metadata packet for the entity, force updating all metadata. This can be modified by modifyMetaPacket(Object, EntityMeta, boolean) to make the entity invisible, glow, etc.
      Parameters:
      entity - The non-null entity.
      Returns:
      The non-null packet.
    • modifyMetaPacket

      void modifyMetaPacket(Object obj, EntityCompatibility.EntityMeta meta, boolean enabled)
      Sets the given entity metadata flag to true/false.
      Parameters:
      obj - The metadata packet from generateMetaPacket(Entity)/
      meta - The meta flag you want to change.
      enabled - true/false.