Commits
DerFrZocker authored and md_5 committed cc9aa21a289
10 10 | import org.bukkit.Sound; |
11 11 | import org.bukkit.World; |
12 12 | import org.bukkit.attribute.Attributable; |
13 13 | import org.bukkit.block.Block; |
14 14 | import org.bukkit.entity.memory.MemoryKey; |
15 15 | import org.bukkit.inventory.EntityEquipment; |
16 16 | import org.bukkit.inventory.ItemStack; |
17 17 | import org.bukkit.potion.PotionEffect; |
18 18 | import org.bukkit.potion.PotionEffectType; |
19 19 | import org.bukkit.projectiles.ProjectileSource; |
20 + | import org.bukkit.scoreboard.Scoreboard; |
21 + | import org.bukkit.scoreboard.Team; |
20 22 | import org.bukkit.util.RayTraceResult; |
21 23 | import org.bukkit.util.Vector; |
22 24 | import org.jetbrains.annotations.NotNull; |
23 25 | import org.jetbrains.annotations.Nullable; |
24 26 | |
25 27 | /** |
26 28 | * Represents a living entity, such as a monster or player |
27 29 | */ |
28 30 | public interface LivingEntity extends Attributable, Damageable, ProjectileSource { |
29 31 | |
554 556 | * entity, where 0 is in front of the player, 90 is to the right, 180 is |
555 557 | * behind, and 270 is to the left |
556 558 | */ |
557 559 | public void playHurtAnimation(float yaw); |
558 560 | |
559 561 | /** |
560 562 | * Set if this entity will be subject to collisions with other entities. |
561 563 | * <p> |
562 564 | * Exemptions to this rule can be managed with |
563 565 | * {@link #getCollidableExemptions()} |
566 + | * <p> |
567 + | * Note that the client may predict the collision between itself and another |
568 + | * entity, resulting in this flag not working for player collisions. This |
569 + | * method should therefore only be used to set the collision status of |
570 + | * non-player entities. |
571 + | * <p> |
572 + | * To control player collisions, use {@link Team.Option#COLLISION_RULE} in |
573 + | * combination with a {@link Scoreboard} and a {@link Team}. |
564 574 | * |
565 575 | * @param collidable collision status |
566 576 | */ |
567 577 | void setCollidable(boolean collidable); |
568 578 | |
569 579 | /** |
570 580 | * Gets if this entity is subject to collisions with other entities. |
571 581 | * <p> |
572 582 | * Some entities might be exempted from the collidable rule of this entity. |
573 583 | * Use {@link #getCollidableExemptions()} to get these. |
574 584 | * <p> |
575 585 | * Please note that this method returns only the custom collidable state, |
576 586 | * not whether the entity is non-collidable for other reasons such as being |
577 587 | * dead. |
588 + | * <p> |
589 + | * Note that the client may predict the collision between itself and another |
590 + | * entity, resulting in this flag not being accurate for player collisions. |
591 + | * This method should therefore only be used to check the collision status |
592 + | * of non-player entities. |
593 + | * <p> |
594 + | * To check the collision behavior for a player, use |
595 + | * {@link Team.Option#COLLISION_RULE} in combination with a |
596 + | * {@link Scoreboard} and a {@link Team}. |
578 597 | * |
579 598 | * @return collision status |
580 599 | */ |
581 600 | boolean isCollidable(); |
582 601 | |
583 602 | /** |
584 603 | * Gets a mutable set of UUIDs of the entities which are exempt from the |
585 604 | * entity's collidable rule and which's collision with this entity will |
586 605 | * behave the opposite of it. |
587 606 | * <p> |
588 607 | * This set can be modified to add or remove exemptions. |
589 608 | * <p> |
590 609 | * For example if collidable is true and an entity is in the exemptions set |
591 610 | * then it will not collide with it. Similarly if collidable is false and an |
592 611 | * entity is in this set then it will still collide with it. |
593 612 | * <p> |
594 613 | * Note these exemptions are not (currently) persistent. |
614 + | * <p> |
615 + | * Note that the client may predict the collision between itself and another |
616 + | * entity, resulting in those exemptions not being accurate for player |
617 + | * collisions. This method should therefore only be used to exempt |
618 + | * non-player entities. |
619 + | * <p> |
620 + | * To exempt collisions for a player, use {@link Team.Option#COLLISION_RULE} |
621 + | * in combination with a {@link Scoreboard} and a {@link Team}. |
595 622 | * |
596 623 | * @return the collidable exemption set |
597 624 | */ |
598 625 | |
599 626 | Set<UUID> getCollidableExemptions(); |
600 627 | |
601 628 | /** |
602 629 | * Returns the value of the memory specified. |
603 630 | * <p> |
604 631 | * Note that the value is null when the specific entity does not have that |