private static boolean trySleep(World world, EntityPlayer player) {
final BlockPos pos = player.getPosition();
if (!isNotSuffocating(world, pos) || !isSolidEnough(world, pos.down())) {
player.sendMessage(new TextComponentTranslation("openblocks.misc.oh_no_ground"));
return false;
}
final EntityPlayer.SleepResult sleepResult = player.trySleep(pos);
if (sleepResult == SleepResult.OK) return true;
switch (sleepResult) {
case NOT_POSSIBLE_NOW:
player.sendMessage(new TextComponentTranslation("tile.bed.noSleep"));
break;
case NOT_SAFE:
player.sendMessage(new TextComponentTranslation("tile.bed.notSafe"));
break;
default:
break;
}
return false;
}
ItemSleepingBag.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:OpenBlocks
作者:
评论列表
文章目录