Interface AffectEntityEvent
- All Superinterfaces:
Cancellable,Event
- All Known Subinterfaces:
ChangeInventoryEvent.Drop,ChangeInventoryEvent.Drop.Full,ChangeInventoryEvent.Drop.Single,ClickContainerEvent.Creative.Drop,ClickContainerEvent.Drop,ClickContainerEvent.Drop.Full,ClickContainerEvent.Drop.Outside,ClickContainerEvent.Drop.Outside.Primary,ClickContainerEvent.Drop.Outside.Secondary,ClickContainerEvent.Drop.Single,CollideEntityEvent,CollideEntityEvent.Impact,DropItemEvent.Close,DropItemEvent.Custom,DropItemEvent.Destruct,DropItemEvent.Dispense,ExplosionEvent.Detonate,LightningEvent.Strike,SpawnEntityEvent,SpawnEntityEvent.Custom,SpawnEntityEvent.Pre
- All Known Implementing Classes:
AbstractAffectEntityEvent,AbstractDetonateEvent,AbstractSpawnEntityEvent
An event that affects multiple
Entity instances as a bulk action.
The constraint is that if an action can be deemed as necessary for selective
individualized processing, such as DamageEntityEvent,
the actioned Event is handled individually. If a bulk of
Entity instances are being affected, for example by an
Explosion "damaging" a varying amount of Entity instances.
Other cases will be included as necessary.-
Method Summary
Modifier and TypeMethodDescriptionentities()Gets theListof entities who will be affected after event resolution.Gets anListof the entity data un-affected by event changes.voidfilterEntities(Predicate<Entity> predicate) Filters outEntity's fromentities()to be affected by this event.default voidfilterEntityLocations(Predicate<ServerLocation> predicate) Filters outServerLocation's fromentities()to be affected by this event.Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
Method Details
-
entitySnapshots
Gets anListof the entity data un-affected by event changes.This method MUST be called at
Order.PREin order to be properly initialized, after which it can be called at any time. If it is not first called atOrder.PRE, it will throw anIllegalStateExceptionwhen invoked.- Returns:
- The ImmutableList
- Throws:
IllegalStateException- If the method is called after the pre order
-
entities
Gets theListof entities who will be affected after event resolution. This list can only be modified usingfilterEntities(Predicate).- Returns:
- The list of entities that will be affected.
-
filterEntityLocations
Filters outServerLocation's fromentities()to be affected by this event.Locations for which the predicate returns
falsewill be removed fromentities().- Parameters:
predicate- The predicate to use for filtering
-
filterEntities
Filters outEntity's fromentities()to be affected by this event.Entities for which the predicate returns
falsewill be removed fromentities().- Parameters:
predicate- The predicate to use for filtering
-