Class EventConditionBuilder
-
- All Implemented Interfaces:
public final class EventConditionBuilder<L extends Level, E extends Entity>
A condition builder for events. Essentially, this allows you to chain a set of type-safe conditions to ensure many things, including what the entity is, which side is being used, and other things.
-
-
Constructor Summary
Constructors Constructor Description EventConditionBuilder(L level, E entity)
EventConditionBuilder(L level, E entity, Integer afterTicks)
-
Method Summary
Modifier and Type Method Description final L
getLevel()
final E
getEntity()
final Integer
getAfterTicks()
final Unit
setAfterTicks(Integer afterTicks)
final EventConditionBuilder<L, E>
after(Integer afterTicks, Function2<L, E, Unit> action)
Make this condition execute after a set number of ticks. final EventConditionBuilder<ServerLevel, E>
onServer(Function2<ServerLevel, E, Unit> action)
Make this condition execute only if we are on the server-side. final EventConditionBuilder<ClientLevel, E>
onClient(Function2<ClientLevel, E, Unit> action)
Make this condition execute only if we are on the client-side. final EventConditionBuilder<L, LivingEntity>
ifLiving(Function2<L, LivingEntity, Unit> action)
Make this condition execute only if the entity is a LivingEntity. final EventConditionBuilder<L, Mob>
ifMob(Function2<L, Mob, Unit> action)
Make this condition execute only if the entity is a Mob. final EventConditionBuilder<L, Player>
ifPlayer(Function2<L, Player, Unit> action)
Make this condition execute only if the entity is a Player. final EventConditionBuilder<L, ServerPlayer>
ifServerPlayer(Function2<L, ServerPlayer, Unit> action)
Make this condition execute only if the entity is a ServerPlayer. final EventConditionBuilder<L, LocalPlayer>
isLocalPlayer(Function2<L, LocalPlayer, Unit> action)
Make this condition execute only if the entity is a LocalPlayer. final Unit
invoke(Function2<L, E, Unit> action)
Execute the condition. -
-
Method Detail
-
getAfterTicks
final Integer getAfterTicks()
-
setAfterTicks
final Unit setAfterTicks(Integer afterTicks)
-
after
final EventConditionBuilder<L, E> after(Integer afterTicks, Function2<L, E, Unit> action)
Make this condition execute after a set number of ticks.
-
onServer
final EventConditionBuilder<ServerLevel, E> onServer(Function2<ServerLevel, E, Unit> action)
Make this condition execute only if we are on the server-side.
-
onClient
final EventConditionBuilder<ClientLevel, E> onClient(Function2<ClientLevel, E, Unit> action)
Make this condition execute only if we are on the client-side.
-
ifLiving
final EventConditionBuilder<L, LivingEntity> ifLiving(Function2<L, LivingEntity, Unit> action)
Make this condition execute only if the entity is a LivingEntity.
-
ifMob
final EventConditionBuilder<L, Mob> ifMob(Function2<L, Mob, Unit> action)
Make this condition execute only if the entity is a Mob.
-
ifPlayer
final EventConditionBuilder<L, Player> ifPlayer(Function2<L, Player, Unit> action)
Make this condition execute only if the entity is a Player.
-
ifServerPlayer
final EventConditionBuilder<L, ServerPlayer> ifServerPlayer(Function2<L, ServerPlayer, Unit> action)
Make this condition execute only if the entity is a ServerPlayer.
-
isLocalPlayer
final EventConditionBuilder<L, LocalPlayer> isLocalPlayer(Function2<L, LocalPlayer, Unit> action)
Make this condition execute only if the entity is a LocalPlayer.
-
-
-
-