作者:苏汉文健康_706 | 来源:互联网 | 2024-10-29 18:25
本文整理了Java中net.minecraft.entity.player.EntityPlayer.canHarvestBlock()方法的一些代码示例,展示了EntityPlayer.canHar
本文整理了Java中net.minecraft.entity.player.EntityPlayer.canHarvestBlock()
方法的一些代码示例,展示了EntityPlayer.canHarvestBlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityPlayer.canHarvestBlock()
方法的具体详情如下:
包路径:net.minecraft.entity.player.EntityPlayer
类名称:EntityPlayer
方法名:canHarvestBlock
EntityPlayer.canHarvestBlock介绍
暂无
代码示例
代码示例来源:origin: Vazkii/Psi
public static boolean canHarvestBlock(Block block, EntityPlayer player, World world, BlockPos pos, ItemStack tool) {
IBlockState state = world.getBlockState(pos).getActualState(world, pos);
if (state.getMaterial().isToolNotRequired())
return true;
String toolType = block.getHarvestTool(state);
if (tool.isEmpty() || toolType == null)
return player.canHarvestBlock(state);
int toolLevel = tool.getItem().getHarvestLevel(tool, toolType, player, state);
if (toolLevel <0)
return player.canHarvestBlock(state);
return toolLevel >= block.getHarvestLevel(state);
}
}
代码示例来源:origin: Darkhax-Minecraft/Bookshelf
return player.canHarvestBlock(state);
return player.canHarvestBlock(state);
代码示例来源:origin: PrinceOfAmber/Cyclic
|| player.canHarvestBlock(targetState) == false
|| totalBroken >= this.getHarvestMax(level)
|| player.getHeldItem(player.swingingHand).isEmpty()) {