CanPlayerSleepEvent

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.neoforge.api.event.entity.player.CanPlayerSleepEvent;

Extends

CanPlayerSleepEvent extends PlayerEvent.

Listening to the event

This event can be listened to like so:

script.zs
events.register<crafttweaker.neoforge.api.event.entity.player.CanPlayerSleepEvent>(event => {
println("CanPlayerSleepEvent ran!");
});

Members

Getter
script.zs
// CanPlayerSleepEvent.entity as ServerPlayer
event.entity

Return Type: ServerPlayer

Getter
script.zs
// CanPlayerSleepEvent.level as Level
event.level

Return Type: Level

Getter
script.zs
// CanPlayerSleepEvent.pos as BlockPos
event.pos

Return Type: BlockPos

Getter
script.zs
// CanPlayerSleepEvent.problem as BedSleepingProblem
event.problem

Return Type: PlayerBedSleepingProblem

Setter
script.zs
// CanPlayerSleepEvent.problem = (problem as BedSleepingProblem);
event.problem = myBedSleepingProblem;
Getter
script.zs
// CanPlayerSleepEvent.state as BlockState
event.state

Return Type: BlockState

Getter
script.zs
// CanPlayerSleepEvent.vanillaProblem as BedSleepingProblem
event.vanillaProblem

Return Type: PlayerBedSleepingProblem