@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote) {
EntityPlayerMP mp = (EntityPlayerMP) player;
// final EntityPlayer.SleepResult result = player.trySleep(player.getPosition());
//trySleep was changed in 1.11.2 to literally check for the specific exact Blocks.BED in world. because fuck modders amirite?
//and it just assumes unsafely its there and then dies.
EntityPlayer.SleepResult result = this.canPlayerSleep(player, world);
if (result == EntityPlayer.SleepResult.OK) {
final IPlayerExtendedProperties sleep = CapabilityRegistry.getPlayerProperties(player);
if (sleep != null) {
onSleepSuccess(world, hand, stack, mp, sleep);
}
else {
//should never happen... but just in case
UtilChat.addChatMessage(player, "tile.bed.noSleep");
}
}
else {
UtilChat.addChatMessage(player, "tile.bed.noSleep");
}
}
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
ItemSleepingMat.java 文件源码
java
阅读 156
收藏 0
点赞 0
评论 0
项目:Cyclic
作者:
评论列表
文章目录