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.
    • 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.