mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 11:15:57 -07:00
SPIGOT-2106, SPIGOT-3942: Improve collidable API
By: Phoenix616 <mail@moep.tv>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit.entity;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import org.bukkit.FluidCollisionMode;
|
import org.bukkit.FluidCollisionMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -486,11 +487,10 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|||||||
public void swingOffHand();
|
public void swingOffHand();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if this entity will be subject to collisions other entities.
|
* Set if this entity will be subject to collisions with other entities.
|
||||||
* <p>
|
* <p>
|
||||||
* Note that collisions are bidirectional, so this method would need to be
|
* Exemptions to this rule can be managed with
|
||||||
* set to false on both the collidee and the collidant to ensure no
|
* {@link #getCollidableExemptions()}
|
||||||
* collisions take place.
|
|
||||||
*
|
*
|
||||||
* @param collidable collision status
|
* @param collidable collision status
|
||||||
*/
|
*/
|
||||||
@@ -499,6 +499,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|||||||
/**
|
/**
|
||||||
* Gets if this entity is subject to collisions with other entities.
|
* Gets if this entity is subject to collisions with other entities.
|
||||||
* <p>
|
* <p>
|
||||||
|
* Some entities might be exempted from the collidable rule of this entity.
|
||||||
|
* Use {@link #getCollidableExemptions()} to get these.
|
||||||
|
* <p>
|
||||||
* Please note that this method returns only the custom collidable state,
|
* Please note that this method returns only the custom collidable state,
|
||||||
* not whether the entity is non-collidable for other reasons such as being
|
* not whether the entity is non-collidable for other reasons such as being
|
||||||
* dead.
|
* dead.
|
||||||
@@ -507,6 +510,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|||||||
*/
|
*/
|
||||||
boolean isCollidable();
|
boolean isCollidable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a mutable set of UUIDs of the entities which are exempt from the
|
||||||
|
* entity's collidable rule and which's collision with this entity will
|
||||||
|
* behave the opposite of it.
|
||||||
|
* <p>
|
||||||
|
* This set can be modified to add or remove exemptions.
|
||||||
|
* <p>
|
||||||
|
* For example if collidable is true and an entity is in the exemptions set
|
||||||
|
* then it will not collide with it. Similarly if collidable is false and an
|
||||||
|
* entity is in this set then it will still collide with it.
|
||||||
|
* <p>
|
||||||
|
* Note these exemptions are not (currently) persistent.
|
||||||
|
*
|
||||||
|
* @return the collidable exemption set
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Set<UUID> getCollidableExemptions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the memory specified.
|
* Returns the value of the memory specified.
|
||||||
* <p>
|
* <p>
|
||||||
|
Reference in New Issue
Block a user