本文整理了Java中net.minecraft.block.Block.getHarvestTool()
方法的一些代码示例,展示了Block.getHarvestTool()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getHarvestTool()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:getHarvestTool
暂无
代码示例来源:origin: SlimeKnights/TinkersConstruct
/**
* Checks if an item has the right harvest level of the correct type for the block.
*/
public static boolean canHarvest(ItemStack stack, IBlockState state) {
Block block = state.getBlock();
// doesn't require a tool
if(state.getMaterial().isToolNotRequired()) {
return true;
}
String type = block.getHarvestTool(state);
int level = block.getHarvestLevel(state);
return stack.getItem().getHarvestLevel(stack, type, null, state) >= level;
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
Block block = event.getState().getBlock();
int hlvl = tool.getItem().getHarvestLevel(tool, block.getHarvestTool(event.getState()), event.getEntityPlayer(), event.getState());
int dif = hlvl - block.getHarvestLevel(event.getState());
// 1 speed per harvest level above
if(dif > 0) {
event.setNewSpeed(event.getNewSpeed() + dif);
}
}
代码示例来源:origin: AlgorithmX2/Chisels-and-Bits
@Override
public String getHarvestTool(
final IBlockState state )
{
return Blocks.STONE.getHarvestTool( Blocks.STONE.getDefaultState() );
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return tool != null && tool.equals("cutter");
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return tool != null && tool.equals("scoop");
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("hoe")) ||
block.getMaterial() == Material.GROUND;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("screwdriver")) ||
block.getMaterial() == Material.CIRCUITS;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("axe")) ||
block.getMaterial() == Material.WOOD;
}
代码示例来源:origin: Ellpeck/ActuallyAdditions
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state){
if(state.getBlock() == Blocks.WEB){
return 15.0F;
}
else{
return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.efficiency : 1.0F;
}
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState blockState, ItemStack stack) {
Block block = blockState.getBlock();
String tool = block.getHarvestTool(blockState);
return (tool != null && tool.equals("wrench"))
|| blockState.getMaterial() == Material.PISTON
|| block == Blocks.HOPPER
|| block == Blocks.DISPENSER
|| block == Blocks.DROPPER
|| blockState.getMaterial() == Material.IRON;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("plow")) ||
block.getMaterial() == Material.SNOW ||
block.getMaterial() == Material.CRAFTED_SNOW;
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public BlockStairsTFC(Rock rock, Rock.Type type)
{
super(BlockRockVariant.get(rock, type).getDefaultState());
if (!ROCK_TABLE.containsKey(rock))
ROCK_TABLE.put(rock, new EnumMap<>(Rock.Type.class));
ROCK_TABLE.get(rock).put(type, this);
Block c = BlockRockVariant.get(rock, type);
setHarvestLevel(c.getHarvestTool(c.getDefaultState()), c.getHarvestLevel(c.getDefaultState()));
OreDictionaryHelper.register(this, "stair");
OreDictionaryHelper.registerRockType(this, type, rock, "stair");
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
ItemStack itemStack = new ItemStack(block.getBlock(), 1, block.getBlock().getMetaFromState(block));
return (tool != null && (tool.equals("hammer") || tool.equals("pickaxe"))) ||
block.getMaterial() == Material.ROCK ||
block.getMaterial() == Material.GLASS ||
block.getMaterial() == Material.ICE ||
block.getMaterial() == Material.PACKED_ICE ||
RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList()) != null;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("pickaxe")) ||
block.getMaterial() == Material.ROCK ||
block.getMaterial() == Material.IRON ||
block.getMaterial() == Material.ANVIL ||
block.getMaterial() == Material.GLASS;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
ItemStack itemStack = new ItemStack(block.getBlock(), 1, block.getBlock().getMetaFromState(block));
return (tool != null && (tool.equals("hammer") || tool.equals("pickaxe"))) ||
block.getMaterial() == Material.ROCK ||
block.getMaterial() == Material.GLASS ||
block.getMaterial() == Material.ICE ||
block.getMaterial() == Material.PACKED_ICE ||
RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(Long.MAX_VALUE,
Collections.singletonList(itemStack), Collections.emptyList()) != null;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && (tool.equals("axe") || tool.equals("saw"))) ||
block.getMaterial() == Material.LEAVES ||
block.getMaterial() == Material.VINE ||
block.getMaterial() == Material.WOOD ||
block.getMaterial() == Material.CACTUS ||
block.getMaterial() == Material.ICE ||
block.getMaterial() == Material.PACKED_ICE;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public boolean isMinableBlock(IBlockState block, ItemStack stack) {
String tool = block.getBlock().getHarvestTool(block);
return (tool != null && tool.equals("shovel")) ||
block.getMaterial() == Material.SAND ||
block.getMaterial() == Material.GRASS ||
block.getMaterial() == Material.GROUND ||
block.getMaterial() == Material.SNOW ||
block.getMaterial() == Material.CLAY;
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public BlockStairsTFC(Tree wood)
{
super(BlockPlanksTFC.get(wood).getDefaultState());
if (WOOD_MAP.put(wood, this) != null) throw new IllegalStateException("There can only be one.");
Block c = BlockPlanksTFC.get(wood);
setHarvestLevel(c.getHarvestTool(c.getDefaultState()), c.getHarvestLevel(c.getDefaultState()));
OreDictionaryHelper.register(this, "stair");
OreDictionaryHelper.register(this, "stair", "wood");
OreDictionaryHelper.register(this, "stair", "wood", wood);
Blocks.FIRE.setFireInfo(this, 5, 20);
}
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
private BlockSlabTFC(Rock rock, Rock.Type type)
{
this(BlockRockVariant.get(rock, type));
Block c = BlockRockVariant.get(rock, type);
//noinspection ConstantConditions
setHarvestLevel(c.getHarvestTool(c.getDefaultState()), c.getHarvestLevel(c.getDefaultState()));
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
private BlockSlabTFC(Tree wood)
{
this(BlockPlanksTFC.get(wood));
Block c = BlockPlanksTFC.get(wood);
//noinspection ConstantConditions
setHarvestLevel(c.getHarvestTool(c.getDefaultState()), c.getHarvestLevel(c.getDefaultState()));
Blocks.FIRE.setFireInfo(this, 5, 20);
}
内容来源于网络,如有侵权,请联系作者删除!