Interface EntityCompatibility
public interface EntityCompatibility
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThis enum outlines the different flags and their byte location for EntityMetaData. -
Method Summary
Modifier and TypeMethodDescriptiondefault FakeEntitygenerateFakeEntity(org.bukkit.Location location, org.bukkit.block.BlockState block) Shorthand forgenerateFakeEntity(Location, EntityType, Object).generateFakeEntity(org.bukkit.Location location, org.bukkit.entity.EntityType type, Object data) Generates aFakeEntitywith the given entity type as a disguise.default FakeEntitygenerateFakeEntity(org.bukkit.Location location, org.bukkit.inventory.ItemStack item) Shorthand forgenerateFakeEntity(Location, EntityType, Object).generateMetaPacket(org.bukkit.entity.Entity entity) Creates a metadata packet for the entity, force updating all metadata.voidinjectInventoryConsumer(@NotNull org.bukkit.entity.Player player, @NotNull EquipmentChangeConsumer consumer) Internal use only.voidmodifyMetaPacket(Object obj, EntityCompatibility.EntityMeta meta, boolean enabled) Sets the given entity metadata flag to true/false.voidsetSlot(org.bukkit.entity.Player player, org.bukkit.inventory.EquipmentSlot slot, @Nullable org.bukkit.inventory.ItemStack item) Uses a packet to spawn a fake item in the player's inventory.
-
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 overrideconsumer- The callback on inventory modifications
-
generateFakeEntity
FakeEntity generateFakeEntity(org.bukkit.Location location, org.bukkit.entity.EntityType type, Object data) Generates aFakeEntitywith 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 forgenerateFakeEntity(Location, EntityType, Object). Generates aItem.- 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 forgenerateFakeEntity(Location, EntityType, Object). Generates aFallingBlock.- 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 inGameMode.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 changeslot- The slot number to set.item- Which item to replace, or null.
-
generateMetaPacket
Creates a metadata packet for the entity, force updating all metadata. This can be modified bymodifyMetaPacket(Object, EntityMeta, boolean)to make the entity invisible, glow, etc.- Parameters:
entity- The non-null entity.- Returns:
- The non-null packet.
-
modifyMetaPacket
Sets the given entity metadata flag to true/false.- Parameters:
obj- The metadata packet fromgenerateMetaPacket(Entity)/meta- The meta flag you want to change.enabled- true/false.
-