Class BaseEvent
-
- All Implemented Interfaces:
public abstract class BaseEvent
An event.
-
-
Method Summary
Modifier and Type Method Description final ServerLevel
getLevel()
final Unit
setLevel(ServerLevel level)
final Entity
getPlayer()
final Unit
setPlayer(Entity player)
final DelayedWorkQueue<BaseEvent>
getQueue()
final Unit
setQueue(DelayedWorkQueue<BaseEvent> queue)
final Integer
getWeight()
abstract Unit
execute(ServerLevel level, ServerPlayer player, Vec3 pos)
Called when the event is executed. final Unit
run(ServerLevel level, ServerPlayer player, Vec3 pos)
Executes the event. final Unit
afterTicks(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
playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch)
Play a sound at a location in the current level. final Unit
playSound(ServerLevel level, Vec3 pos, SoundEvent sound, Float volume, Float pitch)
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(ServerLevel 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 ServerLevel getLevel()
-
getPlayer
final Entity getPlayer()
-
getQueue
final DelayedWorkQueue<BaseEvent> getQueue()
-
setQueue
final Unit setQueue(DelayedWorkQueue<BaseEvent> queue)
-
execute
abstract Unit execute(ServerLevel level, ServerPlayer player, Vec3 pos)
Called when the event is executed.
-
run
final Unit run(ServerLevel level, ServerPlayer player, Vec3 pos)
Executes the event. This will call
execute()
, then start the queue.
-
afterTicks
final Unit afterTicks(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.
-
playSound
final Unit playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch)
Play a sound at a location in the current level.
-
playSound
final Unit playSound(ServerLevel level, Vec3 pos, SoundEvent sound, Float volume, Float pitch)
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(ServerLevel level, SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in a specific level.
-
-
-
-