Class BaseEvent
-
- All Implemented Interfaces:
public abstract class BaseEventAn event.
-
-
Method Summary
Modifier and Type Method Description final ServerLevelgetLevel()final UnitsetLevel(ServerLevel level)final EntitygetPlayer()final UnitsetPlayer(Entity player)final DelayedWorkQueue<BaseEvent>getQueue()final UnitsetQueue(DelayedWorkQueue<BaseEvent> queue)final IntegergetWeight()abstract Unitexecute(ServerLevel level, ServerPlayer player, Vec3 pos)Called when the event is executed. final Unitrun(ServerLevel level, ServerPlayer player, Vec3 pos)Executes the event. final UnitafterTicks(Integer afterTicks, Function0<Unit> action)Do some work (the actionparameter) on the server after a specified number of ticks.final Unitqueue(Integer afterTicks, Function0<Unit> action)Queue a task to run after the provided number of server ticks. final UnitplaySound(Vec3 pos, SoundEvent sound, Float volume, Float pitch)Play a sound at a location in the current level. final UnitplaySound(ServerLevel level, Vec3 pos, SoundEvent sound, Float volume, Float pitch)Play a sound at a location in a specific level. final UnitplayGlobalSound(SoundEvent sound, Float volume, Float pitch)Play a sound to all players in the current level. final UnitplayGlobalSound(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
actionparameter) 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.
-
-
-
-