use of net.minecraftforge.event.entity.player.PlayerSleepInBedEvent in project MinecraftForge by MinecraftForge.
the class ForgeEventFactory method onPlayerSleepInBed.
public static SleepResult onPlayerSleepInBed(EntityPlayer player, BlockPos pos) {
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
MinecraftForge.EVENT_BUS.post(event);
return event.getResultStatus();
}
use of net.minecraftforge.event.entity.player.PlayerSleepInBedEvent in project SpongeForge by SpongePowered.
the class SpongeForgeEventFactory method createPlayerSleepInBedEvent.
// Player events
public static PlayerSleepInBedEvent createPlayerSleepInBedEvent(Event event) {
SleepingEvent.Pre spongeEvent = (SleepingEvent.Pre) event;
Optional<Player> player = spongeEvent.getCause().first(Player.class);
if (!player.isPresent()) {
return null;
}
Location<World> location = spongeEvent.getBed().getLocation().get();
BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
return new PlayerSleepInBedEvent((EntityPlayer) player.get(), pos);
}
use of net.minecraftforge.event.entity.player.PlayerSleepInBedEvent in project MinecraftForge by MinecraftForge.
the class ForgeEventFactory method onPlayerSleepInBed.
public static BedSleepingProblem onPlayerSleepInBed(Player player, Optional<BlockPos> pos) {
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
MinecraftForge.EVENT_BUS.post(event);
return event.getResultStatus();
}
Aggregations