Java Code Examples for net.minecraft.block.material.Material#PACKED_ICE

The following examples show how to use net.minecraft.block.material.Material#PACKED_ICE . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public boolean canMineBlock(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(), 0) != null;
}
 
Example 2
@Override
public boolean canMineBlock(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;
}
 
Example 3
@Override
public void convertBlockDrops(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, List<ItemStack> dropList, ItemStack toolStack) {
    if (blockState.getMaterial() == Material.PACKED_ICE || blockState.getMaterial() == Material.ICE) {
        Item item = Item.getItemFromBlock(blockState.getBlock());
        ItemStack dropStack = new ItemStack(item, 1);
        world.setBlockToAir(blockPos);
        dropList.add(dropStack);
    }
}
 
Example 4
@Override
public boolean canMineBlock(IBlockState block, ItemStack stack) {
    String tool = block.getBlock().getHarvestTool(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;
}
 
Example 5
@Override
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
    if (this.isToolBroken(stack))
    {
        return false;
    }

    ToolType tool = ToolType.fromStack(stack);

    if (tool.equals(ToolType.PICKAXE)) // Ender Pickaxe
    {
        if (state.getMaterial() == Material.ROCK
            || state.getMaterial() == Material.GLASS
            || state.getMaterial() == Material.ICE
            || state.getMaterial() == Material.PACKED_ICE
            || state.getMaterial() == Material.REDSTONE_LIGHT
            || state.getMaterial() == Material.PISTON
            || state.getMaterial() == Material.IRON
            || state.getMaterial() == Material.ANVIL)
        {
            //System.out.println("canHarvestBlock(): true; Pickaxe");
            return true;
        }
    }
    else if (tool.equals(ToolType.AXE)) // Ender Axe
    {
        if (state.getMaterial() == Material.WOOD
            || state.getMaterial() == Material.LEAVES
            || state.getMaterial() == Material.GOURD
            || state.getMaterial() == Material.CARPET
            || state.getMaterial() == Material.CLOTH
            || state.getMaterial() == Material.PLANTS
            || state.getMaterial() == Material.VINE)
        {
            //System.out.println("canHarvestBlock(): true; Axe");
            return true;
        }
    }
    else if (tool.equals(ToolType.SHOVEL)) // Ender Shovel
    {
        if (state.getMaterial() == Material.GROUND
            || state.getMaterial() == Material.GRASS
            || state.getMaterial() == Material.SAND
            || state.getMaterial() == Material.SNOW
            || state.getMaterial() == Material.CRAFTED_SNOW
            || state.getMaterial() == Material.CLAY)
        {
            //System.out.println("canHarvestBlock(): true; Shovel");
            return true;
        }
    }

    //System.out.println("canHarvestBlock(): false");
    return false;
}