Class BaseEvent
-
- All Implemented Interfaces:
public abstract class BaseEvent
An event.
-
-
Method Summary
Modifier and Type Method Description final Level
getLevel()
final Unit
setLevel(Level level)
final Entity
getEntity()
final Unit
setEntity(Entity entity)
final DelayedWorkQueue<BaseEvent>
getQueue()
final Unit
setQueue(DelayedWorkQueue<BaseEvent> queue)
final Integer
getWeight()
abstract Unit
execute(Level level, Entity entity, Vec3 pos)
Called when the event is executed. final Unit
run(Level level, Entity entity)
Executes the event. final Unit
doWork(Integer afterTicks, Function0<Unit> action)
Do some work (the action
parameter) on the server after a specified number of ticks.final Unit
queue(Integer afterTicks, Function0<Unit> action)
Queue a task to run after the provided number of server ticks. final Unit
onServer(Function1<ServerLevel, Unit> action)
Only run the provided block if we're on the server-side. final Unit
broadcast(Component msg, Boolean bypassHiddenChat)
Broadcast a message to all players on the server. final EventConditionBuilder<Level, Entity>
condition()
Create a condition builder for execution. final Unit
playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a location in the current level. final Unit
playSound(Level level, Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a location in a specific level. final Unit
playGlobalSound(SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in the current level. final Unit
playGlobalSound(Level level, SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in a specific level. -
-
Constructor Detail
-
BaseEvent
BaseEvent(Integer weight)
-
-
Method Detail
-
getLevel
final Level getLevel()
-
getEntity
final Entity getEntity()
-
getQueue
final DelayedWorkQueue<BaseEvent> getQueue()
-
setQueue
final Unit setQueue(DelayedWorkQueue<BaseEvent> queue)
-
execute
abstract Unit execute(Level level, Entity entity, Vec3 pos)
Called when the event is executed.
-
run
final Unit run(Level level, Entity entity)
Executes the event. This will call
execute()
, then start the queue.
-
doWork
final Unit doWork(Integer afterTicks, Function0<Unit> action)
Do some work (the
action
parameter) on the server after a specified number of ticks.
-
queue
final Unit queue(Integer afterTicks, Function0<Unit> action)
Queue a task to run after the provided number of server ticks. Keep in mind that the ticks will be counted AFTER the rest of the event's execution.
-
onServer
final Unit onServer(Function1<ServerLevel, Unit> action)
Only run the provided block if we're on the server-side.
-
broadcast
final Unit broadcast(Component msg, Boolean bypassHiddenChat)
Broadcast a message to all players on the server.
-
condition
final EventConditionBuilder<Level, Entity> condition()
Create a condition builder for execution.
-
playSound
final Unit playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a location in the current level.
-
playSound
final Unit playSound(Level level, Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a location in a specific level.
-
playGlobalSound
final Unit playGlobalSound(SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in the current level.
-
playGlobalSound
final Unit playGlobalSound(Level level, SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in a specific level.
-
-
-
-